authoring-dags by astronomer/agents
npx skills add https://github.com/astronomer/agents --skill authoring-dags本技能将指导您使用最佳实践和 af CLI 命令来创建和验证 Airflow DAG。
关于测试和调试 DAG,请参阅 testing-dags 技能,该技能涵盖了完整的测试 -> 调试 -> 修复 -> 重新测试工作流程。
使用 uvx 运行所有 af 命令(无需安装):
uvx --from astro-airflow-mcp af <command>
在本文档中,af 是 uvx --from astro-airflow-mcp af 的简写。
+-----------------------------------------+
| 1. 探索 |
| 理解代码库和环境 |
+-----------------------------------------+
|
+-----------------------------------------+
| 2. 规划 |
| 提出结构,获取批准 |
+-----------------------------------------+
|
+-----------------------------------------+
| 3. 实现 |
| 遵循模式编写 DAG |
+-----------------------------------------+
|
+-----------------------------------------+
| 4. 验证 |
| 检查导入错误、警告 |
+-----------------------------------------+
|
+-----------------------------------------+
| 5. 测试(需用户同意) |
| 触发、监控、检查日志 |
+-----------------------------------------+
|
+-----------------------------------------+
| 6. 迭代 |
| 修复问题,重新验证 |
+-----------------------------------------+
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
在编写代码之前,先了解上下文。
使用文件工具查找现有模式:
Glob 查找 **/dags/**/*.py 以找到现有 DAGRead 类似的 DAG 以了解约定requirements.txt 以了解可用的包使用 af CLI 命令来了解可用的内容:
| 命令 | 用途 |
|---|---|
af config connections | 已配置了哪些外部系统 |
af config variables | 存在哪些配置值 |
af config providers | 安装了哪些操作符包 |
af config version | 版本限制和功能 |
af dags list | 现有 DAG 和命名约定 |
af config pools | 用于并发性的资源池 |
探索问题示例:
af config connectionsaf config versionaf config providers基于探索结果,提出:
在实施之前获取用户批准。
遵循最佳实践编写 DAG(见下文)。关键步骤:
requirements.txt使用 af CLI 作为反馈循环来验证您的 DAG。
保存后,检查解析错误(Airflow 应该已经解析了该文件):
af dags errors
常见原因:缺少导入、语法错误、缺少包。
af dags get <dag_id>
检查:DAG 是否存在、调度计划是否正确、标签是否设置、暂停状态。
af dags warnings
查找弃用警告或配置问题。
af dags explore <dag_id>
一次调用返回:元数据、任务、依赖关系、源代码。
如果您在 Astro 上运行,也可以在部署前在本地进行验证:
astro dev parse 以捕获导入错误和 DAG 级别的问题,而无需启动完整的 Airflow 环境astro deploy --dags 进行快速的仅 DAG 部署,跳过 Docker 镜像构建——非常适合迭代 DAG 代码有关全面的测试指导,请参阅 testing-dags 技能。
验证通过后,使用 testing-dags 技能中的工作流程测试 DAG:
af runs trigger-wait <dag_id> --timeout 300af runs diagnose <dag_id> <run_id> 和 af tasks logs <dag_id> <run_id> <task_id># 先询问用户,然后:
af runs trigger-wait <dag_id> --timeout 300
关于完整的测试 -> 调试 -> 修复 -> 重新测试循环,请参阅 testing-dags。
如果发现问题:
af dags errors| 阶段 | 命令 | 用途 |
|---|---|---|
| 探索 | af config connections | 可用的连接 |
| 探索 | af config variables | 配置值 |
| 探索 | af config providers | 已安装的操作符 |
| 探索 | af config version | 版本信息 |
| 验证 | af dags errors | 解析错误(首先检查!) |
| 验证 | af dags get <dag_id> | 验证 DAG 配置 |
| 验证 | af dags warnings | 配置警告 |
| 验证 | af dags explore <dag_id> | 完整的 DAG 检查 |
测试命令 -- 有关
af runs trigger-wait、af runs diagnose、af tasks logs等命令,请参阅 testing-dags 技能。
关于代码模式和反模式,请参阅 reference/best-practices.md。
在编写新 DAG 或审查现有 DAG 时阅读此参考。 它涵盖了哪些模式是正确的(包括 Airflow 3 特定的行为)以及应避免什么。
每周安装次数
417
代码仓库
GitHub 星标数
276
首次出现时间
2026 年 1 月 23 日
安全审计
安装于
opencode300
codex294
cursor292
github-copilot288
gemini-cli274
claude-code260
This skill guides you through creating and validating Airflow DAGs using best practices and af CLI commands.
For testing and debugging DAGs , see the testing-dags skill which covers the full test -> debug -> fix -> retest workflow.
Run all af commands using uvx (no installation required):
uvx --from astro-airflow-mcp af <command>
Throughout this document, af is shorthand for uvx --from astro-airflow-mcp af.
+-----------------------------------------+
| 1. DISCOVER |
| Understand codebase & environment |
+-----------------------------------------+
|
+-----------------------------------------+
| 2. PLAN |
| Propose structure, get approval |
+-----------------------------------------+
|
+-----------------------------------------+
| 3. IMPLEMENT |
| Write DAG following patterns |
+-----------------------------------------+
|
+-----------------------------------------+
| 4. VALIDATE |
| Check import errors, warnings |
+-----------------------------------------+
|
+-----------------------------------------+
| 5. TEST (with user consent) |
| Trigger, monitor, check logs |
+-----------------------------------------+
|
+-----------------------------------------+
| 6. ITERATE |
| Fix issues, re-validate |
+-----------------------------------------+
Before writing code, understand the context.
Use file tools to find existing patterns:
Glob for **/dags/**/*.py to find existing DAGsRead similar DAGs to understand conventionsrequirements.txt for available packagesUse af CLI commands to understand what's available:
| Command | Purpose |
|---|---|
af config connections | What external systems are configured |
af config variables | What configuration values exist |
af config providers | What operator packages are installed |
af config version | Version constraints and features |
af dags list | Existing DAGs and naming conventions |
af config pools |
Example discovery questions:
af config connectionsaf config versionaf config providersBased on discovery, propose:
Get user approval before implementing.
Write the DAG following best practices (see below). Key steps:
requirements.txt if neededUseaf CLI as a feedback loop to validate your DAG.
After saving, check for parse errors (Airflow will have already parsed the file):
af dags errors
Common causes: missing imports, syntax errors, missing packages.
af dags get <dag_id>
Check: DAG exists, schedule correct, tags set, paused status.
af dags warnings
Look for deprecation warnings or configuration issues.
af dags explore <dag_id>
Returns in one call: metadata, tasks, dependencies, source code.
If you're running on Astro, you can also validate locally before deploying:
astro dev parse to catch import errors and DAG-level issues without starting a full Airflow environmentastro deploy --dags for fast DAG-only deploys that skip the Docker image build — ideal for iterating on DAG codeSee the testing-dags skill for comprehensive testing guidance.
Once validation passes, test the DAG using the workflow in the testing-dags skill:
af runs trigger-wait <dag_id> --timeout 300af runs diagnose <dag_id> <run_id> and af tasks logs <dag_id> <run_id> <task_id># Ask user first, then:
af runs trigger-wait <dag_id> --timeout 300
For the full test -> debug -> fix -> retest loop, see testing-dags.
If issues found:
af dags errors| Phase | Command | Purpose |
|---|---|---|
| Discover | af config connections | Available connections |
| Discover | af config variables | Configuration values |
| Discover | af config providers | Installed operators |
| Discover | af config version | Version info |
| Validate | af dags errors |
Testing commands -- See the testing-dags skill for
af runs trigger-wait,af runs diagnose,af tasks logs, etc.
For code patterns and anti-patterns, see reference/best-practices.md.
Read this reference when writing new DAGs or reviewing existing ones. It covers what patterns are correct (including Airflow 3-specific behavior) and what to avoid.
Weekly Installs
417
Repository
GitHub Stars
276
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode300
codex294
cursor292
github-copilot288
gemini-cli274
claude-code260
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
100,500 周安装
OpenAPI 转 TypeScript 工具 - 自动生成 API 接口与类型守卫
563 周安装
Rust Unsafe代码检查器 - 安全使用Unsafe Rust的完整指南与最佳实践
566 周安装
数据库模式设计器 - 内置最佳实践,自动生成生产级SQL/NoSQL数据库架构
565 周安装
Nx 生成器使用指南:自动化代码生成与单体仓库项目搭建
594 周安装
.NET并发编程模式指南:async/await、Channels、Akka.NET选择决策树
725 周安装
韩语语法检查器 - 基于国立国语院标准的拼写、空格、语法、标点错误检测与纠正
586 周安装
| Resource pools for concurrency |
| Parse errors (check first!) |
| Validate | af dags get <dag_id> | Verify DAG config |
| Validate | af dags warnings | Configuration warnings |
| Validate | af dags explore <dag_id> | Full DAG inspection |