Create, run, schedule, or debug MotherDuck Flights, Python jobs executed on MotherDuck compute.
Getting started
Full instructionsInstall the skill, then ask your AI tool for the task in plain words. The full SKILL.md below shows what it covers.
Instructions: SKILL.mdv1.0.5
Create and Manage MotherDuck Flights
Source Of Truth
- Non-negotiable ordering: when MotherDuck MCP is available, call
get_flight_guidebeforecreate_flight,update_flight, oredit_flight_source. The guide defines the current authoring contract, runtime limits, and tool semantics. get_flight_guidealso surfaces conventions from the reservedflightsGuide topic. Apply those conventions when they fit the requested workload.- Prefer current MotherDuck Flights docs over memory. Verify lifecycle status, runtime limits, and tool semantics instead of preserving them as durable prompt claims.
- Without MCP, the same operations exist as SQL functions (
MD_CREATE_FLIGHT,MD_RUN_FLIGHT,MD_LIST_FLIGHTS(), ...) that execute server-side on a MotherDuck connection. Parameter names differ slightly between the two surfaces; see the naming table inreferences/FLIGHTS_GUIDE.md.
Default Posture
- One Flight = one single-file Python script with
def main(): ...andif __name__ == "__main__": main(). No CLI args — every knob comes from env vars viaconfig(non-secret) orTYPE flightssecrets (sensitive). - Connect with
duckdb.connect("md:"); the runtime injectsMOTHERDUCK_TOKENautomatically. Never hardcode a token in source, config, or requirements. - Always pin dependencies in
requirements_txt. Pinduckdbto the versionget_flight_guidenames (2.0.1as of December 2026), or read it fromhttps://api.motherduck.com/latest_supported_duckdb_version.txtwhen the guide isn't available. An unpinned or unsupportedduckdbcan fail at connect. - Each secret param is injected under a stable namespaced
<secret_name>_<PARAM>key and, when safe, a bare<PARAM>convenience alias. Prefer namespaced keys in deployed Flight code; bare aliases can collide, be overridden by config, and are withheld for reserved runtime keys. - Bulk-load, never row-by-row: stage to
/tmp/andread_csv_auto/read_json_auto/read_parquet, or one CTAS /INSERT ... SELECT. Noexecutemany()against MotherDuck. - Make every run idempotent:
CREATE OR REPLACE TABLEfull refresh, partitionDELETE+INSERT, or dltwrite_disposition="merge"with a primary key. Bootstrap withCREATE DATABASE IF NOT EXISTS/CREATE SCHEMA IF NOT EXISTSso the first run succeeds on a fresh account. - Validate any config-supplied identifier (database, schema, table names) against
[A-Za-z_][A-Za-z0-9_]*before interpolating it into DDL; bind all data values as?parameters. - Create the flight without a schedule first, trigger one on-demand run, read the logs, and only then attach
schedule_cron(5-field cron, UTC). - Set and validate
max_runtime_secwhen the workload needs an explicit cap; read the current plan limit fromget_flight_guideinstead of hardcoding it. - For production, use a service-account token via
access_token_nameand keep its database permissions as narrow as the workload allows. - Treat a Flight as orchestration and light processing, not a place to crunch large tables in Python memory. Push heavy compute into SQL and verify runtime capacity with
get_flight_guidebefore sizing disk- or memory-intensive work. - Leave
instance_typeout: each plan has its own default size, the default always works, and a size the plan doesn't allow is rejected. ChooseF4only for light jobs that mostly call APIs or send SQL (SQL overmd:runs on a Duckling, not the Flight), and raise the size only when runs still fail from memory after reducing peak memory. The end ofget_flight_guidenames this organization's default and allowed sizes. - When a Flight touches only one or a few databases, connect with
duckdb.connect("md:<db>?attach_mode=single")and attach the others explicitly; attaching the whole workspace slows every run's startup. - For classification, extraction, or embeddings inside a Flight, call
prompt_jev(),prompt(), orembedding()in SQL over the existing connection instead of adding an LLM SDK. - To let teammates, a role, or a Dive's viewers start a Flight, the owner grants
run(grant_accessover MCP, orGRANT 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. Prefer a role overORGANIZATION, which includes service accounts. Every run uses the owner's token and secrets, so validate each config value a caller can pass as untrusted input. - Instrument every new Flight for the Flight Explainer by default: a Mermaid step chart in
metadata.chart(never in the source) plus amark()helper that prints@flight-run <step> <status>lines (see the templates). It costs a few lines and cannot be added to a run after it starts, so skip it only when the user asks. Callget_flight_viz_guidefor fan-out, branches, or child Flights, and useview_flight_runto show a run as a step diagram instead of pasting raw logs. - Ask the user to create Flight secrets in the MotherDuck UI (Settings, Secrets) so values never pass through chat; check existence with
SELECT name FROM duckdb_secrets() WHERE type = 'flights'.
Workflow
- Classify the job: ingestion, transformation/refresh, export or alerting, or admin automation. If the job is interactive analysis or a one-off query, use
motherduck-queryinstead — no Flight needed. - Call
get_flight_guide(MCP) and confirm which database the flight writes to withmotherduck-explore. - Reuse a matching template in
references/FLIGHT_EXAMPLES.mdwhen it fits; otherwise write a focused script that preserves the runtime, secrets, and idempotency contracts. - Create any required
TYPE flightssecret first, thencreate_flightwithname,source_code, pinnedrequirements_txt,metadata.chart, and only theconfigand secret names the Flight needs; noschedule_cronorinstance_typeyet. run_flight, pollget_flight_runwhen available (orlist_flight_runsas a fallback) until terminal, and readget_flight_logs. Iterate withedit_flight_source(surgical) orupdate_flight(full field replacement); each content change creates a new version.- If scheduling was requested, set it only after a successful run with
update_flight(schedule_cron = ...)and state that cron is UTC. Clear it withschedule_cron = ""only when requested; preserve an existing schedule during unrelated edits. - After the first successful run that creates or refreshes a durable table, create or update a private (
useraccess) Guide for it under thedata-sourcestopic, asget_flight_guidedirects, and tell the user which Guide changed (seemotherduck-manage-guides). - If other users or a Dive must trigger the Flight, recommend
rungrants, apply them only after the user confirms, and verify withSELECT * FROM md_list_flight_grantees('<flight_id>'::UUID).
For answer, review, or planning requests, do not create or schedule a Flight. For create or update requests, complete the requested in-scope deployment and on-demand validation; attaching a recurring schedule is authorized only when the request includes scheduling.
References
Read only the reference sections needed for the current task.
- Read
references/FLIGHTS_GUIDE.mdfor the full concept and operations reference: anatomy, runtime environment and sizes, config vs secrets, scheduling, versioning, run lifecycle, run grants, Flight Explainer instrumentation, the complete MCP tool reference, MCP-vs-SQL naming, loading strategies by data volume, and troubleshooting. - Read
references/FLIGHT_EXAMPLES.mdfor three complete, best-practice flight templates (dlt ingestion, Postgres ingestion, scheduled S3 partition refresh) with theirrequirements.txt, secret setup, and deploy calls.
Related Skills
Load related skills only for missing capabilities; reuse established context.
motherduck-load-datafor choosing the ingestion SQL the flight will run (CTAS,INSERT ... SELECT, cloud-storage secrets)motherduck-queryfor validating the DuckDB SQL inside the flight before deploying itmotherduck-explorefor confirming target databases, schemas, and tables existmotherduck-build-data-pipelinewhen the work is a full raw/staging/analytics pipeline design and the flight is just its schedulermotherduck-create-divewhen a Dive button or form should start the Flight (write-back)motherduck-cliwhen the agent has a shell and should keep Flight source in local filesmotherduck-manage-guidesfor reusable personal or organization Flight conventions
Explore more skills
Browse all- Motherduck Design DiveDesign or improve a MotherDuck Dive’s layout, responsive behavior, themes, filters, and visual accessibility.
- Motherduck Build Malleable DiveBuild a generative MotherDuck Dive where a Flight writes a daily briefing and question-to-page specs from a semantic…
- Motherduck Manage GuidesRead or maintain MotherDuck Guides for business definitions, join rules, and reusable warehouse conventions.
- Motherduck Model DataDesign or implement MotherDuck analytical schemas and transformation models, including grain, types, and…
- Motherduck ExploreFind and understand MotherDuck databases, tables, columns, shares, and sample data, including which tables hold a given…
- Motherduck Share DataCreate, consume, or manage MotherDuck data shares, including audience grants, table filters, and refresh policy.
Security
Reviews (0)
More from MotherDuck Agent Skills
View source →Frequently asked questions about motherduck-create-flight
What does the motherduck-create-flight skill do?
Create, run, schedule, or debug MotherDuck Flights, Python jobs executed on MotherDuck compute. 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-create-flight skill?
Run `npx @skills-hub-ai/cli install motherduck-create-flight` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/motherduck-create-flight/ 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-create-flight work with?
motherduck-create-flight 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-create-flight 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-create-flight after installing it?
In Claude Code, type `/motherduck-create-flight` (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-create-flight 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.
Badge for your README
Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.
[](https://skills-hub.ai/skills/motherduck-create-flight)<a href="https://skills-hub.ai/skills/motherduck-create-flight"><img src="https://skills-hub.ai/api/badges/skill/motherduck-create-flight" alt="Install on Skills Hub"></a>More options in the badge docs.