Home › Apache Airflow › Apache Airflow DAGs AGENTS.md

Apache Airflow DAGs AGENTS.md

AGENTS.md for Apache Airflow projects: TaskFlow DAGs, fast parse-time code, idempotent tasks, explicit schedules and catchup, connections, small XComs, and DAG tests.

AGENTS.mdApache Airflow

How to use

Save this as AGENTS.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

Note: Review and test before use. Provided as is, without warranty. See Terms.

AGENTS.mdDownload  
# AGENTS.md: Apache Airflow

## Commands
- Run one DAG locally without the scheduler: `airflow dags test <dag_id> <logical_date>`; one task: `airflow tasks test <dag_id> <task_id> <logical_date>`.
- Tests: `pytest tests/` including a DAG import test (every file in `dags/` loads with no import errors and no cycles).
- Check the Airflow version in requirements/Dockerfile before writing imports: Airflow 3 uses `airflow.sdk` (`from airflow.sdk import dag, task`); Airflow 2 uses `airflow.decorators`. Follow what the repo already uses.

## DAG files
- DAG files are parsed constantly: no database queries, API calls, heavy imports or `Variable.get()` at module top level. Do that work inside tasks or with Jinja templates.
- Define DAGs with the TaskFlow API (`@dag`, `@task`) and explicit `dag_id`, `schedule`, `start_date` (static, timezone-aware), `catchup` (set it explicitly), `max_active_runs`, `tags` and `default_args` with `retries` and `retry_delay`.
- One DAG per file named after the `dag_id`. Shared code goes in a package under `include/` or `plugins/`, not copied between DAGs.

## Tasks
- Tasks are idempotent and deterministic for a given logical date or data interval: write to partitions keyed by the interval, use upserts or overwrite-partition, never "append everything since now".
- Use the data interval (`data_interval_start`/`data_interval_end`) for time windows, never `datetime.now()`.
- XCom carries small metadata (paths, IDs, counts), never datasets or dataframes. Large data goes to object storage or the warehouse.
- Push heavy compute to the system built for it (warehouse SQL, Spark, containers via `KubernetesPodOperator`); workers orchestrate.
- Use provider operators and hooks with connection IDs; credentials live in Airflow Connections or a secrets backend, never in code or Variables in plain text.
- Set `execution_timeout` on tasks that call external systems; use sensors in deferrable/reschedule mode instead of blocking a worker slot.
- Use assets/datasets for cross-DAG dependencies rather than sensors polling other DAGs, when the version supports it.

## Done when
DAG import test passes, `airflow dags test` runs the changed DAG for one interval, and reruns of the same interval produce the same result.

More: all Apache Airflow rules · all AGENTS.md rules

Related rules

CrewAI multi-agent AGENTS.md

AGENTS.md for CrewAI 1.x projects: YAML agents and tasks, crews and flows, tools, and cost-aware runs.

AGENTS.mdLLM apps & agents

dbt analytics engineering AGENTS.md

AGENTS.md for dbt projects (dbt Core / Fusion 1.9+): staging/marts layering, tests, docs, and selective runs.

AGENTS.mddbt

Google Agent Development Kit (ADK) AGENTS.md

AGENTS.md for Python agents built with Google ADK: agent and tool definitions, sub-agents, session state, adk web/run, and evaluation sets.

AGENTS.mdLLM apps & agents

LLM fine-tuning (TRL + PEFT) AGENTS.md

AGENTS.md for fine-tuning LLMs with Hugging Face TRL and PEFT (LoRA/QLoRA): data format, configs, evals, and safety.

AGENTS.mdHugging Face

LLM app (Python) AGENTS.md

AGENTS.md for Python apps that call LLM APIs (OpenAI, Anthropic, Gemini): prompts, structured output, evals, and cost.

AGENTS.mdLLM apps & agents

MCP server (TypeScript) AGENTS.md

AGENTS.md for building Model Context Protocol servers in TypeScript with clear tools, zod schemas and safe defaults.

AGENTS.mdMCP servers

Get the best new AI prompts every week

One short email a week: the best new prompts and rules for ChatGPT, Claude, Gemini, Midjourney, Cursor and more, plus what changed in the tools. Free, unsubscribe anytime.

Finishes on our newsletter page at beehiiv (opens in a new tab). Or subscribe directly.