Skip to main content

motherduck-build-malleable-dive

Build a generative MotherDuck Dive where a Flight writes a daily briefing and question-to-page specs from a semantic catalog, and viewers ask, investigate, and rearrange it.

v1.0.0New

Install this skill

No account required. Pick your tool, or use the command that detects it for you.

Run in your terminal. It detects your AI tool.

npx @skills-hub-ai/cli install motherduck-motherduck-build-malleable-dive
Or get the file:
Browse all CLI commands →
Manual setup by platform

Claude Code

~/.claude/skills/motherduck-motherduck-build-malleable-dive/SKILL.md

Setup guide →

Signing

SignedSLSA L2
Signed by
skills-hub.ai distributor
Method
Distributor-signed by skills-hub.aiCryptographically signed by the skills-hub.ai distributor key at publish time.
Signed
0Save

Instructions

Build a Malleable Dive

A malleable Dive is a page that is generated rather than hand-built. A Flight turns a question, an insight, or a fixed daily plan into a JSON spec. The Dive renders that spec with the motherduck-dive-components kit, and viewers rearrange it. Use this skill for a daily briefing with insights that drill down, or a Dive that answers new questions with new pages. For one fixed dashboard, use motherduck-build-dashboard.

Start Here: Is a MotherDuck Server Active?

Use an active remote MotherDuck MCP server or local MotherDuck server to inspect the in-scope databases or shares: grain, date range, categorical columns and their values, and how fresh each source is. Reuse known context and narrow discovery to the requested work; do not scan the whole workspace by default. Let the actual data model shape the recipe. If an existing Dive covers the domain, reuse its metric definitions so the numbers match what people already trust.

Resolve the target from the request or active context. Ask only if ambiguity materially affects the result. Without a server, use supplied schema and explicit assumptions for planning; do not imply live validation.

Interview First

Before writing a recipe, ask the owner who reads the briefing, what they decide, which numbers and targets matter, what explains a change, and which questions they expect to ask. references/RECIPE_GUIDE.md has the eight questions. Write the answers into a Guide (topic briefings/<db>), into the recipe, and into questions.json. When you can't wait for the answers, or the user asked for a plan, list the questions with the assumptions you would use, and continue with the full design. After the first briefing, ask which insight they would act on, which is noise, and what is missing.

How It Works

The template is in artifacts/. A recipe holds everything domain-specific; the rest stays generic:

  • recipes/<name>/domain.py: the sources to attach, the marts (curated tables), a catalog of datasets, dimensions and measures with descriptions, metrics to watch for change, the fixed daily plan, and context for the model.
  • recipes/<name>/app.json: brand, theme (a kit theme key or a makeTheme brand), example questions, output database, Flight id.
  • python3 artifacts/build.py recipes/<name> writes flight/main.py and dive/index.tsx. It inlines the planner rules from the kit's components.json and assembles the kit into the Dive. It finds the kit next to this skill, or through --kit PATH.

The Flight runs in four modes:

ModeWhat it does
briefingPlans the page from the recipe's fixed plan. Runs on a schedule.
feedbackRecords viewer events only.
askPlans a page that answers the viewer's question.
investigatePlans a drill-down that explains an insight. Its PARENT is the page the insight came from.
refreshRebuilds the marts.

Every mode runs the same steps:

  1. Marts: build the curated tables. Only briefing and refresh rebuild marts that already exist.
  2. Plan: prompt() returns a plan through a strict JSON schema whose enums are the catalog ids and the kit's component types.
  3. Compile: Python validates the plan and compiles it to SQL with bound parameters.
  4. Changes: a deterministic scan for weekly shifts in the watched metrics.
  5. Probe: prompt() proposes up to three follow-up queries that test why something moved. They're catalog ids too, so Python writes the SQL.
  6. Narrate: prompt() writes the headline, insights, captions, a "so what" line per block, and annotations.
    • It reads the follow-up results, the recipe's Guides, the last briefings' insights and viewer ratings.
    • It marks each insight new, ongoing, worsening, improving or resolved.
    • Every number is checked against the data, and if too many don't match, the narrator retries once.
    • It may ask viewers up to two questions about a date or segment the data can't explain. Their answers become notes on the charts and context for every later analysis.
  7. Publish: one spec row in <db>.main.dive_specs. The run, its model calls, its insights and any viewer feedback go to the log tables. After a briefing, the Flight updates a memory Guide.

The Dive learns from use:

  • Viewer ratings and chart-type switches reach the Flight with the next run, because a Dive can't write.
  • The chart types viewers keep choosing become the defaults.
  • Viewers answer the briefing's questions or pin a note to any chart; notes explain later movements and appear on every chart that shows that date or value.
  • A Memory page shows the insight timeline, questions, viewer actions and prompt versions.

references/LEARNING_LOOP.md covers the tables, Guides, feedback and eval.py.

One Flight can serve several boards: dashboards for different audiences on the same data, such as a daily team view and a monthly leadership view. Each board has its own morning page, memory and Dive, and they all share the marts, viewer notes and Guides. references/RECIPE_GUIDE.md covers BOARDS.

The Dive reads only that table. It starts the Flight with useRunFlight and follows it with useFlightRun.

