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.
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-diveManual setup by platform
Claude Code
~/.claude/skills/motherduck-motherduck-build-malleable-dive/SKILL.md
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
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 amakeThemebrand), example questions, output database, Flight id.python3 artifacts/build.py recipes/<name>writesflight/main.pyanddive/index.tsx. It inlines the planner rules from the kit'scomponents.jsonand assembles the kit into the Dive. It finds the kit next to this skill, or through--kit PATH.
The Flight runs in four modes:
| Mode | What it does |
|---|---|
briefing | Plans the page from the recipe's fixed plan. Runs on a schedule. |
feedback | Records viewer events only. |
ask | Plans a page that answers the viewer's question. |
investigate | Plans a drill-down that explains an insight. Its PARENT is the page the insight came from. |
refresh | Rebuilds the marts. |
Every mode runs the same steps:
- Marts: build the curated tables. Only briefing and refresh rebuild marts that already exist.
- Plan:
prompt()returns a plan through a strict JSON schema whose enums are the catalog ids and the kit's component types. - Compile: Python validates the plan and compiles it to SQL with bound parameters.
- Changes: a deterministic scan for weekly shifts in the watched metrics.
- Probe:
prompt()proposes up to three follow-up queries that test why something moved. They're catalog ids too, so Python writes the SQL. - 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.
- 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
- Explore the data and write the recipe. Copy
artifacts/recipes/nyc-311(publicsample_data), then followreferences/RECIPE_GUIDE.md. - 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. Runpython3 artifacts/eval.py recipes/<name>and keep the--outfile as the baseline. Run 3 briefings with consecutiveAS_OFdates, and check that insights continue rather than repeat. - When MotherDuck MCP is available, call
get_flight_guidebeforecreate_flight,update_flight, oredit_flight_source. Push the Flight withmotherduck-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. - Put the Flight id in
app.json, rebuild, and preview withmotherduck dive watch recipes/<name>/dive. Test the briefing, one question, one Investigate click and Arrange mode. - When MotherDuck MCP is available, call
get_dive_guidebefore writing Dive code and before everysave_dive,update_dive, oredit_dive_content. Beforesave_diveorupdate_dive, follow the review step thatget_dive_guidesets 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 touseDiveState('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-- writingdomain.pyandapp.json, catalog descriptions, the spec checklist, custom componentsreferences/SPEC_CONTRACT.md-- the spec the Flight writes and the Dive rendersreferences/LEARNING_LOOP.md-- log tables, memory, Guides, viewer feedback, the analyst step, the number check,eval.pyreferences/EXECUTION_REFERENCE.md-- local runs, evals, deploy commands, structured output
Related Skills
Load related skills only for missing capabilities; reuse established context.
motherduck-dive-componentsfor the component kit, themes, brand themes, and custom componentsmotherduck-create-flightfor Flight scheduling, secrets, run grants, and the Flight Explainermotherduck-create-divefor the Dive runtime contract, saving, sharing, and embeddingmotherduck-exploreandmotherduck-queryfor the data behind the catalogmotherduck-cliforflight push,dive watch, anddive push
Security
Reviews (0)
Related skills
Browse all →More from MotherDuck Agent Skills
View source →More Build skills
Browse category →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.