spec

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

spec — spec mutator

spec — 规格说明书修改器

Read
FORMAT.md
at repo root if not already loaded. Caveman skill applies to all writes here.
如果尚未加载,请读取仓库根目录下的
FORMAT.md
。所有写入操作均遵循“穴居人技能”规范。

DISPATCH

调度逻辑

Inspect user request and project state:
  1. No
    SPEC.md
    at repo root AND args describe idea → NEW
  2. No
    SPEC.md
    AND
    from-code
    in args → DISTILL
  3. SPEC.md
    exists AND args start
    bug:
    BACKPROP
  4. SPEC.md
    exists AND args start
    amend
    AMEND
  5. SPEC.md
    exists, no args → ask user which mode
检查用户请求和项目状态:
  1. 仓库根目录无
    SPEC.md
    且参数描述了想法 → 新建(NEW)
  2. SPEC.md
    且参数包含
    from-code
    提炼(DISTILL)
  3. SPEC.md
    已存在且参数以
    bug:
    开头 → 反向传播(BACKPROP)
  4. SPEC.md
    已存在且参数以
    amend
    开头 → 修改(AMEND)
  5. SPEC.md
    已存在,无参数 → 询问用户选择哪种模式

NEW — idea → spec

新建 — 想法→规格说明书

Input: user idea.
Steps:
  1. Extract goal (1 line, caveman). → §G.
  2. List constraints user stated or implied. → §C.
  3. List external surfaces user named. → §I.
  4. Propose initial invariants. → §V (numbered V1…).
  5. Break goal into ordered tasks. → §T pipe table, all status
    .
    , ids T1…
  6. §B section with header row only (
    id|date|cause|fix
    ).
Write to
SPEC.md
. Show user full file. Ask: "spec OK? suggest edits or invoke build."
输入:用户想法。
步骤:
  1. 提取目标(1行,穴居人格式)→ §G章节。
  2. 列出用户明确或隐含的约束条件 → §C章节。
  3. 列出用户提及的外部接口 → §I章节。
  4. 提出初始不变量 → §V章节(编号为V1…)。
  5. 将目标拆解为有序任务 → §T管道表格,所有状态为
    .
    ,编号为T1…
  6. 创建§B章节,仅包含表头行(
    id|date|cause|fix
    )。
写入到
SPEC.md
。向用户展示完整文件。询问:“规格说明书是否符合要求?请提出修改建议或触发构建。”

DISTILL — code → spec

提炼 — 代码→规格说明书

Walk repo. Produce §G (infer from README/package.json/main entry), §C (infer from stack), §I (enumerate public APIs/CLIs/configs), §V (derive from tests and assertions), §T (one task per known TODO or missing test), §B (empty).
Caveman everywhere. Flag uncertain items with
?
in text so user can confirm.
遍历仓库。生成§G章节(从README/package.json/主入口推断)、§C章节(从技术栈推断)、§I章节(枚举公开API/CLI/配置)、§V章节(从测试和断言推导)、§T章节(每个已知TODO或缺失测试对应一个任务)、§B章节(为空)。
所有内容均采用穴居人格式。对不确定的内容在文本中标注
?
,以便用户确认。

BACKPROP — bug → §B + §V

反向传播 — bug→§B + §V

Input:
bug: <description>
.
Steps:
  1. Parse bug description.
  2. Find root cause (read relevant code).
  3. Decide: would a new invariant catch recurrence? If yes → draft
    V<next>
    .
  4. Append §B row:
    B<next>|<date>|<cause>|V<N>
    .
  5. Append new invariant to §V.
  6. If fix also changes behavior → add/update §T rows.
  7. Show diff. Apply only on user OK.
Rule: every bug gets a §B entry. Invariant optional but preferred.
输入:
bug: <描述>
步骤:
  1. 解析bug描述。
  2. 查找根本原因(阅读相关代码)。
  3. 判断:新增不变量是否能防止问题复发?如果是 → 草拟
    V<下一个编号>
  4. 向§B章节追加一行:
    B<下一个编号>|<日期>|<原因>|V<N>
  5. 向§V章节追加新的不变量。
  6. 如果修复同时改变了行为 → 添加/更新§T章节的行。
  7. 展示差异。仅在用户确认后应用修改。
规则:每个bug都必须在§B章节中记录。不变量为可选,但推荐添加。

AMEND — targeted edit

修改 — 定向编辑

Input:
amend §V.3
or
amend §T
etc.
Read that section. Show current. Ask user what changes. Write. Show diff.
Never silently rewrite sections user did not name.
输入:
amend §V.3
amend §T
等。
读取对应章节。展示当前内容。询问用户需要修改的内容。写入修改。展示差异。
绝不静默重写用户未指定的章节。

OUTPUT RULES

输出规则

  • Caveman format per
    FORMAT.md
    .
  • Preserve identifiers, paths, code verbatim.
  • Numbering monotonic — never reuse §V.N or §B.N.
  • §T row
    cites
    column ! list §V/§I deps:
    T5|.|impl auth mw|V2,I.api
    .
  • 遵循
    FORMAT.md
    中的穴居人格式。
  • 原样保留标识符、路径、代码内容。
  • 编号单调递增 — 绝不重复使用§V.N或§B.N的编号。
  • §T行的
    cites
    列!列出§V/§I依赖项:
    T5|.|实现认证中间件|V2,I.api

NON-GOALS

非目标

  • No sub-agents. Main thread writes.
  • No dashboards, no logs, no state files beyond SPEC.md itself.
  • No auto-build after spec. User invokes build explicitly.
  • 不使用子Agent。由主线程执行写入操作。
  • 不生成仪表板、日志,除了SPEC.md本身外无其他状态文件。
  • 规格说明书完成后不自动构建。需由用户显式触发构建。