본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)22k · #10342

managed-airflow-dag-authoring

하는 일

이 스킬은 Managed Service for Apache Airflow(이전 이름 Cloud Composer)에서 실행되는 Airflow 워크플로를 작성하고 테스트하도록 돕습니다. Airflow로 작업을 예약하는 데이터 팀과 엔지니어링 팀을 위한 스킬입니다.

사용하는 경우

  • ✓Google Cloud의 Managed Airflow용 Airflow DAG를 만들거나 확장하고 싶을 때.
  • ✓DAG 코드가 Airflow 2나 Airflow 3에서 작동하는지 확인해야 할 때.
  • ✓배포하기 전에 DAG 코드를 로컬이나 실제 환경에서 검증하고 싶을 때.

스킬 링크

https://github.com/google/skills/blob/main/skills/cloud/managed-airflow-dag-authoring/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/google/skills/blob/main/skills/cloud/managed-airflow-dag-authoring/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“매일 밤 Cloud Storage의 CSV를 BigQuery에 적재하는 Airflow DAG를 작성하고, 배포 전에 점검해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

먼저 환경과 Airflow 버전을 확인한 다음, 모범 사례에 따라 DAG를 작성합니다. 접근이 가능하면 로컬이나 대상 환경에서 코드를 검증합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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 gcloud to 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-dev CLI is installed.
  • Check if a local Python environment with airflow is available.

1.3 Inspect Target Environment (if available and requested)

Run the following commands to discover version constraints:

  1. Get Airflow/Image Version:

    gcloud composer environments describe {env_name} \
        --location {region} \
        --format="value(config.softwareConfig.imageVersion)"
    
  2. Get Installed Packages (Versions):

    gcloud composer environments describe {env_name} \
        --location {region} \
        --format="value(config.softwareConfig.pypiPackages)"
    
  3. 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=False in the DAG definition unless historical backfilling is explicitly required.
  • Use Airflow Variables/Connections: Never hardcode credentials or environment-specific configs. Use 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.

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:

  1. Copy the DAG to the local directory with DAGs:

    cp path/to/dag.py $(composer-dev describe {local_env} --format="value(dags_directory)")
    
  2. 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

자주 묻는 질문

Airflow가 아닌 Python 코드도 작동하나요?

아닙니다. Airflow DAG 작성만을 위한 것입니다.

어떤 Airflow 버전을 다루나요?

Airflow 2와 Airflow 3을 모두 다루며, 각각에 대한 호환성 점검을 포함합니다.

오프라인에서 작업하면 어떻게 하나요?

입력한 세부 정보에 의존하며, 실시간 검증은 건너뜁니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
22k
순위
#10342
라이선스
Apache-2.0
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