/motherduck-model-data
Design and build database schemas and data models in MotherDuck. Produces a file-based SQL project scaffold with a model manifest. Use for any schema design or data modeling task — creating tables, choosing data types, star schemas, wide denormalized tables,
$ npx -y skills add motherduckdb/agent-skills --skill motherduck-model-data --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/motherduck-model-data
Context preview
The summary Claude sees to decide when to auto-load this skill.
Design and build database schemas and data models in MotherDuck. Produces a file-based SQL project scaffold with a model manifest. Use for any schema design or data modeling task — creating tables, choosing data types, star schemas, wide denormalized tables,
SKILL.md
motherduck-model-data.SKILL.mdname: motherduck-model-data
description: Design and build database schemas and data models in MotherDuck. Produces a file-based SQL project scaffold with a model manifest. Use for any schema design or data modeling task — creating tables, choosing data types, star schemas, wide denormalized tables, raw/staging/analytics layers, dbt-style transformation projects, or restructuring data for analytics workloads.
license: MIT
Model Data in MotherDuck
Core Behavior
For multi-model or transformation-layer work, default to a file-based project scaffold rather than warehouse-only SQL execution.
The project scaffold includes:
- **SQL files** organized by lifecycle stage (`raw/`, `staging/`, `analytics/`)
- **A manifest** (`model_manifest.yml`) defining the DAG: model names, dependencies, materialization strategy, and target database
This is a lightweight framework-agnostic convention for organizing SQL transformations that can be reviewed, versioned, and rerun.
Prerequisites
- MotherDuck connection established via `motherduck-connect`
- Existing source shape understood via `motherduck-explore`
- DuckDB SQL syntax available via `motherduck-duckdb-sql`
Default Posture
- Design for analytical reads, not transactional writes.
- Prefer wide denormalized tables and pre-aggregated serving tables over highly normalized OLTP-style schemas.
- Use fully qualified names and add comments to tables and columns.
- Use `NOT NULL` aggressively; do not assume primary keys or foreign keys are enforced.
- Reuse an existing dbt, SQLMesh, or repo-local modeling convention when one is already present; create the lightweight scaffold only when there is no established project shape.
- Separate `raw`, `staging`, and `analytics` lifecycle stages when the project is non-trivial.
Workflow
1. Inspect the current source tables and actual column types before designing new models. 2. Choose the target lifecycle stage and grain for each modeled table. Map dependencies between models. 3. Create the project directory structure with SQL files and manifest. 4. Author each model as a standalone SQL file. Use explicit types, nullability, comments, and fully qualified names. Decide between a table, CTAS rebuild, or view based on freshness and cost. 5. Fill in the manifest with model metadata: name, path, stage, materialization, database, and `depends_on` references. 6. When the request includes implementation, run the models and verify that the resulting tables match the expected grain and row counts. If MCP is the runner, use `query_rw` because DDL and CTAS are writes; the user's implementation request authorizes in-scope execution. For answer, review, or planning requests, keep the deliverable to SQL files plus the manifest and do not mutate the warehouse.
Expected Project Structure
<project-name>/
models/
raw/
raw_<entity>.sql -- DDL for raw landing tables
staging/
stg_<entity>.sql -- Deduplicated, typed, filtered
analytics/
dim_<entity>.sql -- Dimension tables
fct_<entity>.sql -- Fact / metric tables
model_manifest.yml -- DAG: names, deps, materializationWhen to Skip the Scaffold
If the user explicitly asks for a single table, a quick DDL statement, or an ad-hoc exploration query, produce the SQL directly. The scaffold is the default for **modeling work** — multi-table, multi-stage transformations with dependencies.
Open Next
- Read `references/MODELING_PLAYBOOK.md` for schema patterns, data-type guidance, CTAS/view decisions, complex types, constraints, project scaffold conventions, and common modeling mistakes.
Related Skills
- `motherduck-duckdb-sql` for type syntax and function details
- `motherduck-query` for executing DDL, rebuilds, and validation queries
- `motherduck-explore` for understanding the source schema before remodeling
- `motherduck-load-data` for ingestion paths that feed the modeled tables
Read more
name: motherduck-model-data description: Design and build database schemas and data models in MotherDuck. Produces a file-based SQL project scaffold with a model manifest. Use for any schema design or data modeling task — creating tables, choosing data types, star schemas, wide denormalized tables, raw/staging/analytics layers, dbt-style transformation projects, or restructuring data for analytics workloads. license: MIT
Model Data in MotherDuck
Core Behavior
For multi-model or transformation-layer work, default to a file-based project scaffold rather than warehouse-only SQL execution.
The project scaffold includes:
- **SQL files** organized by lifecycle stage (`raw/`, `staging/`, `analytics/`)
- **A manifest** (`model_manifest.yml`) defining the DAG: model names, dependencies, materialization strategy, and target database
This is a lightweight framework-agnostic convention for organizing SQL transformations that can be reviewed, versioned, and rerun.
Prerequisites
- MotherDuck connection established via `motherduck-connect`
- Existing source shape understood via `motherduck-explore`
- DuckDB SQL syntax available via `motherduck-duckdb-sql`
Default Posture
- Design for analytical reads, not transactional writes.
- Prefer wide denormalized tables and pre-aggregated serving tables over highly normalized OLTP-style schemas.
- Use fully qualified names and add comments to tables and columns.
- Use `NOT NULL` aggressively; do not assume primary keys or foreign keys are enforced.
- Reuse an existing dbt, SQLMesh, or repo-local modeling convention when one is already present; create the lightweight scaffold only when there is no established project shape.
- Separate `raw`, `staging`, and `analytics` lifecycle stages when the project is non-trivial.
Workflow
1. Inspect the current source tables and actual column types before designing new models. 2. Choose the target lifecycle stage and grain for each modeled table. Map dependencies between models. 3. Create the project directory structure with SQL files and manifest. 4. Author each model as a standalone SQL file. Use explicit types, nullability, comments, and fully qualified names. Decide between a table, CTAS rebuild, or view based on freshness and cost. 5. Fill in the manifest with model metadata: name, path, stage, materialization, database, and `depends_on` references. 6. When the request includes implementation, run the models and verify that the resulting tables match the expected grain and row counts. If MCP is the runner, use `query_rw` because DDL and CTAS are writes; the user's implementation request authorizes in-scope execution. For answer, review, or planning requests, keep the deliverable to SQL files plus the manifest and do not mutate the warehouse.
Expected Project Structure
<project-name>/
models/
raw/
raw_<entity>.sql -- DDL for raw landing tables
staging/
stg_<entity>.sql -- Deduplicated, typed, filtered
analytics/
dim_<entity>.sql -- Dimension tables
fct_<entity>.sql -- Fact / metric tables
model_manifest.yml -- DAG: names, deps, materializationWhen to Skip the Scaffold
If the user explicitly asks for a single table, a quick DDL statement, or an ad-hoc exploration query, produce the SQL directly. The scaffold is the default for **modeling work** — multi-table, multi-stage transformations with dependencies.
Open Next
- Read `references/MODELING_PLAYBOOK.md` for schema patterns, data-type guidance, CTAS/view decisions, complex types, constraints, project scaffold conventions, and common modeling mistakes.
Related Skills
- `motherduck-duckdb-sql` for type syntax and function details
- `motherduck-query` for executing DDL, rebuilds, and validation queries
- `motherduck-explore` for understanding the source schema before remodeling
- `motherduck-load-data` for ingestion paths that feed the modeled tables
Opinionated AI agent skills for building applications with MotherDuck
Other skills on motherduckdb-agent-skills.
- /motherduck-build-cfa-app
Design a MotherDuck-backed customer-facing analytics app. Use for embedded analytics, multi-tenant SaaS reporting, or product analytics for external users -- whenever the decision depends on per-customer isolation, backend routing, service-account boundaries, read scaling, or
Open skill - /motherduck-build-dashboard
Build a live MotherDuck dashboard as a Dive. Use when composing one shareable KPI, trend, and breakdown story over existing MotherDuck data, especially when the result should stay a saved workspace artifact rather than a full application.
Open skill - /motherduck-build-data-pipeline
Design an end-to-end MotherDuck data pipeline. Use for ETL/ELT workflows -- choosing raw, staging, and analytics boundaries, bulk ingestion paths, transformation sequencing, dlt/dbt integration, publication targets, or whether DuckLake is actually required.
Open skill - /motherduck-connect
Connect to MotherDuck from any application. Use when setting up database connectivity via the Postgres endpoint (recommended), pg_duckdb, native DuckDB API, or JDBC. Covers connection strings, authentication, SSL, and environment variable configuration.
Open skill - /motherduck-create-dive
Create, edit, manage, share, or embed MotherDuck Dives — live React + SQL dashboards, charts, and data apps saved in the workspace. Use for any dashboard, chart, KPI display, or data visualization over MotherDuck data, and for Dive authoring mechanics such as get_dive_guide,
Open skill - /motherduck-create-flight
Create, schedule, run, and debug MotherDuck Flights — Python jobs that run on MotherDuck compute. Use whenever someone wants to create a flight, schedule a Python script or recurring job on MotherDuck, set up scheduled ingestion from Postgres, dlt sources, S3, BigQuery,
Open skill

