Agent skill

Migrating Airflow 2 To 3

by astronomer in astronomer/agents

Guide for migrating Apache Airflow 2.x projects to Airflow 3.x.

Apache-2.0Auto-check passedData & Analytics

Install Migrating Airflow 2 To 3

skills CLI
$ npx skills add astronomer/agents --skill migrating-airflow-2-to-3 -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install astronomer/agents migrating-airflow-2-to-3 --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/astronomer/agents.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/migrating-airflow-2-to-3 .claude/skills/migrating-airflow-2-to-3 && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
migrating-airflow-2-to-3
GitHub stars
451
Token cost
~2.3k tokens
SKILL.md length
723 words
Files
5
Skills in repo
34
Repo updated
First seen
Licence
Apache-2.0

At a glance

Guide for migrating Apache Airflow 2.x projects to Airflow 3.x.

  • Works in 5 steps: Run Ruff's Airflow migration rules to… → Scan for remaining issues using the… → Plan changes per file and issue type → …
  • The user mentions Airflow 3 migration
  • SKILL.md covers Migration at a Glance, Architecture & Metadata DB…, Ruff Airflow Migration Rules and Reference Files, plus 3 more sections
  • Calls ruff; needs DEPLOYMENT_API_TOKEN

What it does

Migrating Airflow 2 To 3 is an agent skill from astronomer/agents. Guide for migrating Apache Airflow 2.x projects to Airflow 3.x. Use when the user mentions Airflow 3 migration, upgrade, compatibility issues, breaking changes, or wants to modernize their Airflow codebase. If you detect Airflow 2.x code that needs migration, prompt the user and ask if they want you to help upgrade. Always load this skill as the first step for any migration-related request.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files (for example `reference/config-changes.md`, `reference/migration-checklist.md` and `reference/migration-patterns.md`).

It sits in Data & Analytics, covering Data pipelines and ETL. It works with Apache Airflow and Ruff. The repository describes itself as: AI agent tooling for data engineering workflows. The licence is Apache-2.0.

When your agent uses it

  • The user mentions Airflow 3 migration
  • Compatibility issues
  • Breaking changes
  • Wants to modernize their Airflow codebase

Example prompts

  • “/migrating-airflow-2-to-3”

Requirements

  • Python 3
  • A credential in DEPLOYMENT_API_TOKEN

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Run Ruff's Airflow migration rules to auto-fix detectable issues (AIR30/AIR301/AIR302/AIR31/AIR311/AIR312).
  2. Scan for remaining issues using the manual search checklist in reference/migration-checklist.md.
  3. Plan changes per file and issue type
  4. Implement changes incrementally, re-running Ruff and code searches after each major change.
  5. Explain changes to the user and caution them to test any updated logic such as refactored metadata, scheduling logic and use of the…

What it can do on your machine

Read from SKILL.md and the folder at commit 486ee63. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • ruff

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • astronomer.io
    • airflow.apache.org
    • docs.astral.sh

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • DEPLOYMENT_API_TOKEN

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Migrating Airflow 2 To 3 loads about 2.3k tokens when it runs. Until then it costs about 105 tokens; SKILL.md has 723 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~105
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from astronomer/agents at commit 486ee63, republished under its Apache-2.0 licence (© astronomer). 723 words, ~2,282 tokens.

Download SKILL.mdSave it as .claude/skills/migrating-airflow-2-to-3/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
migrating-airflow-2-to-3
description
Guide for migrating Apache Airflow 2.x projects to Airflow 3.x. Use when the user mentions Airflow 3 migration, upgrade, compatibility issues, breaking changes, or wants to modernize their Airflow codebase. If you detect Airflow 2.x code that needs migration, prompt the user and ask if they want you to help upgrade. Always load this skill as the first step for any migration-related request.

Airflow 2 to 3 Migration

This skill helps migrate Airflow 2.x DAG code to Airflow 3.x, focusing on code changes (imports, operators, hooks, context, API usage).

Important: Before migrating to Airflow 3, strongly recommend upgrading to Airflow 2.11 first, then to at least Airflow 3.0.11 (ideally directly to 3.1). Other upgrade paths would make rollbacks impossible. See: https://www.astronomer.io/docs/astro/airflow3/upgrade-af3#upgrade-your-airflow-2-deployment-to-airflow-3. Additionally, early 3.0 versions have many bugs - 3.1 provides a much better experience.

