spec
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesespec — spec mutator
spec — 规格说明书修改器
Read at repo root if not already loaded. Caveman skill applies to all writes here.
FORMAT.md如果尚未加载,请读取仓库根目录下的。所有写入操作均遵循“穴居人技能”规范。
FORMAT.mdDISPATCH
调度逻辑
Inspect user request and project state:
- No at repo root AND args describe idea → NEW
SPEC.md - No AND
SPEC.mdin args → DISTILLfrom-code - exists AND args start
SPEC.md→ BACKPROPbug: - exists AND args start
SPEC.md→ AMENDamend - exists, no args → ask user which mode
SPEC.md
检查用户请求和项目状态:
- 仓库根目录无且参数描述了想法 → 新建(NEW)
SPEC.md - 无且参数包含
SPEC.md→ 提炼(DISTILL)from-code - 已存在且参数以
SPEC.md开头 → 反向传播(BACKPROP)bug: - 已存在且参数以
SPEC.md开头 → 修改(AMEND)amend - 已存在,无参数 → 询问用户选择哪种模式
SPEC.md
NEW — idea → spec
新建 — 想法→规格说明书
Input: user idea.
Steps:
- Extract goal (1 line, caveman). → §G.
- List constraints user stated or implied. → §C.
- List external surfaces user named. → §I.
- Propose initial invariants. → §V (numbered V1…).
- Break goal into ordered tasks. → §T pipe table, all status , ids T1…
. - §B section with header row only ().
id|date|cause|fix
Write to . Show user full file. Ask: "spec OK? suggest edits or invoke build."
SPEC.md输入:用户想法。
步骤:
- 提取目标(1行,穴居人格式)→ §G章节。
- 列出用户明确或隐含的约束条件 → §C章节。
- 列出用户提及的外部接口 → §I章节。
- 提出初始不变量 → §V章节(编号为V1…)。
- 将目标拆解为有序任务 → §T管道表格,所有状态为,编号为T1…
. - 创建§B章节,仅包含表头行()。
id|date|cause|fix
写入到。向用户展示完整文件。询问:“规格说明书是否符合要求?请提出修改建议或触发构建。”
SPEC.mdDISTILL — 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:
- Parse bug description.
- Find root cause (read relevant code).
- Decide: would a new invariant catch recurrence? If yes → draft .
V<next> - Append §B row: .
B<next>|<date>|<cause>|V<N> - Append new invariant to §V.
- If fix also changes behavior → add/update §T rows.
- Show diff. Apply only on user OK.
Rule: every bug gets a §B entry. Invariant optional but preferred.
输入:。
bug: <描述>步骤:
- 解析bug描述。
- 查找根本原因(阅读相关代码)。
- 判断:新增不变量是否能防止问题复发?如果是 → 草拟。
V<下一个编号> - 向§B章节追加一行:。
B<下一个编号>|<日期>|<原因>|V<N> - 向§V章节追加新的不变量。
- 如果修复同时改变了行为 → 添加/更新§T章节的行。
- 展示差异。仅在用户确认后应用修改。
规则:每个bug都必须在§B章节中记录。不变量为可选,但推荐添加。
AMEND — targeted edit
修改 — 定向编辑
Input: or etc.
amend §V.3amend §TRead that section. Show current. Ask user what changes. Write. Show diff.
Never silently rewrite sections user did not name.
输入:或等。
amend §V.3amend §T读取对应章节。展示当前内容。询问用户需要修改的内容。写入修改。展示差异。
绝不静默重写用户未指定的章节。
OUTPUT RULES
输出规则
- Caveman format per .
FORMAT.md - Preserve identifiers, paths, code verbatim.
- Numbering monotonic — never reuse §V.N or §B.N.
- §T row column ! list §V/§I deps:
cites.T5|.|impl auth mw|V2,I.api
- 遵循中的穴居人格式。
FORMAT.md - 原样保留标识符、路径、代码内容。
- 编号单调递增 — 绝不重复使用§V.N或§B.N的编号。
- §T行的列!列出§V/§I依赖项:
cites。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本身外无其他状态文件。
- 规格说明书完成后不自动构建。需由用户显式触发构建。