apache-airflow-dags
Skill4 starsChanged 6 months agoMITView on GitHub
Expert-level guide for authoring Apache Airflow Dags, focusing on the skeleton strategy, contract-driven logic, and environment context. You MUST load this skill when asked to write, refactor, or structure Airflow Dags.
In this repository124 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/AGENTS.mdAGENTS.md
- .github/workflows/AGENTS.mdAGENTS.md
- .vscode/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- agent-log-analysisSkill
- agent-mdSkill
- agent-md-writerSkill
- agent-skill-md-writerSkill
- agentskillsSkill
- agents-md-writerSkill
- ai-prompt-writerSkill
- ansibleSkill
- apache-airflow-apiSkill
- astro-cliSkill
- astronomer-docsSkill
- awesome-copilotSkill
- brainstorm-agent-runsSkill
- brainstorm-github-prSkill
- brainstormSkill
- catSkill
- chrome-devtoolsSkill
- claude-docsSkill
- codeqlSkill
- code-reviewSkill
- code-tourSkill
- coding-standard-writerSkill
- context-aware-opsSkill
- copilot-cliSkill
- copilot-docsSkill
- critical-thinkingSkill
- datadog-agentSkill
- datadog-apiSkill
- datadog-mcpSkill
- datadog-monitorsSkill
- datadog-pulumiSkill
- devcontainerSkill
- dictationSkill
- direnvSkill
- dockerfileSkill
- dockerSkill
- docs-reviewSkill
- docs-writerSkill
- dot-claudeSkill
- dotfilesSkill
- dot-githubSkill
- editorconfigSkill
- fact-writerSkill
- gdpr-compliantSkill
- gh-agent-taskSkill
- gh-apiSkill
- gh-aw-compileSkill
- gh-aw-firewall-debugSkill
- gh-aw-firewallSkill
- gh-aw-newSkill
- gh-awSkill
- gh-aw-troubleshootingSkill
- gh-codespaceSkill
- gh-issueSkill
- gh-modelsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 35
Write Dag (title case) in all prose.
- Distinctive: line 36
Keep the all-caps or lowercase spelling only when reproducing a literal code token — never rewrite these, even inside fenced code blocks:
- Distinctive: line 40
Don't spell out Directed Acyclic Graph except for historical context.
- Distinctive: line 53
Context is King: Always prioritize explicit constraints over general assumptions, matching the target environment perfectly.
- Very specific: line 64
Assuming Idempotency: Never assume a task will automatically be idempotent.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Apache Airflow Dags
<!-- markdownlint-disable MD013 MD023 MD031 MD032 -->When to Use
- Generating or writing new Apache Airflow Dags.
- Refactoring, debugging, or analyzing existing Airflow Dags.
- Architecting data pipelines using Airflow's TaskFlow API.
When Not to Use
- Interacting with the Airflow REST API to trigger Dag runs or manage connections (use
apache-airflow-apiinstead).
Core Process
- Define the Universe: Explicitly declare the context (Airflow version, executor type, cloud provider, and constraints) before generating code to avoid deprecated syntax.
- Apply the Skeleton Strategy:
- Step 1: Draft the high-level plan in natural language without generating code.
- Step 2: Generate the Dag structure graph using placeholders (e.g.,
EmptyOperatorfromairflow.providers.standard.operators.empty). Do not add business logic or documentation yet. - Step 3: Iteratively replace placeholders with actual business logic and TaskFlow decorators.
- Step 4: Add selective comments explaining the why (not the what), configure retries, and set up notifications.
- Establish Data Contracts: Specify explicit input schemas, output targets, and idempotency constraints (e.g., using
MERGEorUPSERT) rather than vague transformation requests. - Format as a Technical Spec: Structure requests and workflows using Markdown headers (
## Goal,## Context,## Data Contract) and pseudo-XML tags (<schema>,<code_snippet>) for raw data. - Force the Source of Truth: Inject exact snippets from official documentation (e.g.,
llms.txt) to anchor the execution and prevent context contamination from older Airflow versions.
Naming Conventions & Grammar
- Write Dag (title case) in all prose.
- Keep the all-caps or lowercase spelling only when reproducing a literal code token — never rewrite these, even inside fenced code blocks:
- Python: the SDK class
DAG(from airflow.sdk import DAG,dag = DAG("my_dag", ...)); identifiers likedag_id,dag,my_dag. - CLI:
airflow dags list,airflow dags test, etc. - Paths and config keys:
dag_processing/,dagprocessor,get_dag, etc.
- Python: the SDK class
- Don't spell out Directed Acyclic Graph except for historical context.
Architecture Boundaries
- Users author Dags with the Task SDK (
airflow.sdk). - Dag File Processor parses Dag files in separate processes and stores serialized Dags in the metadata DB. Software guards prevent individual parsing processes from accessing the database directly and enforce use of the Execution API.
- Scheduler reads serialized Dags — never runs user code — and creates Dag runs / task instances.
- Workers execute tasks via Task SDK and communicate with the API server through the Execution API — never access the metadata DB directly. Each task receives a short-lived JWT token scoped to its task instance ID.
- Triggerer evaluates deferred tasks/sensors in separate processes, steering through the Execution API rather than direct database access.
Core Principles
- Code is a Liability: Auto-generated code without clear guardrails leads to maintainability issues. Ensure the why and the schema constraints are thoroughly defined.
- Context is King: Always prioritize explicit constraints over general assumptions, matching the target environment perfectly.
Best Practices
- Use Golden Records: Reference established, production-ready Dags (golden records) to enforce organizational naming conventions and architectural patterns.
- Embrace TaskFlow API: Leverage
@taskand@dagdecorators for cleaner data passing over legacy XCom patterns, unless constrained otherwise.
What to Avoid
- Vibe Coding Large Blocks: Generating hundreds of lines of Dag logic in a single shot without verifying the structural skeleton first.
- Over-commenting: Creating comments that simply narrate Python syntax.
- Assuming Idempotency: Never assume a task will automatically be idempotent; explicitly define boundaries like
logical_dateand insert strategies.
Common Pitfalls
- Context Contamination: Defaulting to deprecated Airflow paradigms (e.g.,
schedule_intervalinstead ofscheduleortimetable). Prevention: Always define the target Airflow version (e.g., Airflow 3.1) in the context block. - Hallucinated Schemas: Generating column names or relationships that do not exist. Prevention: Use contract-driven definitions with explicit schemas.
- Missing Provider Packages: Referencing operators that the environment lacks. Prevention: Verify that the imported operators align with the available or defined providers.
References
Examples from https://airflow.apache.org/docs/task-sdk/stable/examples.html:
- example_asset_alias.py
- example_assets.py
- example_dag_decorator.py
- example_dynamic_task_mapping.py
- example_setup_teardown_taskflow.py
- example_task_group_decorator.py
- example_xcomargs.py
Examples from: https://github.com/astronomer/webinar-demos/tree/local-data-engineering/dags:
- customer_stats.py
- daily_report.py
- route_performance.py
- tutorial_taskflow_api.py
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

