airflow-dag-patterns
Build production Airflow DAGs with proven patterns
Airflow DAGs can fail when structure and retries are not consistent. This skill provides clear patterns for design, sensors, testing, and alerts that improve pipeline reliability.
Download the skill ZIP
Upload in Claude
Go to Settings → Capabilities → Skills → Upload skill
Toggle on and start using
Test it
Using "airflow-dag-patterns". Give me a safe pattern for a daily ETL DAG with retries, testing, and a failure callback.
Expected outcome:
- Use default_args with retries, retry_delay, and exponential backoff
- Define a linear start -> extract -> load -> end structure
- Add a task failure callback to report errors
- Create DagBag tests for load errors, task count, and dependencies
Using "airflow-dag-patterns". How do I create DAGs dynamically from configuration?
Expected outcome:
- Define a PIPELINE_CONFIGS list with name, schedule, and source fields
- Create a create_dag factory function that takes a config parameter
- Use globals()[f"dag_{name}"] to register each DAG dynamically
- Apply the same pattern for customers, orders, and products pipelines
Using "airflow-dag-patterns". Show me how to wait for external dependencies before running tasks.
Expected outcome:
- Use S3KeySensor to wait for files in S3 buckets
- Use ExternalTaskSensor to wait for upstream DAG completion
- Set mode='reschedule' to free workers while waiting
- Combine multiple sensors with dependencies before processing
Security Audit
SafePure documentation skill containing only Airflow patterns and example code. No executable scripts, network calls, filesystem access, or environment variable reads. All code in SKILL.md is illustrative documentation for building data pipelines.
Risk Factors
🌐 Network access (6)
⚡ Contains scripts (1)
⚙️ External commands (20)
Quality Score
What You Can Build
Standardize ETL DAGs
Create consistent DAG structures, retries, and schedules for daily and hourly pipelines.
Add operational safeguards
Apply sensors, alerts, and failure callbacks to improve pipeline reliability.
Test DAG integrity
Write unit tests to ensure DAGs load, have no cycles, and respect dependencies.
Try These Prompts
Create a daily Airflow DAG with start, extract, and end tasks using PythonOperator and basic default_args.
Draft a TaskFlow API DAG with extract, transform, and load tasks that pass data between them safely.
Show a pattern for waiting on S3 data and an upstream DAG before processing.
Add failure callbacks, retries, and cleanup tasks that run on failure for a critical DAG.
Best Practices
- Keep tasks idempotent and avoid heavy logic in DAG files
- Use TaskFlow API and sensor reschedule mode for efficiency
- Add unit tests for DAG loading, structure, and cycles
Avoid
- Using depends_on_past for most tasks
- Hardcoding dates instead of Airflow macros
- Storing mutable global state in DAG files
Frequently Asked Questions
Is this compatible with Airflow 2.x?
What are the limits of the examples?
Can it integrate with my existing DAGs?
Does it access or store my data?
What if my DAG fails to import?
How does it compare to generic coding help?
Developer Details
Author
wshobsonLicense
MIT
Repository
https://github.com/wshobson/agents/tree/main/plugins/data-engineering/skills/airflow-dag-patternsRef
main
File structure
📄 SKILL.md