managed-airflow-dag-authoring
Was er macht
Dieser Skill hilft dir, Airflow Workflows zu schreiben und zu testen, die auf Managed Service for Apache Airflow laufen, früher Cloud Composer. Er ist für Daten und Engineering Teams gedacht, die Jobs mit Airflow planen.
Wann du ihn nutzt
- ✓Wenn du einen Airflow DAG für Managed Airflow auf Google Cloud anlegen oder erweitern möchtest.
- ✓Wenn du prüfen willst, ob DAG Code mit Airflow 2 oder Airflow 3 funktioniert.
- ✓Wenn du DAG Code lokal oder gegen eine laufende Umgebung testen willst, bevor du ihn live schaltest.
Link zum Skill
https://github.com/google/skills/blob/main/skills/cloud/managed-airflow-dag-authoring/SKILL.mdKopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.
So nutzt du ihn
Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.
Fertige Nachricht zum Einfügen
Für Claude Code, Codex oder Cursor: Führe den Befehl in deinem Projektordner aus, dann wird der Skill installiert.
Lade die SKILL.md herunter und lege sie in den Skills-Ordner deines Agenten.
Beispielanfrage an deine KI
“Schreibe einen Airflow DAG, der jede Nacht eine CSV Datei aus Cloud Storage in BigQuery lädt, und prüfe ihn, bevor ich ihn live schalte.”
5 neue Skills pro Woche. 1 Minute Lesezeit.
So funktioniert es
Zuerst prüft er die Umgebung und die Airflow Version, dann schreibt er den DAG nach bewährten Methoden. Wenn du Zugriff hast, prüft er den Code lokal oder in der Zielumgebung.
Technischer Inhalt (originale SKILL.md)
Originaltext des Autors, auf Englisch, direkt von GitHub.
GCP Managed Airflow DAG Authoring Guide
This skill guides you through authoring and validating Apache Airflow DAGs for Managed Service for Apache Airflow (MSAA; formerly Cloud Composer) environments.
Attribution
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.
Phase 1: Context Discovery
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.
1.1 Identify Target Environment & Access
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).
- If environment access is available: Use
gcloudto inspect the environment (see Section 1.3). - If offline: Rely on user provided details.
1.2 Identify Development Environment
Determine if a local development environment is available.
- Check if
composer-devCLI is installed. - Check if a local Python environment with
airflowis available.
1.3 Inspect Target Environment (if available and requested)
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)"
Phase 2: DAG Authoring Best Practices
2.1 General Airflow Best Practices
- Idempotency: Every task SHOULD be idempotent. Running it multiple times with the same inputs (e.g., execution date) SHOULD produce the same result and not duplicate data.
- No Top-Level Code Execution: Do NOT execute database queries, external API calls, or heavy computations at the top level of the DAG file (outside of tasks/operators). This code runs every few seconds during DAG parsing and will degrade performance.
- Explicit Catchup: Always set
catchup=Falsein the DAG definition unless historical backfilling is explicitly required. - Use Airflow Variables/Connections: Never hardcode credentials or
environment-specific configs. Use
Variable.get()(withdeserialize_json=Trueif applicable) andBaseHook.get_connection(). Access variables via Jinja templates (e.g.,{{ var.value.my_var }}) to avoid database calls during DAG parsing.
2.2 Airflow 2 vs Airflow 3 Compatibility
Use managed-airflow-migrations skill to navigate adjusting the code to specific target Airflow version.
Phase 3: Validation Process
You MUST validate DAGs before concluding your task.
3.1 Local Validation (Offline/Pre-deployment)
3.1.1 Static Analysis & Linting
Use ruff or pylint if available.
ruff check path/to/dag.py
- If targeting Airflow 3, check with Airflow 3 rules if rulesets are available.
3.1.2 Local Dev Environment (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
3.2: Target Environment Validation
Only perform these steps if you have GCP access and are authorized to deploy to a target environment.
3.2.1 Deploy to GCS
Upload the DAG to t
Häufige Fragen
Funktioniert er auch für Python Code, der nicht Airflow ist?
Nein. Er ist nur für das Schreiben von Airflow DAGs gedacht.
Welche Airflow Versionen deckt er ab?
Airflow 2 und Airflow 3, mit Kompatibilitätsprüfungen für beide.
Was ist, wenn ich offline arbeite?
Er stützt sich auf deine Angaben und überspringt die Live Prüfung.
Details
Originalbeschreibung des Autors
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.
repo: google/skills
Beliebtheit
- GitHub-Sterne
- 22k
- Platz im Ranking
- #10342
- Lizenz
- Apache-2.0
- Aktualisiert
- 2.11.2026
Kommentare
- …
Weitere Skills aus diesem Repository
finding-google-skills
22kHilft deinem Agenten, die richtigen Google-Anleitungen für eine Einrichtungsaufgabe zu finden, etwa für Hosting, Datenbanken, Speicher, Anmeldung oder das Bereitstellen von KI-Modellen.
gcloud
22kHilft deinem Agenten, gcloud-Befehle für Google Cloud zu schreiben und zu prüfen, und schlägt die genaue Syntax nach, bevor etwas ausgeführt wird, damit keine Flags geraten werden.
google-cloud-recipe-auth
22kFührt deinen Agenten durch Identität und Zugriff in Google Cloud, einschließlich Anmeldung von Personen und Diensten und der Berechtigungen, die sie erhalten.
google-cloud-recipe-onboarding
22kFührt einen neuen Entwickler durch die ersten Schritte in Google Cloud, darunter Projektauswahl, Verknüpfung der Abrechnung und die Bereitstellung einer ersten Ressource.
Ähnliche Skills
api-connector-builder
280kLässt deinen Agenten neue API-Anbindungen nach dem bestehenden Muster bauen. Nutze es, wenn du eine weitere Integration ergänzen willst, ohne neue Wege einzuführen.
api-design
280kHilft deinem Agenten, REST-APIs nach Best Practices zu entwerfen. Nützlich für die Kommunikation, die Fehlerausgabe und die Organisation von Daten.
backend-patterns
280kHilft deinem Agenten bei Architekturmustern für die Serverseite und bei der Datenbankoptimierung. Nützlich zum Bauen und Prüfen von Server-Code.