Migration at a Glance

  1. Run Ruff's Airflow migration rules to auto-fix detectable issues (AIR30/AIR301/AIR302/AIR31/AIR311/AIR312).
    • ruff check --preview --select AIR --fix --unsafe-fixes .
  2. Scan for remaining issues using the manual search checklist in reference/migration-checklist.md.
    • Focus on: direct metadata DB access, legacy imports, scheduling/context keys, XCom pickling, datasets-to-assets, REST API/auth, plugins, and file paths.
    • Hard behavior/config gotchas to explicitly review:
      • Cron scheduling semantics: consider AIRFLOW__SCHEDULER__CREATE_CRON_DATA_INTERVAL=True if you need Airflow 2-style cron data intervals.
      • .airflowignore syntax changed from regexp to glob; set AIRFLOW__CORE__DAG_IGNORE_FILE_SYNTAX=regexp if you must keep regexp behavior.
      • OAuth callback URLs add an /auth/ prefix (e.g. /auth/oauth-authorized/google).
      • Shared utility imports: Bare imports like import common from dags/common/ no longer work on Astro. Use fully qualified imports: import dags.common.
  3. Plan changes per file and issue type:
    • Fix imports - update operators/hooks/providers - refactor metadata access to using the Airflow client instead of direct access - fix use of outdated context variables - fix scheduling logic.
  4. Implement changes incrementally, re-running Ruff and code searches after each major change.
  5. Explain changes to the user and caution them to test any updated logic such as refactored metadata, scheduling logic and use of the Airflow context.

Architecture & Metadata DB Access

Airflow 3 changes how components talk to the metadata database:

  • Workers no longer connect directly to the metadata DB.
  • Task code runs via the Task Execution API exposed by the API server.
  • The DAG processor runs as an independent process separate from the scheduler.
  • The Triggerer uses the task execution mechanism via an in-process API server.

Trigger implementation gotcha: If a trigger calls hooks synchronously inside the asyncio event loop, it may fail or block. Prefer calling hooks via sync_to_async(...) (or otherwise ensure hook calls are async-safe).

Key code impact: Task code can still import ORM sessions/models, but any attempt to use them to talk to the metadata DB will fail with:

text
RuntimeError: Direct database access via the ORM is not allowed in Airflow 3.x
Patterns to search for

When scanning DAGs, custom operators, and @task functions, look for:

  • Session helpers: provide_session, create_session, @provide_session
  • Sessions from settings: from airflow.settings import Session
  • Engine access: from airflow.settings import engine
  • ORM usage with models: session.query(DagModel)..., session.query(DagRun)...
Replacement: Airflow Python client

Preferred for rich metadata access patterns. Add to requirements.txt:

text
apache-airflow-client==<your-airflow-runtime-version>

Example usage:

python
import os
from airflow.sdk import BaseOperator
import airflow_client.client
from airflow_client.client.api.dag_api import DAGApi

_HOST = os.getenv("AIRFLOW__API__BASE_URL", "https://<your-org>.astronomer.run/<deployment>/")
_TOKEN = os.getenv("DEPLOYMENT_API_TOKEN")

class ListDagsOperator(BaseOperator):
    def execute(self, context):
        config = airflow_client.client.Configuration(host=_HOST, access_token=_TOKEN)
        with airflow_client.client.ApiClient(config) as api_client:
            dag_api = DAGApi(api_client)
            dags = dag_api.get_dags(limit=10)
            self.log.info("Found %d DAGs", len(dags.dags))
Show full SKILL.md (294 more words)Show less
Replacement: Direct REST API calls

For simple cases, call the REST API directly using requests:

python
from airflow.sdk import task
import os
import requests

_HOST = os.getenv("AIRFLOW__API__BASE_URL", "https://<your-org>.astronomer.run/<deployment>/")
_TOKEN = os.getenv("DEPLOYMENT_API_TOKEN")

@task
def list_dags_via_api() -> None:
    response = requests.get(
        f"{_HOST}/api/v2/dags",
        headers={"Accept": "application/json", "Authorization": f"Bearer {_TOKEN}"},
        params={"limit": 10}
    )
    response.raise_for_status()
    print(response.json())

Ruff Airflow Migration Rules

Use Ruff's Airflow rules to detect and fix many breaking changes automatically.

  • AIR30 / AIR301 / AIR302: Removed code and imports in Airflow 3 - must be fixed.
  • AIR31 / AIR311 / AIR312: Deprecated code and imports - still work but will be removed in future versions; should be fixed.

Commands to run (via uv) against the project root:

bash
# Auto-fix all detectable Airflow issues (safe + unsafe)
ruff check --preview --select AIR --fix --unsafe-fixes .

