Agent Skill · MotherDuck

motherduck-model-data

Design and build database schemas and data models in MotherDuck. Produces a file-based project scaffold. Use when creating tables, choosing data types, defining relationships, or restructuring data for analytics workloads.

Provider: MotherDuck Path in repo: plugins/motherduck-skills/skills/motherduck-model-data/SKILL.md

Skill body

Model Data in MotherDuck

Use this skill when creating data models, tables, designing schemas, choosing data types, defining relationships between tables, or restructuring data for analytical workloads.

Core Behavior

When a user asks questions like “build a data model”, “model my data”, or “create a transformation layer”, the default output is a file-based project scaffold — not just SQL executed directly in the warehouse.

The project scaffold includes:

This is a lightweight framework-agnostic convention for organizing SQL transformations that can be reviewed, versioned, and rerun.

Prerequisites

Default Posture

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. Run the models against the warehouse and verify the resulting tables match expected grain and row counts. If MCP is the runner, DDL or CTAS execution uses query_rw only after explicit user approval; the default deliverable remains checked-in SQL files plus the manifest.

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, materialization

When 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

Skill frontmatter

license: MIT