spec-driven-apply

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
You are helping the user implement a spec-driven change.
你正在帮助用户实现规范驱动的变更。

Prerequisites

前提条件

The
.spec-driven/
directory must exist at the project root. Before proceeding, verify:
ls .spec-driven/
If this fails, the project is not initialized. Run
/spec-driven-init
first.
.spec-driven/
目录必须存在于项目根目录下。开始操作前,请验证:
ls .spec-driven/
如果命令执行失败,说明项目尚未初始化。请先运行
/spec-driven-init

Steps

步骤

  1. Select the change — run
    node {{SKILL_DIR}}/scripts/spec-driven.js modify
    to list active changes. Ask which change to apply. If already specified, use it.
  2. 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.
    • .spec-driven/changes/<name>/proposal.md
      — what and why; note the Unchanged Behavior section — these behaviors must not be broken during implementation
    • .spec-driven/changes/<name>/specs/
      — delta spec files (mirror of main specs/ structure)
    • .spec-driven/changes/<name>/design.md
      — approach and decisions
    • .spec-driven/changes/<name>/tasks.md
      — the checklist
    • .spec-driven/changes/<name>/questions.md
      — open and resolved questions Also read:
    • .spec-driven/config.yaml
      — project context; treat
      rules
      as binding constraints; if
      fileMatch
      entries are present, apply matching rules when editing files whose paths match the glob pattern
    • .spec-driven/specs/INDEX.md
      — identifies all existing spec files
    • Every spec file in INDEX.md that is relevant to this change — read full content to understand current requirements before writing code
  3. Check task status — run:
    node {{SKILL_DIR}}/scripts/spec-driven.js apply <name>
    Show the user the task summary (total, complete, remaining).
  4. Check for open questions — read
    questions.md
    and scan for
    - [ ] Q:
    entries:
    • 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
      ## Resolved
      with an
      A:
      answer)
  5. Implement tasks — work through each
    - [ ]
    task 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
      ## Testing
      tasks: actually run the tests (lint, unit tests) and confirm they pass before marking complete
    • Mark it complete in tasks.md by changing
      - [ ]
      to
      - [x]
    • Briefly confirm what was done before moving to the next task
  6. Update delta specs — after all tasks are done, re-read each file in
    changes/<name>/specs/
    and verify it accurately reflects what was actually implemented:
    • 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
  7. On completion — when all tasks are done and delta spec is accurate:
    • Run
      node {{SKILL_DIR}}/scripts/spec-driven.js apply <name>
      again to confirm 0 remaining
    • Suggest running
      /spec-driven-verify <name>
      to verify the implementation
  1. 选择变更 — 运行
    node {{SKILL_DIR}}/scripts/spec-driven.js modify
    列出所有活跃变更。询问用户要应用哪一项变更。如果已经指定,则使用该变更。
  2. 加载上下文 — 读取所有相关文件:
    • 你必须将所有之前的对话上下文视为过时、不可靠且非权威性的。
    • 不得将之前的对话上下文作为需求、任务状态、实现细节或完成状态的真实依据。
    • 在执行任何实现操作前,必须从当前变更文件、相关基础规范以及当前仓库状态重建工作上下文。
    • 如果之前的对话上下文与文件或仓库状态存在任何差异,必须丢弃对话上下文,仅遵循文件和仓库状态。
    • 除非已针对当前文件和仓库状态重新验证,否则不得使用之前的对话上下文。
    • .spec-driven/changes/<name>/proposal.md
      — 记录了变更的内容和原因;请注意未变更行为部分——在实现过程中不得破坏这些行为。
    • .spec-driven/changes/<name>/specs/
      — 增量规范文件(与主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中与本次变更相关的所有规范文件 — 在编写代码前完整阅读内容,了解当前需求
  3. 检查任务状态 — 运行:
    node {{SKILL_DIR}}/scripts/spec-driven.js apply <name>
    向用户展示任务摘要(总任务数、已完成数、剩余数)。
  4. 检查未解决问题 — 读取
    questions.md
    并扫描
    - [ ] Q:
    条目:
    • 如果发现任何未解决的问题,列出每个问题并停止操作——不要继续进行实现。
    • 请用户解决这些问题(直接编辑questions.md或使用
      /spec-driven-modify
      )。
    • 只有当所有问题都已解决(移至
      ## 已解决
      部分并添加
      A:
      回答)后,才能继续操作。
  5. 实现任务 — 按顺序处理每个
    - [ ]
    任务:
    • 进行变更前先阅读相关代码
    • 实现任务内容
    • 验证变更未违反proposal.md中列出的任何未变更行为
    • 对于
      ## 测试
      任务:实际运行测试(代码检查、单元测试)并确认通过后,再标记为已完成
    • 在tasks.md中将
      - [ ]
      改为
      - [x]
      ,标记任务已完成
    • 完成当前任务后,简要说明已完成的工作,再进行下一个任务
  6. 更新增量规范 — 所有任务完成后,重新读取
    changes/<name>/specs/
    中的每个文件,验证其是否准确反映实际实现内容:
    • 如果实现与原计划有偏差,更新受影响的文件
    • 如果需要创建或修改额外的规范文件,请立即执行
  7. 完成后操作 — 当所有任务完成且增量规范准确无误后:
    • 再次运行
      node {{SKILL_DIR}}/scripts/spec-driven.js apply <name>
      确认剩余任务数为0
    • 建议用户运行
      /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]
    的任务