# Check remaining Airflow issues without fixing
ruff check --preview --select AIR .

Reference Files

For detailed code examples and migration patterns, see:


Quick Reference Tables

Key Import Changes
Airflow 2.xAirflow 3
airflow.operators.dummy_operator.DummyOperatorairflow.providers.standard.operators.empty.EmptyOperator
airflow.operators.bash.BashOperatorairflow.providers.standard.operators.bash.BashOperator
airflow.operators.python.PythonOperatorairflow.providers.standard.operators.python.PythonOperator
airflow.decorators.dagairflow.sdk.dag
airflow.decorators.taskairflow.sdk.task
airflow.datasets.Datasetairflow.sdk.Asset
Context Key Changes
Removed KeyReplacement
execution_datecontext["dag_run"].logical_date
tomorrow_ds / yesterday_dsUse ds with date math: macros.ds_add(ds, 1) / macros.ds_add(ds, -1)
prev_ds / next_dsprev_start_date_success or timetable API
triggering_dataset_eventstriggering_asset_events
templates_dictcontext["params"]

Asset-triggered runs: logical_date may be None; use context["dag_run"].logical_date defensively.

Cannot trigger with future logical_date: Use logical_date=None and rely on run_id instead.

Cron note: for scheduled runs using cron, logical_date semantics differ under CronTriggerTimetable (aligning logical_date with run_after). If you need Airflow 2-style cron data intervals, consider AIRFLOW__SCHEDULER__CREATE_CRON_DATA_INTERVAL=True.

Default Behavior Changes
SettingAirflow 2 DefaultAirflow 3 Default
scheduletimedelta(days=1)None
catchupTrueFalse
Callback Behavior Changes
  • on_success_callback no longer runs on skip; use on_skipped_callback if needed.
  • @teardown with TriggerRule.ALWAYS not allowed; teardowns now execute even if DAG run terminated early.

Resources


  • testing-dags: For testing DAGs after migration
  • debugging-dags: For troubleshooting migration issues
  • deploying-airflow: For deploying migrated DAGs to production

© astronomer, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files in skills/migrating-airflow-2-to-3 of astronomer/agents.

  • SKILL.md
  • reference/config-changes.md
  • reference/migration-checklist.md
  • reference/migration-patterns.md
  • reference/removed-methods.md

Open the folder on GitHubat commit 486ee63

Compare with similar skills

Migrating Airflow 2 To 3 next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Migrating Airflow 2 To 3 compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Migrating Airflow 2 To 3 this skillastronomer/agents451—~2.3kAutomated safety check: PassApache-2.0
Upgrading Mwaa Environmentsaws/agent-toolkit-for-aws2.8k—~7.3kAutomated safety check: PassApache-2.0
Chart Testsastronomer/airflow-chart297—~2.8kAutomated safety check: PassCustom licence
Functional Testsastronomer/airflow-chart297—~2.2kAutomated safety check: PassCustom licence
Create Examplegodatadriven/whirl205—~1.1kAutomated safety check: PassApache-2.0
Senior Data Engineerbenchflow-ai/skillsbench1.8k—~5.9kAutomated safety check: PassMIT

Similar skills

  • Upgrading Mwaa Environments

    aws/agent-toolkit-for-aws

    Official

    Upgrades an MWAA environment to a newer Airflow version — within 2.x, within 3.x, or across the 2.x-to-3.x boundary.

    2.8k GitHub stars~7.3k tokensUpdated yesterday
    Data & AnalyticsAuto-check passed
  • Chart Tests

    astronomer/airflow-chart

    A skill your agent uses when writing, editing, reviewing, or running Helm chart tests for the Astronomer airflow-chart repository.

    297 GitHub stars~2.8k tokensUpdated 3 days ago
    Data & AnalyticsAuto-check passed
  • Functional Tests

    astronomer/airflow-chart

    A skill your agent uses when writing, editing, reviewing, or running functional (end-to-end) tests for the Astronomer airflow-chart repository.

    297 GitHub stars~2.2k tokensUpdated 3 days ago
    Data & AnalyticsAuto-check passed
  • Create Example

    godatadriven/whirl

    Create a new Whirl example project in the examples/ directory.

    205 GitHub stars~1.1k tokensUpdated 10 days ago
    Data & AnalyticsAuto-check passed
  • Senior Data Engineer

    benchflow-ai/skillsbench

    World-class data engineering skill for building scalable data pipelines, ETL/ELT systems, real-time streaming, and data infrastructure.

    1.8k GitHub stars~5.9k tokensUpdated 2 mo ago
    Data & AnalyticsAuto-check passed
  • Airflow DAG Patterns

    wshobson/agents

    Patterns for writing production-ready Apache Airflow DAGs: task dependencies, custom operators and sensors, local testing, and rules for what to avoid.

    40k GitHub starsUsed in 9 repos~784 tokens
    Data & AnalyticsAuto-check passed