Workflow

  1. Explore the data and write the recipe. Copy artifacts/recipes/nyc-311 (public sample_data), then follow references/RECIPE_GUIDE.md.
  2. Build, then run the Flight locally with MODE=briefing. Check the spec against the guide's checklist. Ask 3 questions, including one off-topic, and investigate one insight. Run python3 artifacts/eval.py recipes/<name> and keep the --out file as the baseline. Run 3 briefings with consecutive AS_OF dates, and check that insights continue rather than repeat.
  3. When MotherDuck MCP is available, call get_flight_guide before create_flight, update_flight, or edit_flight_source. Push the Flight with motherduck-cli: a daily schedule, a 600-second max runtime, and every config key the Dive sends (MODE, PROMPT, REQUEST_ID, PARENT, AS_OF, MODEL, FEEDBACK, BOARD). Run it once in the cloud and read the logs.
  4. Put the Flight id in app.json, rebuild, and preview with motherduck dive watch recipes/<name>/dive. Test the briefing, one question, one Investigate click and Arrange mode.
  5. When MotherDuck MCP is available, call get_dive_guide before writing Dive code and before every save_dive, update_dive, or edit_dive_content. Before save_dive or update_dive, follow the review step that get_dive_guide sets for your client: when it asks you to show the final source or preview and get the user's go-ahead, do that once, unless the user already said to save without review.

The work is done when:

  • the briefing, a question and an investigation each render in the preview with no compile or query errors;
  • the eval baseline exists;
  • the page's number check passes;
  • at least one headline number matches a hand-written query.

To let others use the Dive, they need a share of the output database and run on the Flight. The owner grants run (grant_access over MCP, or GRANT RUN ON FLIGHT '<flight_id>' TO ROLE <role>). Recommend the grantees and grant only after the user confirms; a request to share a Dive is not that confirmation.

For answer, review, or planning requests, stop at the requested recipe, plan, or design. For build requests, carry the in-scope work through the local run and preview. Ask before destructive replacement or a broader rollout.

When this skill produces a native DuckDB (md:) connection, watermark it with custom_user_agent=agent-skills/3.3.0(harness-<harness>;llm-<llm>). If metadata is missing, fall back to harness-unknown and llm-unknown. The template engine reads them from MOTHERDUCK_AGENT_HARNESS and MOTHERDUCK_AGENT_LLM.

Rules That Keep It Safe

  • The model names only catalog ids and component types; Python writes all SQL, with filter values as bound parameters. Never let a model write SQL that the Flight or the Dive runs.
  • Every run uses the Flight owner's token. The engine validates each config value a caller can pass: the mode, id formats, a 600-character prompt cap, and ISO dates.
  • Highlights, annotations, and marker series survive only if they exist in the block's data.
  • The Dive never runs SQL from a spec; the Source panel's SQL is display text.
  • Viewer feedback reaches the database only through the Flight, which validates every event.
  • The viewer's layout lives in useDiveState('layout') per page and overrides the generated layout. The open page's question and headline go to useDiveState('context'), which the Dive's AI Chat reads.

Output

For a full engagement, cover the recipe (sources, marts, catalog, daily plan), the validated headline numbers, the Flight and Dive ids and URLs, and the grants the user still has to confirm. For explicit structured JSON requests, read the output contract.

References

  • references/RECIPE_GUIDE.md -- writing domain.py and app.json, catalog descriptions, the spec checklist, custom components
  • references/SPEC_CONTRACT.md -- the spec the Flight writes and the Dive renders
  • references/LEARNING_LOOP.md -- log tables, memory, Guides, viewer feedback, the analyst step, the number check, eval.py
  • references/EXECUTION_REFERENCE.md -- local runs, evals, deploy commands, structured output

Related Skills

Load related skills only for missing capabilities; reuse established context.

  • motherduck-dive-components for the component kit, themes, brand themes, and custom components
  • motherduck-create-flight for Flight scheduling, secrets, run grants, and the Flight Explainer
  • motherduck-create-dive for the Dive runtime contract, saving, sharing, and embedding
  • motherduck-explore and motherduck-query for the data behind the catalog
  • motherduck-cli for flight push, dive watch, and dive push
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

Browse all →

More from MotherDuck Agent Skills

View source →

More Build skills

Browse category →
senior-frontendBuild and review React, Next.js, TypeScript or Tailwind frontends: components, scaffolding, performance and bundle size. Use whenever the user wants a new component or app, a page feels slow, the bundle is too big, or asks for a frontend code review.635 installsui-design-systemUse when building a design system: tokens, component docs, responsive scales or developer handoff. Generates tokens with design_token_generator.py.535 installsfrontend-designGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.346 installssenior-backendBuild and fix backend services: REST or GraphQL APIs, auth, microservices, PostgreSQL queries, migrations and load tests. Use whenever the user's API is slow or broken, needs login or auth added, a schema change, or a new endpoint or service scaffolded.246 installsself-improving-agentCurate what the agent has learned into durable project knowledge. Reviews Claude Code auto-memory (MEMORY.md and its topic files) for learnings worth keeping, promotes proven ones into CLAUDE.md or .claude/rules/, records a correction as a lesson that persists across sessions, prunes stale or duplicate entries, and turns a recurring fix into a reusable skill. Use whenever the user asks what you have learned or saved about the project, which memories should become permanent rules, to remember a lesson or stop repeating a mistake, or to clean up, audit or check memory health.173 installsusing-superpowersUse when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions145 installs

Frequently asked questions about motherduck-build-malleable-dive

What does the motherduck-build-malleable-dive skill do?

Build a generative MotherDuck Dive where a Flight writes a daily briefing and question-to-page specs from a semantic catalog, and viewers ask, investigate, and rearrange it. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the motherduck-build-malleable-dive skill?

Run `npx @skills-hub-ai/cli install motherduck-motherduck-build-malleable-dive` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/motherduck-motherduck-build-malleable-dive/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does motherduck-build-malleable-dive work with?

motherduck-build-malleable-dive runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the motherduck-build-malleable-dive skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use motherduck-build-malleable-dive after installing it?

In Claude Code, type `/motherduck-motherduck-build-malleable-dive` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the motherduck-build-malleable-dive skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.