A pipeline that runs and a pipeline that is correct are two different things.
Mehdi Ouazza · MotherDuck · mehdio.com
The one-shot prompt
The pipeline is green · here's what it says
YEAR=2024 + CREATE OR REPLACE — wipes the table on every runno backfillQ_FLAG — the pipeline ingests them anywaygarbage in01
The old discipline didn't disappear — it matters more at generation speed
02
Any MCP for your database works — here, the MotherDuck MCP

Q_FLAG marks failed quality checks at the sourceEyes on the data + fundamentals in the prompt → the robust version
YEARS is a parameter — backfill or reprocess any yearflexibleDATA_VALUE / 10.0 — degrees, not tenthscorrect unitsQ_FLAG is set — the source already told you they're badQA'dAnd now it can write tests that mean something
03 · the hardest one
Judge the output against a goal you set up front — not the code
Contract → assertion · write, audit, publish
Why the contract matters · US mean TMAX · 1974 → 2024
Bonus · a chart spots weirdness faster than rows
04
All those rules, in one markdown file — so it happens every time
github.com/motherduckdb/agent-skills
The final prompt · one paragraph, four disciplines
md:climate_demo.daily_tmax. Before writing any transform, use the MotherDuck MCP to inspect the source on S3: schema, units, null rates, and duplicate keys. Judge the output against a contract, not the code: one row per station and day, value in Celsius (DATA_VALUE is tenths of a degree), keep only readings that passed QC where Q_FLAG is null, and the KPI is same-station mean TMAX per year, holding the station set fixed so changing coverage does not bias the trend. Take the year(s) as a parameter so I can backfill any year, make it idempotent by deleting the year then inserting so a re-run is a no-op, and read straight from the public S3 parquet with no download. Factor the transform into a pure SQL function and write golden tests that run on local DuckDB (a tenths-of-a-degree value, a QC-failed row, a duplicate), add a Write-Audit-Publish step that refuses to publish if any reading is outside −90 to 60 °C or a key is null, then deploy it, run it, read the logs, and iterate until the audit passes.