auto-dev
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAutodev Pipeline Generator
Autodev 流水线生成器
Overview
概述
This skill generates a complete Autodev automated development pipeline from a structured todolist.md file. The output is a self-contained directory that runs to drive Claude Code through a gated, TDD-enforced, card-by-card development workflow — fully automated, no human in the loop.
autodev.shTrigger phrases: "帮我生成 xxx 的 autodev 文件", "create autodev for", "generate autodev pipeline"
本技能可从结构化的todolist.md文件生成完整的Autodev自动化开发流水线。输出为一个独立目录,运行即可驱动Claude Code完成受关卡管控、TDD强制执行的逐卡片开发工作流——全程自动化,无需人工介入。
autodev.sh触发短语:"帮我生成xxx的autodev文件"、"create autodev for"、"generate autodev pipeline"
What is Autodev?
什么是Autodev?
Autodev is a spec-anchored, gate-guarded, TDD-enforced automated development methodology. It:
- Splits a task list into sequential Task Cards (one AI session per card)
- Enforces TDD 5-step closure per card (RED → GREEN → SPEC → LINT → GATE)
- Runs automated gate checks between phases
- Auto-repairs test failures (up to 10 retries per card)
- Tracks progress in a state file for resumable execution
- Independent acceptance verification per card (separate AI verifies ACs)
- AI mutual review for high-risk decisions (SPEC-DECISION / AI-REVIEW / AI-GATE 三级)
- Decision audit trail () for cross-card traceability
decisions.jsonl - Pipeline completion summary — auto-generates structured report: what was implemented, files changed, decisions made, test results
- Bug Hunt phase — multi-round bug scanning + fixing after development: independent auditor finds P0/P1/P2 bugs, developer AI fixes with regression tests, loops until clean (up to 15 rounds)
Autodev是一种基于规范、受关卡管控、TDD强制执行的自动化开发方法论。它具备以下特性:
- 将任务列表拆分为顺序的任务卡片(每张卡片对应一次AI会话)
- 为每张卡片强制执行TDD五步闭环(RED → GREEN → SPEC → LINT → GATE)
- 在阶段之间运行自动化关卡校验
- 对测试失败进行自动修复(每张卡片最多重试10次)
- 在状态文件中跟踪进度,支持恢复执行
- 为每张卡片进行独立验收验证(由独立AI验证验收标准)
- 针对高风险决策进行AI互相评审(三级:SPEC-DECISION / AI-REVIEW / AI-GATE)
- 提供决策审计追踪(),支持跨卡片追溯
decisions.jsonl - 流水线完成总结——自动生成结构化报告:已实现内容、修改的文件、做出的决策、测试结果
- Bug Hunt阶段——开发完成后进行多轮漏洞扫描+修复:独立审计AI查找P0/P1/P2漏洞,开发AI通过回归测试修复,循环直至无问题(最多15轮)
Checklist
检查清单
You MUST complete these steps in order:
- Read the todolist — understand groups, tasks, phases, dependencies, test commands
- Gather project context — identify spec doc, source files, test paths, key constraints
- Design the pipeline — map todolist groups → phases → cards, define gate checks
- Generate all files — autodev.sh, system_prompt.md, gate_check.sh, cards/*.md, phase_gate.md, state, decisions.jsonl
- Verify — dry-run the script, confirm all card files exist, paths resolve correctly
你必须按顺序完成以下步骤:
- 阅读任务列表——理解分组、任务、阶段、依赖关系、测试命令
- 收集项目上下文——确定规范文档、源文件、测试路径、关键约束
- 设计流水线——将任务列表分组映射为阶段→卡片,定义关卡校验规则
- 生成所有文件——autodev.sh、system_prompt.md、gate_check.sh、cards/*.md、phase_gate.md、state、decisions.jsonl
- 验证——试运行脚本,确认所有卡片文件存在、路径解析正确
Step 1: Read the Todolist
步骤1:阅读任务列表
Read the todolist.md file completely. Extract:
| Item | What to look for |
|---|---|
| Groups | Top-level sections (Group 1, Group 2...) — these become Phases |
| Tasks | Individual numbered items within groups — these become Cards (or get merged into Cards) |
| Dependencies | Which tasks depend on others — determines Card ordering |
| Execution phases | If the todolist defines phases (Phase A, B, C...) — use them directly |
| Test commands | How to run tests — becomes the test verification step |
| Key constraints | Backward compatibility, safety rules, P1 fixes — become system_prompt constraints |
| Source files | Which files are being modified — becomes Card "read existing code" sections |
| Spec/design docs | Referenced design documents — becomes the "single source of truth" |
完整阅读todolist.md文件,提取以下信息:
| 项 | 需查找的内容 |
|---|---|
| 分组 | 顶级章节(分组1、分组2……)——这些将成为阶段 |
| 任务 | 分组内的单个编号项——这些将成为卡片(或合并为卡片) |
| 依赖关系 | 哪些任务依赖其他任务——决定卡片顺序 |
| 执行阶段 | 如果任务列表定义了阶段(阶段A、B、C……)——直接使用这些阶段 |
| 测试命令 | 如何运行测试——成为测试验证步骤 |
| 关键约束 | 向后兼容性、安全规则、P1级修复——成为system_prompt中的约束 |
| 源文件 | 哪些文件将被修改——成为卡片的“读取现有代码”部分 |
| 规范/设计文档 | 引用的设计文档——成为“唯一可信源” |
Step 2: Gather Project Context
步骤2:收集项目上下文
Resolve context autonomously (no human confirmation in runtime):
1. What is the spec/design document path?
→ This is the "single source of truth" referenced by all cards
2. What is the test command?
→ e.g., "python3 -m pytest tests/test_foo.py -q" or "npm test"
3. Are there any interactive/manual tests that must be excluded?
→ CRITICAL: Scan the test directories for tests that require interactive input
(stdin prompts, private keys, manual confirmation, GUI interaction, network
services that won't be available in CI). These MUST be excluded from the test
command via --ignore or path filtering.
→ Common patterns to look for:
- input(), getpass(), prompt(), readline() calls in test files
- Tests under directories named: live/, manual/, interactive/, e2e/, integration/
- Tests that connect to external wallets, require API keys at runtime, or need
running services
→ Add --ignore flags for each such directory/file. The generated test command must
be fully non-interactive and able to run unattended.
4. What are the core source files being modified?
→ Listed in system_prompt as "project files"
5. What are the project-specific constraints?
→ e.g., "backward compatible", "no breaking changes", "量纲一致性"
6. Where should the Autodev directory live?
→ Convention: Autodev/{project_name}/
7. If anything is unclear, how should ambiguity be resolved?
→ Infer from repo evidence (todolist, spec, tests, git history, existing patterns),
choose the most conservative backward-compatible option, and record assumptions in
system_prompt.md ("Assumptions & Defaults"). Do NOT block for user confirmation.自主解析上下文(运行时无需用户确认):
1. 规范/设计文档的路径是什么?
→ 这是所有卡片引用的“唯一可信源”
2. 测试命令是什么?
→ 例如:"python3 -m pytest tests/test_foo.py -q" 或 "npm test"
3. 是否有必须排除的交互式/手动测试?
→ 关键:扫描测试目录,查找需要交互式输入的测试
(stdin提示、私钥、手动确认、GUI交互、CI环境中不可用的网络服务)。必须通过--ignore或路径过滤将这些测试从测试命令中排除。
→ 需要注意的常见模式:
- 测试文件中包含input()、getpass()、prompt()、readline()调用
- 位于live/、manual/、interactive/、e2e/、integration/目录下的测试
- 连接外部钱包、运行时需要API密钥或依赖运行中服务的测试
→ 为每个此类目录/文件添加--ignore标志。生成的测试命令必须完全是非交互式的,可无人值守运行。
4. 核心源文件有哪些?
→ 在system_prompt中列为“项目文件”
5. 项目特定约束有哪些?
→ 例如:“向后兼容”、“无破坏性变更”、“量纲一致性”
6. Autodev目录应放在哪里?
→ 惯例:Autodev/{project_name}/
7. 如果有内容不明确,如何解决歧义?
→ 从仓库证据(任务列表、规范、测试、git历史、现有模式)中推断,选择最保守的向后兼容选项,并在system_prompt.md的“假设与默认值”部分记录假设。不要因等待用户确认而停滞。Step 3: Design the Pipeline
步骤3:设计流水线
Mapping Groups to Phases
将分组映射为阶段
Each Group in the todolist becomes a Phase. Each Phase ends with a GATE.
Group 1 → Phase A → GATE:A
Group 2 → Phase B → GATE:B
...
Last Group → Phase N → GATE:FINAL任务列表中的每个分组对应一个阶段。每个阶段结束时会有一个关卡。
分组1 → 阶段A → 关卡:A
分组2 → 阶段B → 关卡:B
...
最后一个分组 → 阶段N → 关卡:FINALMapping Tasks to Cards
将任务映射为卡片
Merge small related tasks into single Cards. Keep complex tasks as their own Card. Target: 2-5 tasks per Card, 3-7 Cards per Phase.
Heuristics for merging:
- Same source file → merge
- Sequential dependency with no external dependency → merge
- Total estimated complexity < 1 Claude session → merge
Heuristics for splitting:
- Different source files → separate
- Independent testable unit → separate
- High complexity (e.g., "MC simulation core") → own Card
将小型相关任务合并为单个卡片。将复杂任务单独保留为卡片。目标:每张卡片包含2-5个任务,每个阶段包含3-7张卡片。
合并启发式规则:
- 同一源文件 → 合并
- 无外部依赖的顺序任务 → 合并
- 总预估复杂度 < 1次Claude会话 → 合并
拆分启发式规则:
- 不同源文件 → 拆分
- 可独立测试的单元 → 拆分
- 高复杂度任务(如“蒙特卡洛模拟核心”)→ 单独作为卡片
Card ID scheme
卡片ID方案
Use format:
{Phase}.{Sequence}- Alphanumeric phases: A.1, A.2, B.1, C.1
- Numeric phases: 0.1, 0.2, 1.1, 2.1
使用格式:
{Phase}.{Sequence}- 字母数字阶段:A.1、A.2、B.1、C.1
- 数字阶段:0.1、0.2、1.1、2.1
Adding verification Cards
添加验证卡片
Add a verification Card at the end of each Phase (before the GATE) that:
- Runs all tests for that phase
- Checks test coverage against the todolist
- Runs full regression
在每个阶段末尾(关卡之前)添加一张验证卡片,该卡片将:
- 运行该阶段的所有测试
- 检查测试覆盖率是否符合任务列表要求
- 运行完整回归测试
Gate checks
关卡校验
Design gate_check.sh with:
- Universal checks (always include):
- Unit tests pass
- Full regression tests pass
- SPEC-DECISION audit (grep for AI decisions)
- Project-specific checks (customize):
- Backward compatibility verification
- Contract/interface checks
- Config consistency
- Import validation
设计gate_check.sh,包含:
- 通用校验(始终包含):
- 单元测试通过
- 完整回归测试通过
- SPEC-DECISION审计(搜索AI决策)
- 项目特定校验(自定义):
- 向后兼容性验证
- 契约/接口校验
- 配置一致性
- 导入验证
Step 4: Generate All Files
步骤4:生成所有文件
Directory Structure
目录结构
Autodev/{project_name}/
├── autodev.sh # Main pipeline script
├── system_prompt.md # AI session prompt
├── gate_check.sh # Automated gate checks
├── state # Progress tracker (empty file)
├── decisions.jsonl # Decision audit trail (empty file, runtime populated)
├── logs/ # Runtime logs (empty dir)
├── bug_reports/ # Bug Hunt reports per round (runtime populated)
└── cards/
├── {A.1}.md # Task cards
├── {A.2}.md
├── ...
└── phase_gate.md # Phase gate audit templatesummary.mdAutodev/{project_name}/
├── autodev.sh # 主流水线脚本
├── system_prompt.md # AI会话提示词
├── gate_check.sh # 自动化关卡校验脚本
├── state # 进度跟踪文件(空文件)
├── decisions.jsonl # 决策审计追踪(空文件,运行时填充)
├── logs/ # 运行时日志(空目录)
├── bug_reports/ # 每轮Bug Hunt的报告(运行时填充)
└── cards/
├── {A.1}.md # 任务卡片
├── {A.2}.md
├── ...
└── phase_gate.md # 阶段关卡审计模板summary.mdFile Templates
文件模板
Generate each file using the corresponding template reference. Read the template, customize all values for the project, and write the complete file.
{PLACEHOLDER}| File | Template Reference | Description |
|---|---|---|
| references/autodev-template.md | Main pipeline script with card execution, testing, AC verification, Bug Hunt |
| references/system-prompt-template.md | AI session prompt with TDD flow, decision protocol, safety rules |
| references/card-template.md | Task card with context, tasks, acceptance criteria |
| references/gate-check-template.md | Automated gate checks (tests, audit, coverage) |
| references/phase-gate-template.md | Phase gate audit template for AI auditor |
IMPORTANT: Do NOT use templates literally. Generate FULL files with all values replaced for the specific project. The autodev.sh template shows the structure -- the actual output must be a complete, runnable bash script with all functions expanded.
{PLACEHOLDER}使用对应的模板参考生成每个文件。阅读模板,为项目自定义所有值,并写入完整文件。
{PLACEHOLDER}| 文件 | 模板参考 | 描述 |
|---|---|---|
| references/autodev-template.md | 主流水线脚本,包含卡片执行、测试、验收标准验证、Bug Hunt |
| references/system-prompt-template.md | AI会话提示词,包含TDD流程、决策协议、安全规则 |
| references/card-template.md | 任务卡片,包含上下文、任务、验收标准 |
| references/gate-check-template.md | 自动化关卡校验(测试、审计、覆盖率) |
| references/phase-gate-template.md | 供AI审计员使用的阶段关卡审计模板 |
重要提示:不要直接使用模板原文。生成完整的文件,替换所有针对特定项目的值。autodev.sh模板展示的是结构——实际输出必须是完整的、可运行的bash脚本,所有函数都已展开。
{PLACEHOLDER}Step 5: Verify
步骤5:验证
After generating all files:
chmod +x autodev.sh gate_check.sh- Run — verify all steps listed correctly
./autodev.sh --dry-run - Run — verify display works
./autodev.sh --status - Run — verify help text
./autodev.sh --help - Verify all card files exist:
ls cards/ - Verify state file is empty:
cat state - Verify decisions.jsonl exists and is empty:
test -f decisions.jsonl && [ ! -s decisions.jsonl ] - Verify summary.md does NOT exist yet (it's auto-generated at runtime)
- Verify generated files contain no unresolved placeholders/stubs:
! rg -n '\{(PROJECT|SPEC|TODOLIST|TEST_CMD|ALL_STEPS_CONTENT|FIRST_CARD_ID|SOURCE_DIRS|AUTODEV_PATH|AUTODEV_DIR|ENV_PREFIX|ADDITIONAL_FILES|RELEVANT|EXISTING_FILES|ACCEPTANCE_CRITERION|CARD_TITLE|CARD_ID|ALLOWED_PATHS|FORBIDDEN_PATHS|TASKS_WITH)[^}]*\}' autodev.sh gate_check.sh system_prompt.md cards/*.md- Note: in system_prompt.md is a runtime placeholder (filled by AI during AI-REVIEW execution), not a generation-time placeholder — do NOT flag it.
{REVIEWER_ROLE} ! rg -n 'show_help\(\) \{ \.\.\. \}|show_status\(\) \{ \.\.\. \}' autodev.sh
生成所有文件后:
chmod +x autodev.sh gate_check.sh- 运行——验证所有步骤列出正确
./autodev.sh --dry-run - 运行——验证显示功能正常
./autodev.sh --status - 运行——验证帮助文本正确
./autodev.sh --help - 验证所有卡片文件存在:
ls cards/ - 验证状态文件为空:
cat state - 验证decisions.jsonl存在且为空:
test -f decisions.jsonl && [ ! -s decisions.jsonl ] - 验证summary.md尚未存在(它会在运行时自动生成)
- 验证生成的文件中没有未解析的占位符/存根:
! rg -n '\{(PROJECT|SPEC|TODOLIST|TEST_CMD|ALL_STEPS_CONTENT|FIRST_CARD_ID|SOURCE_DIRS|AUTODEV_PATH|AUTODEV_DIR|ENV_PREFIX|ADDITIONAL_FILES|RELEVANT|EXISTING_FILES|ACCEPTANCE_CRITERION|CARD_TITLE|CARD_ID|ALLOWED_PATHS|FORBIDDEN_PATHS|TASKS_WITH)[^}]*\}' autodev.sh gate_check.sh system_prompt.md cards/*.md- 注意:system_prompt.md中的是运行时占位符(在AI-REVIEW执行期间由AI填充),不是生成时的占位符——不要标记它。
{REVIEWER_ROLE} ! rg -n 'show_help\(\) \{ \.\.\. \}|show_status\(\) \{ \.\.\. \}' autodev.sh
Key Principles
核心原则
- Todolist is the source of truth — every Card traces back to todolist tasks
- P1/P2 fixes become constraints — embed audit corrections into Card acceptance criteria
- Test command is sacred — must match what the todolist specifies
- Test command must be non-interactive — the generated test command must run fully unattended with no stdin prompts. Scan the test directory for interactive tests (input(), getpass(), wallet prompts, manual e2e) and add --ignore flags to exclude them. A test command that hangs waiting for input will block the entire pipeline.
- Backward compatibility — if todolist mentions fallback/compatibility, enforce in gate checks
- No gold-plating — Cards only implement what the todolist describes
- Each Card is self-contained — reads its own context, doesn't assume prior Card output was read
- 任务列表是唯一可信源——每张卡片都可追溯到任务列表中的任务
- P1/P2级修复成为约束——将审计修正嵌入卡片的验收标准
- 测试命令是核心——必须与任务列表指定的一致
- 测试命令必须是非交互式的——生成的测试命令必须可完全无人值守运行,无stdin提示。扫描测试目录查找交互式测试(input()、getpass()、钱包提示、手动端到端测试),并添加--ignore标志排除它们。等待stdin输入的测试命令会阻塞整个流水线。
- 向后兼容性——如果任务列表提到回退/兼容性,在关卡校验中强制执行
- 不做额外功能——卡片仅实现任务列表描述的内容
- 每张卡片独立完整——读取自身上下文,不假设已读取之前卡片的输出
Generator Self-Check
生成器自检
After generating all files, verify these cross-cutting concerns:
- system_prompt.md contains the full 3-level decision protocol (copy from template verbatim)
- Reviewer role table is customized for the project (add/remove roles as needed; severity levels BLOCK/WARN/SUGGEST are universal — never modify)
- gate_check.sh includes decisions.jsonl audit checks
- phase_gate.md includes decision audit as step 5
- All fix prompts include: test output verbatim, spec/todolist references, "no extra changes", backward compatibility reminder
- path flows correctly: config var →
decisions.jsonlinjectsbuild_prompt()→ Card AI reads it from promptDECISIONS_FILE:
生成所有文件后,验证以下跨领域事项:
- system_prompt.md包含完整的三级决策协议(从模板中直接复制)
- 评审角色表已针对项目自定义(根据需要添加/删除角色;严重级别BLOCK/WARN/SUGGEST是通用的——绝不要修改)
- gate_check.sh包含decisions.jsonl审计校验
- phase_gate.md将决策审计作为步骤5
- 所有修复提示词包含:完整测试输出、规范/任务列表引用、“无额外变更”、向后兼容性提醒
- 路径流转正确:配置变量 →
decisions.jsonl注入build_prompt()→ 卡片AI从提示词中读取该路径DECISIONS_FILE: