spec-coding
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSpec-Coding
Spec-Coding
You are executing the Spec-Coding workflow — a structured pre-development pipeline for large-scale, complex tasks.
Complete all preparation Phases before any implementation begins.
If a specific tool mentioned here is unavailable, use the closest equivalent available in your environment.
你正在执行Spec-Coding工作流——这是面向大规模复杂任务的结构化预开发流水线。
在开始任何实现工作前,请先完成所有准备阶段的内容。
如果这里提到的特定工具不可用,请使用你环境中最接近的等效工具替代。
Behavioral Rules
行为规则
- COMPASS.md is your memory. New conversation = read COMPASS.md first, non-negotiable.
- Never skip phases. Even for small projects, produce lightweight versions of each phase's outputs.
- Confirm at phase boundaries. Every phase transition is a checkpoint.
- Stop before you spiral. Two failures or one constraint conflict → Blocked Protocol. Immediately.
- Archive is not optional. When all Tasks are done, always archive. Do not leave stale artifacts.
- is always gitignored. Verify at the start of every fresh session.
.spec/ - No code before approval. No code, scaffolding, or pseudo-code until the user approves the plan at Phase 4.
- Give opinions directly. Take a position on architectural choices. State your recommendation and the evidence that would change it.
- No placeholders in approved plans. A plan with placeholders is not approvable.
- COMPASS.md 是你的记忆载体。 新会话启动必须首先读取COMPASS.md,没有商量余地。
- 绝不跳过阶段。 即使是小型项目,也要输出每个阶段产出物的轻量版本。
- 阶段边界需确认。 每一次阶段切换都是检查点。
- 陷入循环前及时停止。 两次失败或一次约束冲突 → 立即触发阻塞协议。
- 归档不是可选项。 所有任务完成后必须进行归档,不要留下过时的产物。
- 始终要加入gitignore。 每次新会话启动时都要验证这一点。
.spec/ - 审批通过前不要写代码。 在用户在第4阶段批准计划前,不要编写任何代码、脚手架或伪代码。
- 直接给出观点。 对架构选择要明确立场,说明你的推荐方案以及会让你改变方案的依据。
- 已批准的计划中不能有占位符。 包含占位符的计划不可审批通过。
Directory Structure
目录结构
All spec-coding artifacts live under . This directory is never committed to version control.
.spec/.spec/
├── COMPASS.md # Main control file — always read this first
├── analysis/
│ ├── architecture.md
│ ├── module-map.md
│ └── risk-register.md
├── plan/
│ ├── task-breakdown.md # Includes Mermaid dependency graph
│ └── milestones.md
├── progress/
│ └── task-N-<short-name>.md # One file per Task
└── archived/
└── YYYY-MM-DD-NN/ # Completed development cyclesTemplates for all files above are in the skill directory at .
assets/templates/所有spec-coding产物都存放在目录下,该目录永远不会提交到版本控制。
.spec/.spec/
├── COMPASS.md # 主控制文件 —— 始终优先读取
├── analysis/
│ ├── architecture.md
│ ├── module-map.md
│ └── risk-register.md
├── plan/
│ ├── task-breakdown.md # 包含Mermaid依赖图
│ └── milestones.md
├── progress/
│ └── task-N-<short-name>.md # 每个任务对应一个文件
└── archived/
└── YYYY-MM-DD-NN/ # 已完成的开发周期上述所有文件的模板都存放在skill目录的路径下。
assets/templates/Continuity Check
连续性检查
Before starting any phase, check whether exists.
.spec/COMPASS.md- Exists: Read it immediately. You are resuming a session. Identify the current phase or task, what was completed, and continue from exactly where the previous conversation ended. Do NOT restart from Phase 0.
- Does not exist: Treat this as a fresh start. Verify is in
.spec/— add it if not. Then proceed to Phase 0..gitignore
After loading state from COMPASS.md, populate TaskCreate with the active phase's pending items.
开始任何阶段前,先检查是否存在。
.spec/COMPASS.md- 存在:立即读取该文件,你正在恢复之前的会话。确认当前所处的阶段或任务、已完成的内容,从上次会话结束的地方继续推进,不要从第0阶段重新开始。
- 不存在:视为全新启动的项目。验证是否已加入
.spec/,如果没有就添加进去,然后进入第0阶段。.gitignore
从COMPASS.md加载状态后,将当前阶段待处理项填充到TaskCreate中。
Phase 0: Intent Recognition & Confirmation
阶段0:意图识别与确认
Stage 0: Quick Scan
步骤0:快速扫描
This exists to help you orient and make your questions grounded.
- Read ,
README.md,CLAUDE.md, etc.AGENTS.md - Scan the top-level directory structure
- Identify technology stack signals: ,
package.json,Cargo.toml,pyproject.toml, etc.go.mod
If the directory is empty or unfamiliar, note that — it means Stage 1 questions must be more open-ended.
该步骤帮助你明确方向,让你提出的问题更贴合实际。
- 读取、
README.md、CLAUDE.md等文件AGENTS.md - 扫描顶层目录结构
- 识别技术栈信号:、
package.json、Cargo.toml、pyproject.toml等go.mod
如果目录为空或你不熟悉,请记录该情况——这意味着步骤1的问题需要更开放。
Stage 1: Natural Conversation
步骤1:自然对话
Open with a short summary of what you already understand from Stage 0 and the user's initial message — project type, tech stack, your interpretation of the request. Then ask follow-up questions in plain conversational text.
Do not use here. Keep to 1–2 questions at a time. Build shared context through dialogue, not forms.
AskUserQuestionContinue until you have a working understanding of scope, target state, and hard constraints.
首先简短总结你从步骤0和用户初始消息中了解到的内容:项目类型、技术栈、你对需求的理解。然后用平实的对话文本提出跟进问题。
此处不要使用,每次只提1-2个问题。通过对话建立共识上下文,而不是用表单的形式提问。
AskUserQuestion持续对话直到你对范围、目标状态和硬性约束有了可行的理解。
Stage 2: Targeted Confirmation
步骤2:定向确认
Once natural conversation has established sufficient context, use to nail down remaining specific unknowns. One call per unresolved question — do not batch them.
AskUserQuestionConfirm at minimum: scope, hard constraints (backward compatibility, libraries, deployment targets), and priority (performance vs. maintainability vs. speed of delivery).
自然对话建立了足够的上下文后,使用确认剩余的具体未知项。每个未解决问题单独调用一次,不要批量提问。
AskUserQuestion至少要确认:范围、硬性约束(向后兼容性、依赖库、部署目标)、优先级(性能 vs 可维护性 vs 交付速度)。
Confirmation
确认环节
Summarize your complete understanding and get explicit user confirmation before proceeding.
Phase 0 output: Create from . Fill in only:
.spec/COMPASS.mdassets/templates/- Task Definition
- Assumptions & Constraints
Leave all other sections as-is. Do not fill in what you do not yet know.
总结你对需求的完整理解,获得用户明确确认后再推进。
阶段0产出:基于模板创建,仅填写以下内容:
assets/templates/.spec/COMPASS.md- 任务定义
- 假设与约束
其他部分保持原样,不要填写你还不确定的内容。
Phase 1: Deep Project Analysis
阶段1:项目深度分析
Goal: Build a comprehensive, factual understanding of the current codebase. No opinions, no suggestions — only what exists.
目标:对当前代码库建立全面、 factual的理解。不要输出观点、不要提建议——仅记录已存在的内容。
Before You Begin
开始前准备
Create from .
architecture.mdmodule-map.mdrisk-register.mdassets/templates/analysis基于下的模板创建、、。
assets/templates/analysisarchitecture.mdmodule-map.mdrisk-register.mdDispatch Explore
Explore调度Explore
ExploreRead — Explore section — for the prompt template. Adapt it for each subagent you dispatch.
references/subagents.mdIf the project is small (roughly 20 files or fewer), a single Explore pass is sufficient.
Otherwise, split the work by architectural boundary, not by file count. One agent per logical area is more effective than one agent per directory. Examples:
- Core domain logic + data models
- Infrastructure layer (DB, external APIs, file I/O)
- Entry points, routing, public API surface
Dispatch all agents in parallel. After subagents report findings back to you, write and consolidate all findings into the three output files.
Explore.spec/analysis/*读取的Explore部分获取提示词模板,为你调度的每个子Agent适配模板。
references/subagents.md如果是小型项目(大致20个文件以内),单次Explore扫描就足够了。
否则,按照架构边界拆分工作,不要按文件数量拆分。每个逻辑领域分配一个Agent比每个目录分配一个Agent效率更高,示例:
- 核心领域逻辑 + 数据模型
- 基础设施层(数据库、外部API、文件I/O)
- 入口点、路由、公开API面
并行调度所有Agent。子Agent返回结果后,编写下的文件,将所有结果整合到三个输出文件中。
Explore.spec/analysis/*Output: .spec/analysis/
.spec/analysis/产出:.spec/analysis/
.spec/analysis/Each file must be fully filled in before Phase 2 begins. Incomplete sections must be explicitly marked as "not found" — do not leave template placeholders.
- architecture.md: tech stack, all entry points, build/run/test/lint commands, high-level architecture (2–5 paragraphs), patterns observed with file evidence, external integrations
- module-map.md: every significant module with responsibility, public API, internal deps, external deps, size, complexity rating
- risk-register.md: every risk that could affect the plan — complexity, coupling, missing tests, external constraints; hotspot summary (the 2–3 areas most likely to cause problems)
阶段2开始前必须填完所有文件的内容,不完整的部分必须明确标记为“未找到”——不要保留模板占位符。
- architecture.md:技术栈、所有入口点、构建/运行/测试/ lint命令、高层架构(2-5段文字)、观察到的模式及对应文件证据、外部集成
- module-map.md:每个重要模块的职责、公开API、内部依赖、外部依赖、规模、复杂度评级
- risk-register.md:所有可能影响计划的风险——复杂度、耦合度、缺失的测试、外部约束;热点总结(最可能出问题的2-3个领域)
Phase Boundary
阶段边界
Phase 1 is complete when all three files are filled and contain no template placeholders. Proceed to Phase 2 immediately.
当三个文件全部填写完成且没有模板占位符时,阶段1完成,立即进入阶段2。
Phase 2: Analysis Review
阶段2:分析评审
Goal: Present findings, propose architectural options, test the recommendation, reach a confirmed direction.
目标:展示分析结果、提出架构选项、验证推荐方案、达成确定的开发方向。
Step 1: Present the Analysis
步骤1:展示分析结果
Summarize for the user — do not dump the full documents. Cover:
- Project overview: what this is, tech stack, approximate scale
- Key findings: important modules, dependencies, patterns relevant to the task
- Risk highlights: top 2–3 risks and why they matter
Keep to one focused message.
为用户总结内容——不要直接抛出完整文档。涵盖以下内容:
- 项目概览:项目是什么、技术栈、大致规模
- 关键发现:和任务相关的重要模块、依赖、模式
- 风险亮点:排名前2-3的风险及影响
保持内容聚焦、简洁。
Step 2: Propose Architectural Options
步骤2:提出架构选项
Propose 2–3 options. Always include one minimal option.
For each option:
| Field | Content |
|---|---|
| Summary | One sentence: what this approach does |
| Effort | Small/Medium/High |
| Risk | What could go wrong |
| Builds on | Which existing code or patterns it leverages |
State your recommendation explicitly. Do not hedge — pick one and say why.
提出2-3个选项,必须包含一个最小成本选项。
每个选项的说明如下:
| 字段 | 内容 |
|---|---|
| 概要 | 一句话说明该方案的内容 |
| 工作量 | 小/中/大 |
| 风险 | 可能出现的问题 |
| 基于 | 该方案复用了哪些现有代码或模式 |
明确说明你的推荐方案,不要模棱两可——选择一个方案并说明理由。
Step 3: Adversarial Test the Recommendation
步骤3:对抗性测试推荐方案
Before presenting, attack your own recommendation internally:
- What would make this fail? Identify the single most likely failure mode.
- If the attack holds: Deform the design to survive it. Present the deformed version, noting what changed and why.
- If the attack shatters the approach entirely: Discard it, tell the user why, promote the second-best option and repeat.
Present the hardened recommendation — not your original unexamined first choice.
在展示方案前,先在内部对你的推荐方案发起挑战:
- 什么情况会导致该方案失败? 找出最可能出现的单一失败模式。
- 如果挑战成立:调整设计以解决该问题,展示调整后的版本,说明修改内容和原因。
- 如果挑战完全推翻了该方案:废弃该方案,向用户说明原因,推荐次优方案并重复上述测试流程。
展示经过验证的加固方案——而不是你最初未经过检验的第一选择。
Step 4: User Confirmation
步骤4:用户确认
Ask the user to confirm the direction. Do not proceed to Phase 3 until they do.
If the user pushes back: minor adjustments inline and confirm again; different option preferred — re-run adversarial test on that option; new option not yet proposed — explore, assess, test, present.
请用户确认开发方向,用户确认前不要进入阶段3。
如果用户提出异议:小调整可以直接修改后再次确认;用户偏好其他选项——对该选项重新进行对抗性测试;用户提出了未涉及的新选项——调研、评估、测试后再展示。
Phase Boundary
阶段边界
Phase 2 is complete when the user confirms an architectural direction.
Update COMPASS.md: fill in Architecture direction confirmed (one sentence: which option and why) and add links to all three analysis documents.
Proceed to Phase 3.
当用户确认了架构方向后,阶段2完成。
更新COMPASS.md:填写已确认的架构方向(一句话说明选择的方案及理由),添加三个分析文档的链接。
进入阶段3。
Phase 3: Task Decomposition
阶段3:任务拆解
Goal: Break the confirmed approach into concrete, trackable Tasks with no placeholders and clear acceptance criteria.
目标:将确认的方案拆分为具体、可跟踪的任务,没有占位符,有明确的验收标准。
Before You Begin
开始前准备
Confirm has a confirmed architecture direction — if not, Phase 2 was not completed.
COMPASS.mdCreate from .
task-breakdown.mdmilestones.mdassets/templates/plan确认中已有确认的架构方向——如果没有,说明阶段2未完成。
COMPASS.md基于下的模板创建、。
assets/templates/plantask-breakdown.mdmilestones.mdDispatch Plan
Plan调度Plan
PlanRead — Plan section — for the prompt template. Fill in:
references/subagents.md- The task definition from
COMPASS.md - The confirmed architecture direction from
COMPASS.md - The full Assumptions & Constraints from
COMPASS.md
Dispatch Plan after the template is filled.
读取的Plan部分获取提示词模板,填写以下内容:
references/subagents.md- 中的任务定义
COMPASS.md - 中已确认的架构方向
COMPASS.md - 中的全部假设与约束
COMPASS.md
模板填写完成后调度Plan。
Placeholder Enforcement
占位符校验
When Plan returns, scan both output files for forbidden patterns before accepting the output:
Forbidden: TBD, TODO, "implement later", "similar to Task N", "details to be determined", "to be specified", blank acceptance criteria fields, blank effort fields.
If any found: send Plan back with a list of every occurrence and the instruction to resolve each one. Do not proceed to Phase 4 with an incomplete plan.
Plan返回结果后,先扫描两个输出文件是否存在禁用模式,再接受输出:
禁用内容:TBD、TODO、“后续实现”、“类似任务N”、“待确定细节”、“待指定”、空的验收标准字段、空的工作量字段。
如果发现上述内容:将所有问题点列表返回给Plan,要求逐个解决。不要带着不完整的计划进入阶段4。
Output: .spec/plan/
.spec/plan/产出:.spec/plan/
.spec/plan/- task-breakdown.md: every Task with description, priority (P1/P2/P3), effort (Small/Medium/High), dependencies, subtasks, acceptance criteria; Mermaid dependency graph; Tasks ordered by dependency.
- milestones.md: 3–5 milestones, each an end-to-end working state or retired risk, with explicit demonstrable target criteria.
- task-breakdown.md:每个任务的描述、优先级(P1/P2/P3)、工作量(小/中/大)、依赖项、子任务、验收标准;Mermaid依赖图;按依赖顺序排列的任务列表
- milestones.md:3-5个里程碑,每个都是端到端可用状态或已解决的风险,有明确可验证的目标标准
Phase Boundary
阶段边界
Phase 3 is complete when both plan files are filled and contain no forbidden patterns. Proceed to Phase 4 immediately.
当两个计划文件全部填写完成且没有禁用模式时,阶段3完成,立即进入阶段4。
Phase 4: Plan Review & Approval
阶段4:计划评审与审批
Goal: Get explicit user approval before any implementation begins. No code, scaffolding, or pseudo-code until the user approves.
目标:在开始任何实现工作前获得用户明确批准。用户批准前不要编写任何代码、脚手架或伪代码。
Step 1: Present the Plan
步骤1:展示计划
Present a readable summary — do not paste the raw files. Cover:
- Task overview: all Tasks with names, priorities, effort estimates, and dependencies (a table works well)
- Milestone overview: all milestones and their target criteria
- Total scope: rough overall effort, number of Tasks
- Key risks addressed: tie back to the risk register — how does the plan handle the top risks?
展示可读性强的总结——不要直接粘贴原始文件内容。涵盖以下内容:
- 任务概览:所有任务的名称、优先级、工作量预估、依赖关系(用表格展示效果更好)
- 里程碑概览:所有里程碑及对应的目标标准
- 总范围:大致的总工作量、任务数量
- 已解决的关键风险:关联风险登记册,说明计划如何应对最高优先级的风险
Step 2: Invite Scrutiny
步骤2:邀请用户审核
Explicitly ask the user to check:
- Are all the right things included?
- Is anything scoped too broadly or too narrowly?
- Do the priorities look right?
- Are the acceptance criteria strong enough?
明确请用户检查以下内容:
- 是否包含了所有需要的内容?
- 有没有范围定得太宽或太窄的内容?
- 优先级是否合理?
- 验收标准是否足够明确?
Step 3: Handle Feedback
步骤3:处理反馈
Diagnose the root cause before acting:
| Feedback type | Root cause | Action |
|---|---|---|
| Task description unclear, wrong granularity, missing functionality | Plan output incomplete | Return to Phase 3: re-dispatch Plan with corrected instructions |
| Analysis missed a module, factual gap | Phase 1 analysis wrong | Return to Phase 1: targeted Explore, update analysis file, re-run Phase 3 |
| Architecture direction wrong | Phase 2 decision wrong | Return to Phase 2: re-present options, new confirmation, re-run Phase 3 |
| Scope or constraints changed | Phase 0 assumptions outdated | Update COMPASS.md, return to Phase 2 or 3 as appropriate |
| Minor wording fix, small reprioritization | Surface fix only | Edit plan file directly, no phase return needed |
State the diagnosis to the user before acting. Confirm with the user before returning to a prior phase.
采取行动前先诊断根本原因:
| 反馈类型 | 根本原因 | 处理方式 |
|---|---|---|
| 任务描述不清晰、粒度不合理、缺失功能 | 计划输出不完整 | 回到阶段3:带着修正指令重新调度Plan |
| 分析遗漏了某个模块、存在事实错误 | 阶段1分析错误 | 回到阶段1:定向Explore,更新分析文件,重新执行阶段3 |
| 架构方向错误 | 阶段2决策错误 | 回到阶段2:重新展示选项、获得新的确认,重新执行阶段3 |
| 范围或约束发生变化 | 阶段0的假设已经过时 | 更新COMPASS.md,根据情况回到阶段2或3 |
| minor的文字修正、小的优先级调整 | 仅需表层修改 | 直接编辑计划文件,不需要回到之前的阶段 |
采取行动前先向用户说明诊断结果,回到之前的阶段前需要获得用户确认。
Phase Boundary
阶段边界
Phase 4 is complete when the user explicitly approves the plan (e.g., "looks good", "approved", "proceed").
Update : add links to both plan documents, fill in the Task Overview table (all Tasks, initial ), fill in the Milestones table (all milestones, initial ).
COMPASS.md[ ][ ]Proceed to Phase 5.
当用户明确批准计划后(例如“看起来不错”、“批准”、“继续”),阶段4完成。
更新:添加两个计划文档的链接,填写任务概览表格(所有任务,初始状态为),填写里程碑表格(所有里程碑,初始状态为)。
COMPASS.md[ ][ ]进入阶段5。
Phase 5: Progress Tracking Setup
阶段5:进度跟踪配置
Goal: Create per-Task progress files and complete COMPASS.md so a fresh agent can orient in under 30 seconds.
目标:创建每个任务对应的进度文件,补全COMPASS.md,让新的Agent可以在30秒内明确当前状态。
Step 1: Create Progress Files
步骤1:创建进度文件
For each Task in , create from .
task-breakdown.mdtask-N-<short-name>.mdassets/templates/progress/task.mdFor each file:
- Copy the subtasks and acceptance criteria from
task-breakdown.md - Set Current to the first subtask of that Task (e.g., ); leave other tasks' Current blank until active
1.1 - Leave the Notes section empty
Naming example: Task 3 "Refactor authentication layer" →
task-3-refactor-auth.md对于中的每个任务,基于模板创建。
task-breakdown.mdassets/templates/progress/task.mdtask-N-<short-name>.md每个文件的填写规则:
- 从中复制子任务和验收标准
task-breakdown.md - 将Current设置为该任务的第一个子任务(例如);其他任务的Current留空,直到任务被激活
1.1 - 备注部分留空
命名示例:任务3“重构认证层” →
task-3-refactor-auth.mdStep 2: Complete COMPASS.md
步骤2:补全COMPASS.md
Fill in the two remaining sections:
Current Status: "Phase 5 complete. Ready to begin Task 1: ."
<name>Next Steps:
- Read to understand the full scope
.spec/plan/task-breakdown.md - Open and begin the first subtask
.spec/progress/task-1-<name>.md - Re-read Assumptions & Constraints before touching any code
填写剩余的两个部分:
当前状态:“阶段5完成。准备开始任务1:。”
<name>下一步:
- 读取了解完整范围
.spec/plan/task-breakdown.md - 打开开始第一个子任务
.spec/progress/task-1-<name>.md - 编写代码前重新阅读假设与约束
Phase Boundary
阶段边界
Phase 5 is complete when progress files exist and 's Current Status and Next Steps are filled. Proceed to Phase 6.
COMPASS.md当所有进度文件已创建,且的当前状态和下一步已填写完成时,阶段5完成。进入阶段6。
COMPASS.mdPhase 6: Sub-skill Generation
阶段6:子技能生成
Goal: Generate a project-scoped sub-skill that encodes this project's implementation standards and continuity protocol.
Install at project scope only: .
./.claude/skills/Name it . It is removed when the Archive Phase runs.
spec-coding-<project-name>Delegate creation to . Provide it the task context from , the sub-skill name, and the content outline below.
skill-creatorCOMPASS.mdIf is not installed: Tell the user it is required and instruct them to install it with . Do not install it on their behalf. Once installed, return to this phase.
skill-creatornpx skills add anthropics/skills --skill skill-creator目标:生成项目范围的子技能,内置该项目的实现规范和连续性协议。
仅安装到项目范围:。
./.claude/skills/命名为,归档阶段运行时会自动删除该子技能。
spec-coding-<project-name>将创建工作委托给,向其提供中的任务上下文、子技能名称和下方的内容大纲。
skill-creatorCOMPASS.md如果未安装:告知用户需要安装该工具,指导用户执行安装,不要替用户安装。安装完成后回到该阶段。
skill-creatornpx skills add anthropics/skills --skill skill-creatorRequired Sub-skill Content
子技能必填内容
The generated sub-skill must instruct the agent to do the following.
Session Startup (every conversation, non-negotiable):
- Read first — before any other file, before any action
.spec/COMPASS.md - Identify the active Task from the Task Overview table
- Open that Task's progress file in
.spec/progress/ - Populate with all unchecked subtasks.
TaskCreate - Re-read Assumptions & Constraints before touching any code
During Implementation:
- Before each implementation decision, check it against Assumptions & Constraints — if it conflicts, stop and invoke the Blocked Protocol.
- After completing a subtask: check its box in the progress file, update Current to the next subtask, use
[x]to mark the item as completed.TaskUpdate - Record decisions, surprises, and discovered context in the progress file Notes section — not in conversation text
- Dual-write: for real-time visibility; Markdown files for cross-conversation persistence
TaskCreate
Blocked Protocol: Include the full content of .
references/blocked-protocol.mdTask Completion:
- Verify all acceptance criteria before marking complete
- Mark in
[x]Task OverviewCOMPASS.md - Update Current Status and Next Steps in
COMPASS.md - Check : if this Task satisfies a milestone's criteria, mark it
milestones.mdin[x]and notify the userCOMPASS.md - When all Tasks are , trigger the Archive Phase automatically
[x]
Project-Specific Standards: Fill in from Phase 0 and Phase 1 analysis — tech stack conventions, naming rules, file organization, testing requirements.
生成的子技能必须指示Agent执行以下操作:
会话启动(每次会话都要执行,无商量余地):
- 首先读取——早于任何其他文件、早于任何操作
.spec/COMPASS.md - 从任务概览表格中识别当前活跃的任务
- 打开下对应任务的进度文件
.spec/progress/ - 将所有未勾选的子任务填充到中
TaskCreate - 编写代码前重新阅读假设与约束
实现过程中:
- 每次做实现决策前,对照假设与约束检查——如果冲突,停止并触发阻塞协议。
- 完成一个子任务后:在进度文件中勾选该子项,将Current更新为下一个子任务,使用
[x]标记该条目已完成。TaskUpdate - 在进度文件的备注部分记录决策、意外情况、新发现的上下文——不要记录在会话文本中。
- 双写机制:用于实时可见性;Markdown文件用于跨会话持久化。
TaskCreate
阻塞协议:包含的完整内容。
references/blocked-protocol.md任务完成:
- 标记完成前验证所有验收标准
- 在任务概览中勾选
COMPASS.md[x] - 更新中的当前状态和下一步
COMPASS.md - 检查:如果该任务满足了某个里程碑的标准,在
milestones.md中勾选该里程碑COMPASS.md并通知用户[x] - 所有任务都标记为后,自动触发归档阶段
[x]
项目特定规范:从阶段0和阶段1的分析中填写——技术栈约定、命名规则、文件组织、测试要求。
Phase Boundary
阶段边界
Phase 6 is complete when the project-scope sub-skill is installed and visible. Proceed to Handoff.
当项目范围的子技能已安装且可见时,阶段6完成。进入交接环节。
Handoff
交接
Present a structured summary:
- Confirmed task definition
- Key findings from analysis (3–5 bullets, high-level)
- Task overview: group names, Task count, total effort estimate
- Milestone list
- Sub-skill name and install location
List all generated artifacts:
.spec/
├── COMPASS.md
├── analysis/
│ ├── architecture.md
│ ├── module-map.md
│ └── risk-register.md
├── plan/
│ ├── task-breakdown.md
│ └── milestones.md
└── progress/
└── task-N-*.md (one per Task)
.claude/skills/spec-coding-<project-name> (sub-skill)Ask the user: "Preparation complete. Ready to start Task 1?"
展示结构化总结:
- 已确认的任务定义
- 分析得出的关键发现(3-5个要点,高层级)
- 任务概览:分组名称、任务数量、总工作量预估
- 里程碑列表
- 子技能名称和安装位置
列出所有生成的产物:
.spec/
├── COMPASS.md
├── analysis/
│ ├── architecture.md
│ ├── module-map.md
│ └── risk-register.md
├── plan/
│ ├── task-breakdown.md
│ └── milestones.md
└── progress/
└── task-N-*.md (每个任务对应一个文件)
.claude/skills/spec-coding-<project-name> (子技能)询问用户:“准备工作已完成。是否可以开始任务1?”
Implementation: Tasks
实现:任务执行
Once Handoff is confirmed, development proceeds as a series of Tasks.
At the start of every Task:
- Read — confirm position, re-read Assumptions & Constraints
.spec/COMPASS.md - Open
.spec/progress/task-N-<name>.md - Populate with subtasks
TaskCreate
During each Task:
- Work through subtasks one at a time.
- After each subtask: check its box in the progress file, update Current to the next subtask, use
[x]to mark the item as completed.TaskUpdate - Record decisions, surprises, blockers in the progress file Notes section — not in conversation text.
- Dual-write: (real-time) + Markdown files (cross-conversation persistence).
TaskCreate - If a subtask fails twice or hits a constraint conflict → invoke the Blocked Protocol immediately.
At the end of every Task:
- Verify all acceptance criteria.
- Mark in
[x]Task Overview.COMPASS.md - Update Current Status and Next Steps in .
COMPASS.md - Check : if this Task satisfies a milestone's criteria, mark it
milestones.mdin[x]and notify the user.COMPASS.md - When all Tasks are : trigger the Archive Phase.
[x]
交接确认后,开发工作以任务为单位逐步推进。
每个任务开始时:
- 读取——确认当前位置,重新阅读假设与约束
.spec/COMPASS.md - 打开
.spec/progress/task-N-<name>.md - 将子任务填充到中
TaskCreate
每个任务执行过程中:
- 逐个完成子任务。
- 完成一个子任务后:在进度文件中勾选该子项,将Current更新为下一个子任务,使用
[x]标记该条目已完成。TaskUpdate - 在进度文件的备注部分记录决策、意外情况、阻塞问题——不要记录在会话文本中。
- 双写机制:(实时可见)+ Markdown文件(跨会话持久化)。
TaskCreate - 如果某个子任务失败两次,或遇到约束冲突 → 立即触发阻塞协议。
每个任务结束时:
- 验证所有验收标准。
- 在任务概览中勾选
COMPASS.md。[x] - 更新中的当前状态和下一步。
COMPASS.md - 检查:如果该任务满足了某个里程碑的标准,在
milestones.md中勾选该里程碑COMPASS.md并通知用户。[x] - 所有任务都标记为后:触发归档阶段。
[x]
Blocked Protocol
阻塞协议
See references/blocked-protocol.md for the full protocol.
Trigger: A subtask has failed twice, OR an implementation decision conflicts with Assumptions & Constraints and cannot be resolved without user input.
Core rule: Stop immediately. Do not attempt a third workaround. Mark the subtask in the progress file, mark the Task in , then report to the user with root cause and what is needed to unblock.
[blocked][blocked]COMPASS.md完整协议参见references/blocked-protocol.md。
触发条件:某个子任务失败两次,或实现决策与假设与约束冲突,且无需用户输入无法解决。
核心规则:立即停止。不要尝试第三种解决方法。在进度文件中将该子任务标记为,在中将该任务标记为,然后向用户报告根本原因和解除阻塞需要的支持。
[blocked]COMPASS.md[blocked]Archive Phase
归档阶段
Trigger: All Tasks in are marked .
COMPASS.md[x]触发条件:中的所有任务都标记为。
COMPASS.md[x]Steps
步骤
-
Announce to the user that all Tasks are complete and the Archive Phase is beginning.
-
Git Snapshot: If the project is a git repository — prompt the user to commit any pending code changes. Once committed, record the commit hash inin
Final commit. If the user declines, recordCOMPASS.md. If not a git repo, skip.none (user skipped) -
Determine archive folder name: Format. Check
YYYY-MM-DD-NNfor existing folders with today's date and increment.spec/archived/accordingly (starting atNN).01 -
Move artifacts to the archive folder, preserving internal structure:
.spec/archived/YYYY-MM-DD-NN/
├── COMPASS.md
├── analysis/
│ ├── architecture.md
│ ├── module-map.md
│ └── risk-register.md
├── plan/
│ ├── task-breakdown.md
│ └── milestones.md
└── progress/
└── task-N-*.md-
Remove the project-scope sub-skill from.
.claude/skills/ -
Confirm to the user: what was archived and its location, the final commit hash (if applicable), thatis clean and ready for the next cycle.
.spec/
After archive, contains only the directory. The next development cycle begins with Phase 0.
.spec/archived/-
告知用户所有任务已完成,即将开始归档阶段。
-
Git快照:如果项目是Git仓库——提示用户提交所有未提交的代码变更。提交完成后,将提交哈希记录到的
COMPASS.md字段。如果用户拒绝提交,记录Final commit。如果不是Git仓库,跳过该步骤。none (user skipped) -
确定归档文件夹名称:格式为。检查
YYYY-MM-DD-NN下是否有当天日期的已有文件夹,按顺序递增.spec/archived/(从NN开始)。01 -
移动产物到归档文件夹,保留内部结构:
.spec/archived/YYYY-MM-DD-NN/
├── COMPASS.md
├── analysis/
│ ├── architecture.md
│ ├── module-map.md
│ └── risk-register.md
├── plan/
│ ├── task-breakdown.md
│ └── milestones.md
└── progress/
└── task-N-*.md-
从中删除项目范围的子技能。
.claude/skills/ -
向用户确认:已归档的内容和位置、最终提交哈希(如果有)、已清理完毕,可开始下一个开发周期。
.spec/
归档完成后,仅包含目录。下一个开发周期从阶段0开始。
.spec/archived/