More from astronomer/agents

All 34 skills in this repo
  • Analyzing Data

    astronomer/agents

    Queries the data warehouse with SQL and answers business questions about data.

    451 GitHub stars~1.3k tokensUpdated 4 days ago
    Auto-check passed
  • Airflow

    astronomer/agents

    Queries, manages, and troubleshoots Apache Airflow using the af CLI.

    451 GitHub starsUsed in 1 repo~3.8k tokens
    Auto-check passed
  • Guide for migrating Dagster projects to Apache Airflow 3 on Astro.

    451 GitHub stars~3.8k tokensUpdated 4 days ago
    Auto-check passed
  • Authoring Dags

    astronomer/agents

    Workflow and best practices for writing Apache Airflow DAGs.

    451 GitHub starsUsed in 1 repo~1.8k tokens
    Auto-check passed
  • Deploying Airflow

    astronomer/agents

    Deploys Airflow DAGs and projects. An agent skill from astronomer/agents.

    451 GitHub starsUsed in 1 repo~2.8k tokens
    Auto-check passed
  • Airflow Hitl

    astronomer/agents

    Builds human-in-the-loop (HITL) Airflow workflows - approval gates, form input, and human-driven branching.

    451 GitHub stars~1.8k tokensUpdated 4 days ago
    Auto-check passed

Questions about Migrating Airflow 2 To 3

What does Migrating Airflow 2 To 3 do?

Guide for migrating Apache Airflow 2.x projects to Airflow 3.x. Migrating Airflow 2 To 3 is an agent skill from astronomer/agents.x.

When should I use Migrating Airflow 2 To 3?

Migrating Airflow 2 To 3 fits situations like: the user mentions Airflow 3 migration; compatibility issues; breaking changes; wants to modernize their Airflow codebase.

How do I install Migrating Airflow 2 To 3 in Claude Code?

Run `npx skills add astronomer/agents --skill migrating-airflow-2-to-3 -a claude-code`. Or copy the skill folder (skills/migrating-airflow-2-to-3 in astronomer/agents) into .claude/skills/migrating-airflow-2-to-3 in your project. Claude Code loads it when a task matches its description.

How do I install Migrating Airflow 2 To 3 in Codex?

Run `npx skills add astronomer/agents --skill migrating-airflow-2-to-3 -a codex`. Or copy the skill folder (skills/migrating-airflow-2-to-3 in astronomer/agents) into .agents/skills/migrating-airflow-2-to-3 in your project. Codex loads it when a task matches its description.

Can I use Migrating Airflow 2 To 3 in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add astronomer/agents --skill migrating-airflow-2-to-3 -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/migrating-airflow-2-to-3, .gemini/skills/migrating-airflow-2-to-3, .github/skills/migrating-airflow-2-to-3 and .opencode/skills/migrating-airflow-2-to-3 in your project.

What does Migrating Airflow 2 To 3 need to run?

Going by SKILL.md and its folder, Migrating Airflow 2 To 3 needs the command-line tools its instructions call (ruff) and credentials named DEPLOYMENT_API_TOKEN. Our summary lists: Python 3; A credential in DEPLOYMENT_API_TOKEN.

Does Migrating Airflow 2 To 3 access the network?

SKILL.md names 3 domains. As links in the text: astronomer.io, airflow.apache.org and docs.astral.sh. This is read from the text; nothing was executed.

Is Migrating Airflow 2 To 3 safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Migrating Airflow 2 To 3 use?

Migrating Airflow 2 To 3 is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Migrating Airflow 2 To 3 use?

About 2.3k tokens (SKILL.md is roughly 9.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Migrating Airflow 2 To 3?

Skills that share tags, products or a category with Migrating Airflow 2 To 3: Upgrading Mwaa Environments (aws/agent-toolkit-for-aws, 2.8k stars), Chart Tests (astronomer/airflow-chart, 297 stars), Functional Tests (astronomer/airflow-chart, 297 stars) and Create Example (godatadriven/whirl, 205 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Migrating Airflow 2 To 3?

astronomer (a GitHub organization) maintains it in astronomer/agents, which has 451 GitHub stars. The repository holds 34 skills in this directory. The repository was last updated on October 7, 2026.

Source: astronomer/agents on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.