airflow-dag-patterns

Create production Apache Airflow DAGs with operators, sensors, testing, and deployment patterns.

Updated Apr 23, 2026
One-click install
npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill airflow-dag-patterns-sanketadlak
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: airflow-dag-patterns
Source: https://github.com/SanketAdlak/PDMProjectDesign/tree/main/.agents/skills/airflow-dag-patterns
Command: npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill airflow-dag-patterns-sanketadlak

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires apache-airflow, pandas, pytest, requests.

What problem does it solve? Building reliable data pipelines in Apache Airflow requires knowing the right patterns for DAG design, task dependencies, error handling, and testing. This Skill provides production-ready templates and best practices so you avoid common pitfalls like non-idempotent tasks, missing retries, and untested DAGs. ## Core Features & Use Cases - DAG Design Patterns: TaskFlow API, dynamic DAG generation from config, branching logic, and sensor-based external dependencies. - Error Handling & Alerts: Failure callbacks, trigger rules, retry strategies with exponential backoff, and cleanup tasks that run regardless of upstream failures. - Testing Framework: Pytest-based DAG integrity tests covering import errors, structure validation, dependency checks, and cycle detection. - Use Case: You need to orchestrate a daily ETL pipeline that waits for files on S3, branches based on data quality scores, and alerts your team on failures. Use this Skill to generate the complete DAG with sensors, BranchPythonOperator, and failure callbacks. ## Quick Start Create an Airflow DAG for a daily ETL pipeline that extracts data from S3, transforms it, loads it to a data warehouse, and sends a Slack alert on failure.

Frequently Asked Questions about airflow-dag-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create an Airflow DAG with the TaskFlow API?

Use the @dag and @task decorators to define pipelines as Python functions. Tasks pass data through return values via automatic XCom, and dependencies are declared by chaining function calls like extract() >> transform() >> load().

How to generate multiple Airflow DAGs dynamically from config?

Define a list of pipeline configurations and a factory function that builds a DAG per config, then register each DAG in globals() with a unique name. Airflow discovers all generated DAGs during its parsing loop.

What is the difference between Airflow sensors poke and reschedule mode?

Poke mode holds a worker slot while checking conditions repeatedly, while reschedule mode frees the worker between checks. Use mode='reschedule' for long-running waits like S3KeySensor or ExternalTaskSensor to avoid blocking workers.

How do I test Airflow DAGs with pytest?

Load DAGs with DagBag and assert there are no import errors, then validate task counts, schedule intervals, and upstream/downstream dependencies. Call dag.test_cycle() to confirm no circular dependencies exist.

Why does my Airflow task keep failing without alerts?

Tasks fail silently when no on_failure_callback is configured in default_args or the DAG. Add a failure callback that captures the task instance, exception, and log URL, then sends notifications to Slack or PagerDuty.

When should I avoid depends_on_past in Airflow?

Avoid depends_on_past=True for most pipelines because it creates bottlenecks where one failed run blocks all subsequent runs. Reserve it for cases where tasks genuinely require the previous run's output, such as cumulative state builds.