spec-driven-spec-edit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
You are helping the user create or modify main spec files under
.spec-driven/specs/
directly, without going through the change workflow. This is for lightweight corrections — fixing typos, correcting inaccurate requirements, or adding missing spec entries.
你正在协助用户直接在
.spec-driven/specs/
目录下创建或修改主规范文件,无需走变更工作流。该操作适用于轻量修正场景——修复拼写错误、校正不准确的需求,或是补充缺失的规范条目。

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. Read spec context first — before making any changes, read:
    • .spec-driven/config.yaml
    • .spec-driven/specs/INDEX.md
    • any existing main spec files relevant to the user's request
  2. Understand the request — identify whether the user wants to:
    • add a new spec file or category
    • add new requirements to an existing spec file
    • modify an existing requirement
    • remove one or more existing requirements
  3. Choose the target — use
    INDEX.md
    to determine where the content belongs:
    • If one or more existing spec files cover the behavior, use those
    • Only create a new spec file if no existing file fits
    • Only create a new category if no existing category fits
  4. Prepare the changes — draft the exact modifications:
    • For additions: write the new
      ### Requirement:
      heading and body
    • For modifications: show the before and after content
    • For removals: identify the exact
      ### Requirement:
      heading(s) to remove
    • Describe observable behavior only, not implementation details
  5. Present and confirm — show the user:
    • which file or files will be changed
    • the exact content that will be added, modified, or removed
    • whether
      INDEX.md
      needs updating
    Wait for explicit user confirmation before writing anything.
  6. Apply the changes — after confirmation:
    • Edit the target spec file(s) under
      .spec-driven/specs/
    • Preserve existing
      mapping.implementation
      and
      mapping.tests
      frontmatter
    • If the edit changes which implementation or test files evidence the spec, update only the mapping frontmatter with repo-relative file paths
    • If a new file or category was created, update
      .spec-driven/specs/INDEX.md
    • For removals, delete the exact
      ### Requirement:
      heading(s) cleanly — do not leave orphaned headings or vague remnants
  7. Validate the result — after editing, verify:
    • Each edited file still follows the standard
      ### Requirement:
      heading format
    • Edited files still have valid mapping frontmatter
    • INDEX.md
      correctly reflects all spec files under
      .spec-driven/specs/
    • If format issues are found, fix them immediately Run
      node {{SKILL_DIR}}/scripts/spec-driven.js verify-spec-mappings
      when mapping frontmatter changed.
  8. Summarize — tell the user:
    • which file(s) were changed
    • what was added, modified, or removed
    • whether INDEX.md was updated
  1. 优先读取规范上下文 —— 做任何修改前,先读取:
    • .spec-driven/config.yaml
    • .spec-driven/specs/INDEX.md
    • 所有和用户请求相关的现有主规范文件
  2. 理解请求 —— 明确用户的需求类型:
    • 新增规范文件或分类
    • 为现有规范文件添加新需求
    • 修改现有需求
    • 删除一条或多条现有需求
  3. 选择目标位置 —— 参考
    INDEX.md
    确定内容归属:
    • 如果已有一个或多个规范文件覆盖该行为,就使用现有文件
    • 仅当没有适配的现有文件时才创建新的规范文件
    • 仅当没有适配的现有分类时才创建新分类
  4. 准备变更内容 —— 起草准确的修改内容:
    • 新增场景:编写新的
      ### Requirement:
      标题和正文
    • 修改场景:展示修改前后的内容
    • 删除场景:明确要删除的具体
      ### Requirement:
      标题
    • 仅描述可观测的行为,不要涉及实现细节
  5. 展示并确认 —— 向用户展示:
    • 将要修改的文件
    • 将要新增、修改或删除的具体内容
    • 是否需要更新
      INDEX.md
    写入任何内容前必须等待用户明确确认。
  6. 应用变更 —— 获得确认后:
    • 编辑
      .spec-driven/specs/
      下的目标规范文件
    • 保留现有
      mapping.implementation
      mapping.tests
      前置元数据
    • 如果本次编辑修改了支撑规范的实现或测试文件,仅更新前置元数据中的仓库相对文件路径即可
    • 如果创建了新文件或新分类,更新
      .spec-driven/specs/INDEX.md
    • 删除场景下,干净地删除对应的
      ### Requirement:
      标题——不要留下孤立标题或模糊的残留内容
  7. 校验结果 —— 编辑完成后验证:
    • 每个编辑后的文件仍遵循标准的
      ### Requirement:
      标题格式
    • 编辑后的文件仍包含有效的映射前置元数据
    • INDEX.md
      准确反映
      .spec-driven/specs/
      下的所有规范文件
    • 如果发现格式问题,立即修复 若修改了映射前置元数据,执行
      node {{SKILL_DIR}}/scripts/spec-driven.js verify-spec-mappings
  8. 总结 —— 告知用户:
    • 哪些文件被修改了
    • 新增、修改或删除了什么内容
    • 是否更新了INDEX.md

Rules

规则

  • Always read existing specs before editing — never edit blind
  • Present changes and wait for confirmation before writing
  • Prefer existing categories and files unless the content clearly requires a new path
  • Describe observable behavior only, not implementation details
  • Do not implement product code — this skill edits planning artifacts only
  • Do not create or interact with
    .spec-driven/changes/
  • Keep implementation and test mappings in frontmatter, not in requirement prose
  • 编辑前务必读取现有规范——切勿盲目编辑
  • 写入前先展示变更内容并等待确认
  • 优先使用现有分类和文件,除非内容明确需要新路径
  • 仅描述可观测行为,不涉及实现细节
  • 不要编写产品代码——本技能仅编辑规划类产物
  • 不要创建或操作
    .spec-driven/changes/
    目录
  • 实现和测试映射放在前置元数据中,不要写在需求正文里