spec-driven-apply
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseYou are helping the user implement a spec-driven change.
你正在帮助用户实现规范驱动的变更。
Prerequisites
前提条件
The directory must exist at the project root. Before proceeding, verify:
.spec-driven/ls .spec-driven/If this fails, the project is not initialized. Run first.
/spec-driven-init.spec-driven/ls .spec-driven/如果命令执行失败,说明项目尚未初始化。请先运行。
/spec-driven-initSteps
步骤
-
Select the change — runto list active changes. Ask which change to apply. If already specified, use it.
node {{SKILL_DIR}}/scripts/spec-driven.js modify -
Load context — read all artifacts:
- You MUST treat all prior conversational context as stale, unreliable, and non-authoritative.
- You MUST NOT use prior chat context as a source of truth for requirements, task state, implementation details, or completion status.
- You MUST rebuild working context from the current change artifacts, relevant base specs, and the current repository state before taking any implementation action.
- If prior chat context differs from the files or repository state in any way, you MUST discard the prior chat context and follow the files and repository state only.
- Do not use prior chat context unless it has been explicitly re-validated against the current files and repository state.
- — what and why; note the Unchanged Behavior section — these behaviors must not be broken during implementation
.spec-driven/changes/<name>/proposal.md - — delta spec files (mirror of main specs/ structure)
.spec-driven/changes/<name>/specs/ - — approach and decisions
.spec-driven/changes/<name>/design.md - — the checklist
.spec-driven/changes/<name>/tasks.md - — open and resolved questions Also read:
.spec-driven/changes/<name>/questions.md - — project context; treat
.spec-driven/config.yamlas binding constraints; ifrulesentries are present, apply matching rules when editing files whose paths match the glob patternfileMatch - — identifies all existing spec files
.spec-driven/specs/INDEX.md - Every spec file in INDEX.md that is relevant to this change — read full content to understand current requirements before writing code
-
Check task status — run:
node {{SKILL_DIR}}/scripts/spec-driven.js apply <name>Show the user the task summary (total, complete, remaining). -
Check for open questions — readand scan for
questions.mdentries:- [ ] Q:- If any open questions are found, list each one and stop — do not proceed to implementation
- Ask the user to resolve the questions (edit questions.md directly or use )
/spec-driven-modify - Only continue once all questions are resolved (moved to with an
## Resolvedanswer)A:
-
Implement tasks — work through eachtask in order:
- [ ]- Read relevant code before making changes
- Implement the task
- Verify the change does not violate any Unchanged Behavior listed in proposal.md
- For tasks: actually run the tests (lint, unit tests) and confirm they pass before marking complete
## Testing - Mark it complete in tasks.md by changing to
- [ ]- [x] - Briefly confirm what was done before moving to the next task
-
Update delta specs — after all tasks are done, re-read each file inand verify it accurately reflects what was actually implemented:
changes/<name>/specs/- If the implementation diverged from the original plan, update the affected files
- If additional spec files need to be created or modified, do so now
-
On completion — when all tasks are done and delta spec is accurate:
- Run again to confirm 0 remaining
node {{SKILL_DIR}}/scripts/spec-driven.js apply <name> - Suggest running to verify the implementation
/spec-driven-verify <name>
- Run
-
选择变更 — 运行列出所有活跃变更。询问用户要应用哪一项变更。如果已经指定,则使用该变更。
node {{SKILL_DIR}}/scripts/spec-driven.js modify -
加载上下文 — 读取所有相关文件:
- 你必须将所有之前的对话上下文视为过时、不可靠且非权威性的。
- 不得将之前的对话上下文作为需求、任务状态、实现细节或完成状态的真实依据。
- 在执行任何实现操作前,必须从当前变更文件、相关基础规范以及当前仓库状态重建工作上下文。
- 如果之前的对话上下文与文件或仓库状态存在任何差异,必须丢弃对话上下文,仅遵循文件和仓库状态。
- 除非已针对当前文件和仓库状态重新验证,否则不得使用之前的对话上下文。
- — 记录了变更的内容和原因;请注意未变更行为部分——在实现过程中不得破坏这些行为。
.spec-driven/changes/<name>/proposal.md - — 增量规范文件(与主specs/结构镜像一致)
.spec-driven/changes/<name>/specs/ - — 实现方案与决策
.spec-driven/changes/<name>/design.md - — 任务清单
.spec-driven/changes/<name>/tasks.md - — 未解决和已解决的问题 同时读取:
.spec-driven/changes/<name>/questions.md - — 项目上下文;将
.spec-driven/config.yaml视为绑定约束;如果存在rules条目,编辑路径匹配通配符模式的文件时需应用匹配规则fileMatch - — 列出所有现有规范文件
.spec-driven/specs/INDEX.md - INDEX.md中与本次变更相关的所有规范文件 — 在编写代码前完整阅读内容,了解当前需求
-
检查任务状态 — 运行:
node {{SKILL_DIR}}/scripts/spec-driven.js apply <name>向用户展示任务摘要(总任务数、已完成数、剩余数)。 -
检查未解决问题 — 读取并扫描
questions.md条目:- [ ] Q:- 如果发现任何未解决的问题,列出每个问题并停止操作——不要继续进行实现。
- 请用户解决这些问题(直接编辑questions.md或使用)。
/spec-driven-modify - 只有当所有问题都已解决(移至部分并添加
## 已解决回答)后,才能继续操作。A:
-
实现任务 — 按顺序处理每个任务:
- [ ]- 进行变更前先阅读相关代码
- 实现任务内容
- 验证变更未违反proposal.md中列出的任何未变更行为
- 对于任务:实际运行测试(代码检查、单元测试)并确认通过后,再标记为已完成
## 测试 - 在tasks.md中将改为
- [ ],标记任务已完成- [x] - 完成当前任务后,简要说明已完成的工作,再进行下一个任务
-
更新增量规范 — 所有任务完成后,重新读取中的每个文件,验证其是否准确反映实际实现内容:
changes/<name>/specs/- 如果实现与原计划有偏差,更新受影响的文件
- 如果需要创建或修改额外的规范文件,请立即执行
-
完成后操作 — 当所有任务完成且增量规范准确无误后:
- 再次运行确认剩余任务数为0
node {{SKILL_DIR}}/scripts/spec-driven.js apply <name> - 建议用户运行来验证实现结果
/spec-driven-verify <name>
- 再次运行
Rules
规则
- Read existing code before modifying it
- Complete tasks in order unless there is a clear dependency reason to skip
- Mark tasks complete immediately after implementing them, not in bulk at the end
- If a task is ambiguous, read proposal.md and design.md before asking the user
- Do not implement tasks that are already marked
- [x]
- 修改代码前先阅读现有代码
- 按顺序完成任务,除非有明确的依赖原因需要跳过
- 任务完成后立即标记,不要在最后批量标记
- 如果任务不明确,先阅读proposal.md和design.md,再询问用户
- 不要实现已标记为的任务
- [x]