Builds and operates Airflow DAGs: local setup, DAG testing, task runs, and backfills.
Agentic Workflow: Read -> Reason -> Act (airflow)
You are Airflow (data/general) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — data context for airflow
- Domain: Builds and operates Airflow DAGs: local setup, DAG testing, task runs, and backfills.
- airflow-operations: Manage Airflow metadata, users, DAGs, and task runs from the CLI —
airflow db init
- Check
knowledge and prerequisites: airflow
2. Reason — think for airflow
- For
airflow-operations: Manage Airflow metadata, users, DAGs, and task runs from the CLI — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with airflow tools
- Tools:
Glob, Grep, Read, Airflow (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
airflow:f4b7c491
Airflow
Workflow orchestration: DAG authoring, scheduling, backfills, and troubleshooting
via the Airflow CLI.
When to Use
- Scheduling ETL and ML pipelines
- Re-running failed or historical ranges (backfill)
- Testing individual tasks without running a full DAG
Real Commands
# Install (recommended via pipx/venv)
pip install apache-airflow
# First-time database setup
airflow db init
airflow db upgrade
# Create an admin user
airflow users create --username admin --role Admin --email admin@example.com --firstname Admin --lastname User
# Start services (two terminals)
airflow scheduler
airflow webserver --port 8080
# DAG management
airflow dags list
airflow dags list-import-errors
airflow dags show my_dag
# Trigger a run
airflow dags trigger my_dag --conf '{"env": "staging"}'
# Test one task with a fixed execution date
airflow tasks test my_dag extract 2024-01-01
# Backfill a range
airflow dags backfill -s 2024-01-01 -e 2024-01-10 my_dag --reset-dagruns
Minimal DAG (dags/example.py)
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.bash import BashOperator
with DAG("example", start_date=datetime(2024, 1, 1), schedule="@daily", catchup=False) as dag:
extract = BashOperator(task_id="extract", bash_command="python /app/extract.py")
load = BashOperator(task_id="load", bash_command="python /app/load.py")
extract >> load
Best Practices
- Keep DAGs idempotent and deterministic
- Test with
airflow tasks test before scheduling
- Set proper
start_date and use catchup deliberately
- Put secrets in Airflow Variables/Connections, not code
- Monitor with
airflow dags list-runs -d my_dag
Example Response
For a failed DAG run: identifies the failing task from logs, suggests the fix,
then re-runs the single task or backfills the range.
Capabilities
airflow-operations
Manage Airflow metadata, users, DAGs, and task runs from the CLI
Parameters:
conf (string): JSON config passed to the triggered run
log-level (string): Logging level for the command, e.g. DEBUG
subdir (string): Directory to search for DAG files
Commands:
airflow db init
airflow users create --username admin --firstname A --lastname A --role Admin --email admin@localhost
airflow dags list
airflow dags trigger my_dag --conf '{"env": "prod"}'
airflow tasks test my_dag extract_task 2024-01-01
Examples:
- airflow dags list-import-errors
- airflow dags backfill -s 2024-01-01 -e 2024-01-10 my_dag
- airflow scheduler --num-runs 1
References
1---2name: "airflow"3description: "Builds and operates Airflow DAGs: local setup, DAG testing, task runs, and backfills. Use when working with airflow operations, data or when the user mentions airflow operations, data."4license: "MIT"5compatibility: "Requires airflow."6metadata:7 source: https://skillmd.com/skills/opknock/airflow8 author: Kdesk9 version: 2.0.010 category: data11allowed-tools: "Glob Grep Read Bash(airflow:*)"12---1314Builds and operates Airflow DAGs: local setup, DAG testing, task runs, and backfills.1516## Agentic Workflow: Read -> Reason -> Act (airflow)1718You are **Airflow** (data/general) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — data context for `airflow`21- Domain: Builds and operates Airflow DAGs: local setup, DAG testing, task runs, and backfills.22- **airflow-operations**: Manage Airflow metadata, users, DAGs, and task runs from the CLI — `airflow db init`23- Check `knowledge` and `prerequisites: airflow`2425### 2. Reason — think for `airflow`26- For `airflow-operations`: Manage Airflow metadata, users, DAGs, and task runs from the CLI — decide which checks to run27- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs2829### 3. Act — execute with `airflow` tools30- Tools: `Glob`, `Grep`, `Read`, `Airflow` (see frontmatter `tools`/`allowed-tools`)31- Use `safe_path` for any write; record evidence (paths, checksums)32- Fingerprint: `airflow:f4b7c491`3334# Airflow3536Workflow orchestration: DAG authoring, scheduling, backfills, and troubleshooting37via the Airflow CLI.3839## When to Use4041- Scheduling ETL and ML pipelines42- Re-running failed or historical ranges (backfill)43- Testing individual tasks without running a full DAG4445## Real Commands4647```bash48# Install (recommended via pipx/venv)49pip install apache-airflow5051# First-time database setup52airflow db init53airflow db upgrade5455# Create an admin user56airflow users create --username admin --role Admin --email admin@example.com --firstname Admin --lastname User5758# Start services (two terminals)59airflow scheduler60airflow webserver --port 80806162# DAG management63airflow dags list64airflow dags list-import-errors65airflow dags show my_dag6667# Trigger a run68airflow dags trigger my_dag --conf '{"env": "staging"}'6970# Test one task with a fixed execution date71airflow tasks test my_dag extract 2024-01-017273# Backfill a range74airflow dags backfill -s 2024-01-01 -e 2024-01-10 my_dag --reset-dagruns75```7677## Minimal DAG (dags/example.py)7879```python80from datetime import datetime, timedelta81from airflow import DAG82from airflow.operators.bash import BashOperator8384with DAG("example", start_date=datetime(2024, 1, 1), schedule="@daily", catchup=False) as dag:85 extract = BashOperator(task_id="extract", bash_command="python /app/extract.py")86 load = BashOperator(task_id="load", bash_command="python /app/load.py")87 extract >> load88```8990## Best Practices9192- Keep DAGs idempotent and deterministic93- Test with `airflow tasks test` before scheduling94- Set proper `start_date` and use catchup deliberately95- Put secrets in Airflow Variables/Connections, not code96- Monitor with `airflow dags list-runs -d my_dag`9798## Example Response99100For a failed DAG run: identifies the failing task from logs, suggests the fix,101then re-runs the single task or backfills the range.102103## Capabilities104105### airflow-operations106Manage Airflow metadata, users, DAGs, and task runs from the CLI107108**Parameters:**109- `conf` (string): JSON config passed to the triggered run110- `log-level` (string): Logging level for the command, e.g. DEBUG111- `subdir` (string): Directory to search for DAG files112113**Commands:**114- `airflow db init`115- `airflow users create --username admin --firstname A --lastname A --role Admin --email admin@localhost`116- `airflow dags list`117- `airflow dags trigger my_dag --conf '{"env": "prod"}'`118- `airflow tasks test my_dag extract_task 2024-01-01`119120**Examples:**121- airflow dags list-import-errors122- airflow dags backfill -s 2024-01-01 -e 2024-01-10 my_dag123- airflow scheduler --num-runs 1124125## References126- [Airflow docs](https://airflow.apache.org/docs/)127- [Airflow best practices](https://airflow.apache.org/docs/apache-airflow/stable/best-practices.html)