ivanshamaev/de-agent-skills/airflow-dag-factory
Claude Code and agent skill by ivanshamaev/de-agent-skills
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Use when building, reviewing, debugging, or scaling Apache Airflow DAGs declaratively with dag-factory YAML configs — including project setup, loader configuration, defaults hierarchy, custom/provider operators, dynamic task mapping, datasets/assets, callbacks, TaskFlow decorators, Jinja2 templating, environment variables, YAML DRY patterns, large-scale multi-DAG generation, CI/CD linting, and migration from pre-1.0.
Install
npx vskill@latest install ivanshamaev/de-agent-skills/airflow-dag-factorySemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as ivanshamaev/de-agent-skills/airflow-dag-factory.
Airflow DAG Factory
Build Apache Airflow DAGs declaratively with dag-factory — a library that turns YAML configuration files into Airflow DAGs with no boilerplate Python.
Package:dag-factoryon PyPIRepo: https://github.com/astronomer/dag-factoryDocs: https://astronomer.github.io/dag-factory/latest/Targets: dag-factory v1.0+, Python 3.10+, Airflow 2.9+ (Airflow 3 supported)For pre-1.0 projects, read reference/migration.md before applying any guidance here.
When to Use dag-factory
| Scenario | Recommendation | |
|---|---|---|
| Low-code, repetitive DAG patterns (same operators, varying params) | dag-factory — ideal | |
| Many similar DAGs that differ only in config values | dag-factory — generate many DAGs from one YAML | |
| Complex branching, dynamic Python logic, Pydantic validation | Python DAGs or blueprint skill instead | |
| Full TaskFlow pipeline in Python | authoring-dags skill instead | |
| Existing dag-factory <1.0 project | Follow reference/migration.md first |
Quick Decision Table
| User Request | Go to | |
|---|---|---|
| "Create a YAML DAG" / "Convert Python DAG to YAML" | Defining a DAG in YAML | |
| "Set up dag-factory in my project" | Project Setup | |
| "Share defaults across DAGs / set start_date once" | Defaults | |
| "Custom operator / KPO / Slack / Snowflake" | Custom & Provider Operators | |
| "Dynamic / mapped tasks / expand / partial" | Dynamic Task Mapping | |
| "Schedule on dataset / outlets / inlets" | Datasets and Assets | |
| "Add callback / Slack on failure" | Callbacks | |
| "Use @task decorator / TaskFlow in YAML" | TaskFlow API | |
| "Use env vars in YAML" | Environment Variables | |
| "Jinja2 templates in YAML" | Jinja2 Templating | |
| "Generate 50 DAGs from one template" | Large-Scale Patterns | |
| "DRY config / reuse blocks across DAGs" | DRY with YAML Anchors | |
| "Lint / validate YAML" | Validation Commands | |
| "Migrate from Airflow 2 → 3" | Validation Commands (dagfactory convert) | |
| "Migrate from dag-factory <1.0" | reference/migration.md | |
| Errors / broken DAG | Troubleshooting |
Project Setup
1. Install
Add to requirements.txt:
dag-factory does not install Airflow providers. Install providers your YAML references explicitly:
2. Create the Loader File
Create dags/load_dags.py. Airflow discovers DAGs from this file:
globals_dict=globals() is required — generated DAG objects must be registered into the module namespace for Airflow to discover them.
3. Recommended Project Structure
Key rules:
- Keep
dags/clean — only the loader.pyand YAML/YML config files. - Put all Python callables, SQL, and helpers in
include/— the DAG processor ignores this directory by default. - Never put
defaults.ymllogic directly indags_folderroot if you pointdags_folderat that directory — dag-factory may try to parse it as a DAG config. Usedefaults_config_pathto separate it, or use adefault:block inside each YAML file.
4. Verify
Defining a DAG in YAML
Each top-level YAML key (other than default) defines one DAG. The key becomes the dag_id.
Key Fields Reference
| Field | Level | Description | |
|---|---|---|---|
default | file | Shared args applied to every DAG in this file | |
default_args | DAG or default | Standard Airflow default_args (owner, retries, start_date, …) | |
schedule | DAG | Cron string, preset (@daily), Dataset URI list, or __type__ timetable | |
catchup | DAG | Boolean; default Airflow behavior is true — set false explicitly | |
description | DAG | Human-readable description | |
tags | DAG | List of tag strings | |
max_active_runs | DAG | Max concurrent DAG runs | |
dagrun_timeout | DAG | __type__: datetime.timedelta block | |
tasks | DAG | List of task dicts; each needs task_id + operator | |
operator | task | Full Python import path to operator class | |
dependencies | task/group | List of upstream task_ids or group_names | |
task_groups | DAG | List of group dicts; each needs group_name | |
task_group_name | task | Assigns task to a task group |
Tasks do not need to be listed in dependency order — dag-factory resolves topology fromdependencies.
List vs Dict Format
Use the list format (shown above) for all new code — it is the v1.0 standard and required for task groups.
The legacy dict format (where tasks is a dict keyed by task_id) still works for backward compatibility but is not recommended.
Defaults
Four layers of defaults, in precedence order (highest wins):
| Priority | Source | How | |
|---|---|---|---|
| 1 (highest) | Individual DAG block | default_args: or DAG-level keys inside the DAG | |
| 2 | default: block in the same YAML file | Top-level default: key | |
| 3 | defaults_config_dict= | Passed as Python dict to load_yaml_dags | |
| 4 (lowest) | defaults.yml file | Auto-detected walking up the dir tree, or explicit defaults_config_path= |
default: Block (same file)
Best for templates with multiple DAGs in one file:
defaults.yml File (hierarchical, team-wide)
Place defaults.yml files in the directory tree. dag-factory merges them walking from the DAG file up to the root, with files closer to the DAG winning:
A DAG inside dags/ingestion/ inherits both files, with ingestion/defaults.yml values winning.
Important: set defaults_config_path in the loader to the highest ancestor folder you want merged:
Custom & Provider Operators
Reference any operator by its full Python import path. All other task keys become __init__ kwargs.
For Airflow 3, prefer airflow.providers.standard.operators.* over the legacy airflow.operators.* — use dagfactory convert to auto-rewrite:
KubernetesPodOperator
Use __type__ for nested k8s objects (legacy auto-casting was removed in v1.0):
Dynamic Task Mapping
Use expand and partial keys. Two reference syntaxes — do not mix them:
| Syntax | Use case | |
|---|---|---|
task_id.output | Inside expand.op_args / expand.op_kwargs (XCom-style) | |
+task_id | As a bare expand value; for TaskFlow decorator tasks |
PythonOperator — XCom-style expand
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/airflow_dag_factory/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ivanshamaev/de-agent-skills/airflow-dag-factory)