AGENT SKILL

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, raw/staging/analytics layers, dbt-style transformation projects, or restructuring data for analytics workloads.

License 许可
MIT
最近更新
2026-11-13
Stars
★ 1
Forks
0

01 前言 Front Matter

name
motherduck-model-data
license
MIT
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.

02 资源文件 1

03 SKILL.md 正文

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:

  • 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.
  • Always produce SQL files — never execute transformations directly in the warehouse without first writing them to files.
  • Always produce a manifest — every model must declare its dependencies so the DAG is explicit and reproducible.

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

  • 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

04 同仓库更多 Skills

cianfhoghlaim
cianfhoghlaim/ciandlithe

pydantic-ai-harness

Extend Pydantic AI agents with batteries-included capabilities from pydantic-ai-harness -- currently Code Mode, which collapses many tool calls into one sandboxed Python execution. Use when the user mentions pydantic-ai-harness, CodeMode, Monty, code mode, or tool sandboxing, when they want an agent to run agent-written Python, or when a Pydantic AI agent would benefit from orchestrating multiple tool calls in a single sandboxed script.

★ 1
cianfhoghlaim
cianfhoghlaim/ciandlithe

building-pydantic-ai-agents

Build AI agents with Pydantic AI — tools, capabilities (including on-demand loading), structured output, streaming, testing, and multi-agent patterns. Use when the user mentions Pydantic AI, imports pydantic_ai, or asks to build an AI agent, add tools/capabilities, defer capability loading, stream output, define agents from YAML, or test agent behavior.

★ 1
cianfhoghlaim
cianfhoghlaim/ciandlithe

motherduck-share-data

Create and manage MotherDuck data shares for zero-copy, read-only data distribution. Use whenever someone wants to share a database with team members, another organization, or the public — covers CREATE SHARE, access/visibility/update modes, GRANT READ ON SHARE, attaching share URLs, UPDATE SHARE, and REFRESH DATABASE.

★ 1
cianfhoghlaim
cianfhoghlaim/ciandlithe

motherduck-security-governance

Explain MotherDuck security, governance, and access-control patterns. Use for any question about SOC 2, GDPR, compliance, data residency, regions, SSO, service accounts, token handling, tenant isolation, sharing boundaries, snapshots and recovery, or governance posture — including when a security_compliance_owner, technical_owner, or application_builder is evaluating MotherDuck.

★ 1
cianfhoghlaim
cianfhoghlaim/ciandlithe

motherduck-rest-api

MotherDuck REST API control-plane reference. Use when calling api.motherduck.com to provision service accounts, create, list, rotate, or revoke access tokens, configure Duckling instance sizes and read scaling, inspect active accounts, or mint Dive embed sessions. Not for SQL or data-plane query work.

★ 1
cianfhoghlaim
cianfhoghlaim/ciandlithe

motherduck-query

Execute DuckDB SQL queries against MotherDuck databases. Use when running analytics, aggregations, transformations, or any SQL operation. Covers query best practices, CTEs, window functions, QUALIFY, and performance optimization.

★ 1