Workflow and best practices for writing Apache Airflow DAGs. Use when the user wants to create a new DAG, write pipeline code, or asks about DAG patterns and conventions. For testing and debugging DAGs, see the testing-dags skill.
View on GitHubSelect agents to install to:
npx add-skill https://github.com/astronomer/agents/blob/main/skills/authoring-dags/SKILL.md -a claude-code --skill authoring-dagsInstallation paths:
.claude/skills/authoring-dags/# DAG Authoring Skill This skill guides you through creating and validating Airflow DAGs using best practices and MCP tools. > **For testing and debugging DAGs**, see the **testing-dags** skill which covers the full test → debug → fix → retest workflow. --- ## ⚠️ CRITICAL WARNING: Use MCP Tools, NOT CLI Commands ⚠️ > **STOP! Before running ANY Airflow-related command, read this.** > > You MUST use MCP tools for ALL Airflow interactions. CLI commands like `astro dev run`, `airflow dags`, or shell commands to read logs are **FORBIDDEN**. > > **Why?** MCP tools provide structured, reliable output. CLI commands are fragile, produce unstructured text, and often fail silently. --- ## CLI vs MCP Quick Reference **ALWAYS use Airflow MCP tools. NEVER use CLI commands.** | ❌ DO NOT USE | ✅ USE INSTEAD | |---------------|----------------| | `astro dev run dags list` | `list_dags` MCP tool | | `airflow dags list` | `list_dags` MCP tool | | `astro dev run dags test` | `trigger_dag_and_wait` MCP tool | | `airflow tasks test` | `trigger_dag_and_wait` MCP tool | | `cat` / `grep` on Airflow logs | `get_task_logs` MCP tool | | `find` in dags folder | `list_dags` or `explore_dag` MCP tool | | Any `astro dev run ...` | Equivalent MCP tool | | Any `airflow ...` CLI | Equivalent MCP tool | | `ls` on `/usr/local/airflow/dags/` | `list_dags` or `explore_dag` MCP tool | | `cat ... \| jq` to filter MCP results | Read the JSON directly from MCP response | **Remember:** - ✅ Airflow is ALREADY running — the MCP server handles the connection - ❌ Do NOT attempt to start, stop, or manage the Airflow environment - ❌ Do NOT use shell commands to check DAG status, logs, or errors - ❌ Do NOT use bash to parse or filter MCP tool results — read the JSON directly - ❌ Do NOT use `ls`, `find`, or `cat` on Airflow container paths (`/usr/local/airflow/...`) - ✅ ALWAYS use MCP tools — they return structured JSON you can read directly ## Workflow Overview ``` ┌─────────────────────────────────────┐