Provides guidance for authoring Apache Airflow DAGs in Managed Service for Apache Airflow (MSAA; formerly Cloud Composer). Covers environment context discovery, Airflow 2 vs 3 compatibility, authoring best practices, and local/remote validation processes. Use when creating or extending an Airflow DAG. Don't use when authoring Python code unrelated to Airflow DAGs.
Written by Google and published in google/skills under the Apache-2.0 license. Treq shows it unchanged except for heading levels and links to files on GitHub.
This skill guides you through authoring and validating Apache Airflow DAGs for Managed Service for Apache Airflow (MSAA; formerly Cloud Composer) environments.
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read Usage Attribution. For commands executed
directly in the terminal (never in generated scripts, Terraform, or user code),
prefix gcloud with
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:managed-airflow-dag-authoring)"
and append agent-skills/1.0 (skill:managed-airflow-dag-authoring) to User-Agent headers.
Before writing any DAG code, you MUST understand the constraints (e.g. version of Airflow) and capabilities of your target environment if user is willing to provide them.
Determine if you have direct access to the target Managed Airflow environment, local development environment or if you are working offline (only changing local files without validation).
gcloud to inspect the
environment (see Section 1.3).Determine if a local development environment is available.
composer-dev CLI is installed.airflow is available.Run the following commands to discover version constraints:
Get Airflow/Image Version:
gcloud composer environments describe {env_name} \
--location {region} \
--format="value(config.softwareConfig.imageVersion)"
Get Installed Packages (Versions):
gcloud composer environments describe {env_name} \
--location {region} \
--format="value(config.softwareConfig.pypiPackages)"
Get DAGs GCS Bucket:
gcloud composer environments describe {env_name} \
--location {region} \
--format="value(config.dagGcsPrefix)"
catchup=False in the DAG definition
unless historical backfilling is explicitly required.Variable.get() (with
deserialize_json=True if applicable) and BaseHook.get_connection().
Access variables via Jinja templates (e.g., {{ var.value.my_var }}) to
avoid database calls during DAG parsing.Use managed-airflow-migrations skill to navigate adjusting the code to specific target Airflow version.
You MUST validate DAGs before concluding your task.
Use ruff or pylint if available.
ruff check path/to/dag.py
composer-dev)If the user has composer-dev configured:
Copy the DAG to the local directory with DAGs:
cp path/to/dag.py $(composer-dev describe {local_env} --format="value(dags_directory)")
Verify parsing:
composer-dev run-airflow-cmd {local_env} dags list-import-errors
Only perform these steps if you have GCP access and are authorized to deploy to a target environment.
Upload the DAG to the target environment's GCS bucket:
gcloud storage cp path/to/dag.py gs://{target_bucket}/dags/
Wait 1-2 minutes for the scheduler to parse the file, then run:
Check for Import Errors:
gcloud composer environments run {env_name} \
--location {region} \
dags list-import-errors
Pass Criteria: Output should be "No data found" or empty.
Verify DAG is Listed:
gcloud composer environments run {env_name} \
--location {region} \
dags list | grep {dag_id}
Check for runtime parsing errors in Cloud Logging:
resource.type="cloud_composer_environment"
resource.labels.environment_name="{env_name}"
log_id("airflow-scheduler")
severity>=ERROR
textPayload:"{dag_file_name}"
Claude Code and Codex keep each installed skill's name and description in context. When a request matches the description, the agent loads the full SKILL.md. You can also run it yourself: type /managed-airflow-dag-authoring in Claude Code or $managed-airflow-dag-authoring in Codex.
The description says when to use it:
Use when creating or extending an Airflow DAG.
Copy the managed-airflow-dag-authoring folder into .claude/skills/ in your project. To use it in every project, copy it into ~/.claude/skills/ instead.
git clone --depth 1 https://github.com/google/skills.git /tmp/google-skills
mkdir -p .claude/skills
cp -r /tmp/google-skills/skills/cloud/managed-airflow-dag-authoring .claude/skills/
Codex reads skills from .agents/skills/ in your repository, and from ~/.agents/skills/ for every repository. It detects new skills on its own. Restart Codex if managed-airflow-dag-authoring does not appear.
git clone --depth 1 https://github.com/google/skills.git /tmp/google-skills
mkdir -p .agents/skills
cp -r /tmp/google-skills/skills/cloud/managed-airflow-dag-authoring .agents/skills/
Open Settings and select the Skills tab. The tab appears when Skills installation is on under Settings → Feature Preview. Search for managed-airflow-dag-authoring and choose Install….
Install for repository writes the skill under .treq/skills/ in the current repository. Install for application makes it available to every repository on this machine. Each new workspace gets a copy in .claude/skills/ and .agents/skills/, so Claude Code and Codex both find it. See Installing Skills from the Library.
managed-airflow-dag-authoring ships 2 files, 8.0 KB in total. Select a file to load it from GitHub.