@heihei0299/matt-skills 2.0.2 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/.agents/skills/ci-guard/SKILL.md +6 -2
  2. package/.agents/skills/commit-check/scripts/scan-sensitive.sh +14 -6
  3. package/.agents/skills/diagnose-fix/SKILL.md +16 -15
  4. package/.agents/skills/diagnose-fix/references/anti-patterns.md +5 -4
  5. package/.agents/skills/grill-to-spec/SKILL.md +4 -0
  6. package/.agents/skills/grill-to-spec/references/rules.md +19 -24
  7. package/.agents/skills/scaffold-functional-test/SKILL.md +9 -6
  8. package/.agents/skills/scaffold-functional-test/references/schema.md +56 -11
  9. package/.agents/skills/tdd-implement/SKILL.md +25 -14
  10. package/.agents/skills/tdd-implement/references/contract.md +21 -0
  11. package/.agents/skills/tdd-implement/references/finalize.md +27 -0
  12. package/.agents/skills/tdd-implement/references/orchestration.md +21 -16
  13. package/.agents/skills/tdd-implement/references/red-green.md +25 -0
  14. package/.agents/skills/tdd-implement/references/stages.md +25 -39
  15. package/.agents/skills/tdd-implement/references/verify.md +24 -0
  16. package/README.md +48 -27
  17. package/bin/cli.js +85 -24
  18. package/bin/skill-boundaries.js +61 -0
  19. package/config/proprietary.json +28 -9
  20. package/package.json +1 -1
  21. package/scripts/sync-upstream.js +4 -8
  22. package/template/.agents/skills/diagnose-fix/SKILL.md +16 -15
  23. package/template/.agents/skills/diagnose-fix/references/anti-patterns.md +5 -4
  24. package/template/.agents/skills/grill-to-spec/SKILL.md +4 -0
  25. package/template/.agents/skills/grill-to-spec/references/rules.md +19 -24
  26. package/template/.agents/skills/scaffold-functional-test/SKILL.md +9 -6
  27. package/template/.agents/skills/scaffold-functional-test/references/schema.md +56 -11
  28. package/template/.agents/skills/tdd-implement/SKILL.md +25 -14
  29. package/template/.agents/skills/tdd-implement/references/contract.md +21 -0
  30. package/template/.agents/skills/tdd-implement/references/finalize.md +27 -0
  31. package/template/.agents/skills/tdd-implement/references/orchestration.md +21 -16
  32. package/template/.agents/skills/tdd-implement/references/red-green.md +25 -0
  33. package/template/.agents/skills/tdd-implement/references/stages.md +25 -39
  34. package/template/.agents/skills/tdd-implement/references/verify.md +24 -0
  35. package/template/.opencode/CONTEXT.md +7 -7
  36. package/template/.opencode/docs/agents/skill-design.md +3 -3
  37. package/template/.opencode/skills/README.md +1 -1
  38. package/template/.pi/CONTEXT.md +7 -7
  39. package/template/.pi/docs/agents/skill-design.md +3 -3
  40. package/template/.pi/skills/README.md +1 -1
  41. package/template/AGENTS.md +49 -30
  42. package/template/.agents/skills/ci-guard/SKILL.md +0 -50
  43. package/template/.agents/skills/ci-guard/agents/openai.yaml +0 -5
  44. package/template/.agents/skills/commit-check/SKILL.md +0 -95
  45. package/template/.agents/skills/commit-check/agents/openai.yaml +0 -5
  46. package/template/.agents/skills/commit-check/scripts/scan-sensitive.sh +0 -29
  47. package/template/.opencode/commands/commit-check.md +0 -9
@@ -2,24 +2,69 @@
2
2
 
3
3
  `scaffold-functional-test` 生成的实例清单以本文件为唯一字段契约。实例是声明式输入,不把执行逻辑散落在生成器正文中。
4
4
 
5
- ## Required fields
5
+ ## Common required fields
6
6
 
7
- 每个实例必须包含:
7
+ 每个实例都必须包含:
8
8
 
9
9
  - `prompt`:实例要覆盖的用户行为;
10
- - `command`:实际执行的命令或入口;
11
- - `expected files/content`:预期文件、副作用或内容;无文件副作用时明确写 `none`;
12
- - `expected stdout phrases`:预期 stdout/stderr 短语;无要求时明确写 `none`;
13
- - `expected exit code`:预期退出码;
10
+ - `type`:实例类型,必须是 `cli`、`http`、`browser` 或 `file` 之一;
14
11
  - `source`:spec 章节/行号,或 README / `--help` 的明确来源。
15
12
 
16
- ## Optional fields
13
+ `setup`、`env`、`timeout`、`teardown` 为跨类型可选字段。不要为了凑字段写 `none`;某个断言维度不适用时直接省略。
17
14
 
18
- 可按实例需要增加:
15
+ ## Type-specific contract
19
16
 
20
- - `setup`、`env`、`timeout`、`type`、`teardown`;
21
- - `type` 缺省为 `cli`;
22
- - 需要展示多个文件或短语时使用列表,不把不可验证的自然语言目标当作断言。
17
+ ### `type: cli`
18
+
19
+ 必须包含:
20
+
21
+ - `command`:实际执行命令;
22
+ - `expected exit code`:预期退出码。
23
+
24
+ 按需包含:
25
+
26
+ - `expected stdout phrases`;
27
+ - `expected stderr phrases`;
28
+ - `expected files/content`。
29
+
30
+ ### `type: http`
31
+
32
+ 必须包含:
33
+
34
+ - `request`:method + URL/path + 必要 headers/body;
35
+ - `expected status`:预期 HTTP status。
36
+
37
+ 按需包含:
38
+
39
+ - `expected body`;
40
+ - `expected headers`;
41
+ - `expected side effects`。
42
+
43
+ ### `type: browser`
44
+
45
+ 必须包含:
46
+
47
+ - `entrypoint`:已有页面、dev server 或浏览器入口;
48
+ - `steps`:最小用户操作序列;
49
+ - `assertions`:DOM、可见文本、URL、网络或控制台等用户可观察断言。
50
+
51
+ browser 实例不要求伪造 `stdout` 或 `exit code` 字段;执行器负责记录浏览器证据和必要截图/trace 路径。
52
+
53
+ ### `type: file`
54
+
55
+ 必须包含:
56
+
57
+ - `command` 或已有生成入口;
58
+ - `expected files/content`:应出现、变化或保持不变的文件与内容断言。
59
+
60
+ 按需包含 `expected exit code`、stdout/stderr 断言。
61
+
62
+ ## Assertion rules
63
+
64
+ - 只写可机器验证或可明确观察的断言,不把“应该正常”“体验良好”这类自然语言目标当作 assertion;
65
+ - 一个实例可以有多个断言,但每个断言必须能回溯到 `source`;
66
+ - 优先验证用户可观察行为,不把内部实现细节当作功能结果;
67
+ - 同一行为存在多种入口时,选择最接近真实使用路径的类型和入口,不强行统一成 CLI。
23
68
 
24
69
  ## Fingerprint
25
70
 
@@ -6,34 +6,40 @@ disable-model-invocation: true
6
6
 
7
7
  # TDD Implement
8
8
 
9
- `seam` + `red-green` 是本技能的领衔词。它把一个 spec 或 task issue 编排成四个交付阶段;TDD 的红-绿语义、测试质量和 mock 边界以 [tdd 技能](.agents/skills/tdd/SKILL.md) 为唯一事实源,本技能只定义交付编排。
9
+ `seam` + `red-green` 是本技能的领衔词。它把一个 spec 或 task issue 编排成三个交付阶段,并在 Verify 后执行一次非阶段的 Finalize 收尾;TDD 的红-绿语义、测试质量和 mock 边界以 [tdd 技能](.agents/skills/tdd/SKILL.md) 为唯一事实源,本技能只定义交付编排。
10
10
 
11
11
  本技能是 **Long-Horizon Skill**:阶段按顺序连续执行,并自带 **Turn Continuity** 与 **Chunking**。术语见 `CONTEXT.md`,技能设计规则见 `docs/agents/skill-design.md`。
12
12
 
13
13
  ## 入口与分支
14
14
 
15
- - **单 issue**:单个 `.scratch/<feature>/spec.md`、等价 spec 或 `Type: task` issue,按下方四个 Steps 完成一个交付闭环。
15
+ - **单 issue**:单个 `.scratch/<feature>/spec.md`、等价 spec 或 `Type: task` issue,按下方三个 Steps 完成验证,再执行 Finalize 收尾。
16
16
  - **多 issue**:`.scratch/<feature>/issues/` 下存在多个 `Type: task` 文件时,先读取 [orchestration.md](references/orchestration.md),按 `Blocked by` 构建 DAG、Kahn 分层,再由主代理按层串行完成各 issue。
17
17
  - `Type: research`、`prototype`、`grilling` 分流到对应技能,不进入本技能。
18
18
 
19
19
  多 issue 的 A0-A5 是编排控制活动,不是额外的产品交付阶段:依赖图、分层、串行调度、层收敛、全量收敛和回退/冲突处理的详规只在 [orchestration.md](references/orchestration.md) 中维护。
20
20
 
21
- ## 四阶段 Steps
21
+ ## 三阶段 Steps
22
22
 
23
- 按序执行;每步达到可验证出口条件后立即进入下一步。每步开始前读取 [stages.md](references/stages.md) 中对应定义。
23
+ 按序执行;每步达到可验证出口条件后立即进入下一步。每步只读取自己的轻量 reference,避免在每个阶段重复注入完整 `stages.md`。
24
24
 
25
- | Step | 做什么 | 出口条件 |
26
- |---|---|---|
27
- | ① **Contract** | 读取入口,提取 Acceptance Criteria,建立 Scope Ledger、Preflight、验证矩阵和 Behavior/Seam 边界 | 需求无待决歧义,验证命令已确定;知道做什么、从哪里验证、什么不做 |
28
- | ② **Red-Green** | 以 Behavior 为粒度执行有效 Red → 最小 Green → formatter/typecheck → 最小相关测试 | 所有 Behaviors 均有有效 Red、实现全绿,formatter/typecheck 和最小相关测试通过 |
29
- | ③ **Verify** | 运行当前 issue 影响范围测试、必要 build、要求的真实运行验证;执行一次 Standards + Spec Review | 最终 diff 的相关证据通过,真实运行验证完成(如要求),无 blocking finding |
30
- | ④ **Deliver** | 对齐 docs/README,执行敏感信息扫描,检查 staged diff、commit message 和必要的 Git history,创建独立 commit,更新 issue/progress.md | commit 已创建,Acceptance Criteria 全部通过,Tracker 与工作区反映真实完成状态 |
25
+ | Step | Reference | 做什么 | 出口条件 |
26
+ |---|---|---|---|
27
+ | ① **Contract** | [contract.md](references/contract.md) | 读取入口,提取 Acceptance Criteria,建立 Scope Ledger、Preflight、验证矩阵和 Behavior/Seam 边界 | 需求无待决歧义,验证命令已确定;知道做什么、从哪里验证、什么不做 |
28
+ | ② **Red-Green** | [red-green.md](references/red-green.md) | 以 Behavior 为粒度执行有效 Red → 最小 Green → formatter/typecheck → 最小相关测试 | 所有 Behaviors 均有有效 Red、实现全绿,formatter/typecheck 和最小相关测试通过 |
29
+ | ③ **Verify** | [verify.md](references/verify.md) | 运行当前 issue 影响范围测试、必要 build、要求的真实运行验证;在最终 diff 稳定后调用一次 [code-review](.agents/skills/code-review/SKILL.md) | 最终 diff 的相关证据通过,真实运行验证完成(如要求),code-review 已完成且无 blocking finding |
30
+
31
+ ## Finalize(非阶段)
32
+
33
+ Verify 出口满足后读取 [finalize.md](references/finalize.md) 并立即收尾。Finalize 不计入交付阶段,只负责必要的 docs/README 对齐、直接创建当前 issue 的独立 commit 与 Tracker/progress 更新;不执行额外安全扫描、staged diff 复核或 commit message 门禁。若发现实现、测试或文档证据不完整,回到对应阶段修复后再 Finalize。
34
+
35
+ Finalize 出口:commit 已创建、Acceptance Criteria 全部通过,Tracker 与工作区反映真实完成状态。
31
36
 
32
37
  ## 运行时纪律
33
38
 
34
- - 四个阶段都从入口连续执行到自身出口:预告下一步后立即执行;进度输出并入工具调用序列,输出后继续执行。只有合规交互点、明确的外部阻塞或阶段出口条件结束当前回合。
35
- - 一个 seam 是公共可观察边界;一个 Behavior 是一个红-绿 cycle;一个 seam 可以包含多个 Behaviors。Seam/Behavior 的细节和 Todo 粒度见 [stages.md](references/stages.md)。
36
- - 当前 issue 的范围、Acceptance Criteria、Out of Scope、测试/typecheck/build/真实运行证据和最终 commit 必须可追溯。Seam 或专项测试绿色不代表 issue 完成;四阶段出口全部满足后才可标记 `resolved`。
39
+ - 三个阶段都从入口连续执行到自身出口;Verify 出口满足后立即进入 Finalize:预告下一步后立即执行;进度输出并入工具调用序列,输出后继续执行。只有合规交互点、明确的外部阻塞或阶段出口条件结束当前回合。
40
+ - 一个 seam 是公共可观察边界;一个 Behavior 是一个红-绿 cycle;一个 seam 可以包含多个 Behaviors。Seam/Behavior 的细节和 Todo 粒度只在进入 Step ② 时读取 [red-green.md](references/red-green.md)。
41
+ - 每个 issue 只在 Verify 的最终 diff 稳定后调用一次 `code-review`;审查维度、reviewer 数量、提示词和输出格式全部由 `code-review` 自己定义,`tdd-implement` 不复制这些规则。`code-review` 未完成或存在 blocking finding 时 issue 不得收敛;A3 层收敛不再次调用 review。
42
+ - 当前 issue 的范围、Acceptance Criteria、Out of Scope、测试/typecheck/build/真实运行证据和最终 commit 必须可追溯。Seam 或专项测试绿色不代表 issue 完成;三个阶段出口与 Finalize 全部满足后才可标记 `resolved`。
37
43
  - 多 issue 模式中,每个 issue 只提交一个独立 commit;issue 影响范围测试在 Step ③ 执行,全仓测试由 orchestration 的 A4 在全部 issue 完成后执行一次。
38
44
 
39
45
  ## 引用
@@ -41,5 +47,10 @@ disable-model-invocation: true
41
47
  - TDD 核心规则:[tdd 技能](.agents/skills/tdd/SKILL.md)
42
48
  - 测试标准:[tdd/tests.md](.agents/skills/tdd/tests.md)
43
49
  - Mock 指南:[tdd/mocking.md](.agents/skills/tdd/mocking.md)
44
- - 四阶段详规:[stages.md](references/stages.md)
50
+ - Contract:[contract.md](references/contract.md)
51
+ - Red-Green:[red-green.md](references/red-green.md)
52
+ - Verify:[verify.md](references/verify.md)
53
+ - Review 方法:[code-review](.agents/skills/code-review/SKILL.md)
54
+ - Finalize:[finalize.md](references/finalize.md)
55
+ - 完整兼容规范:[stages.md](references/stages.md)
45
56
  - 多 issue 编排:[orchestration.md](references/orchestration.md)
@@ -0,0 +1,21 @@
1
+ # Contract
2
+
3
+ 仅在 `tdd-implement` Step ① 读取。完整跨阶段规则仍以 `stages.md` 为兼容事实源;本文件只提供 Contract 阶段运行所需内容,避免加载其它阶段。
4
+
5
+ ## 操作
6
+
7
+ 1. 读取 spec/task、相关 `CONTEXT.md` 与必要 ADR,并使用仓库规定的代码探索入口理解当前实现。
8
+ 2. 提取每条 Acceptance Criterion,建立 Scope Ledger:`必须实现 / 明确不做 / 允许触及`。
9
+ 3. 将新发现分类为:当前 Behavior 必须修复、当前 issue 新增 Behavior、后续 ticket、无关项;只有前两类进入本次实现。
10
+ 4. 做一次 Preflight:记录 `HEAD`、工作区、`BASE_HEAD=$(git rev-parse HEAD)`、test/typecheck/build、可用 subagent/browser、敏感扫描、真实运行验证路径。
11
+ 5. 建立一次验证矩阵,后续复用,不重复探测等价命令。
12
+ 6. 定义公共 Seam 与 Behaviors:Behavior 必须映射到 Acceptance Criterion,并明确输入、可观察输出和验证层级。
13
+ 7. 已确认且未变化的 seam 直接复用;只有歧义、验收缺口、范围变化、破坏性操作或互斥方案才请求用户确认。
14
+
15
+ ## 出口
16
+
17
+ - Acceptance Criteria、Scope Ledger 与 Out of Scope 明确;
18
+ - 无待决需求歧义;
19
+ - 验证矩阵和真实运行路径已确定,或明确标为 `blocked/unavailable`;
20
+ - Behaviors/Seams 可追溯;
21
+ - `BASE_HEAD` 已记录。
@@ -0,0 +1,27 @@
1
+ # Finalize(非阶段)
2
+
3
+ 仅在 `tdd-implement` Step ③ Verify 通过后读取。Finalize 不计入交付阶段;开始后不新增产品 Behavior,发现实现、测试或文档遗漏时回到对应阶段。
4
+
5
+ ## Commit
6
+
7
+ 1. 如本次实现要求 README/docs/config/package 同步,完成必要更新。
8
+ 2. 按当前 issue 范围直接创建一个独立 commit。
9
+ 3. 不执行额外敏感信息/安全扫描,不做 `git diff --cached` 复核,也不设置额外 commit message 门禁。
10
+
11
+ 仓库级 Git 安全与历史保护规则仍然适用;Finalize 不重复定义或扩展这些规则。
12
+
13
+ ## Tracker 收尾
14
+
15
+ Commit 成功后:
16
+
17
+ - 勾选 Acceptance Criteria;
18
+ - issue 标记 `resolved`;
19
+ - 写实施总结并同步 `.scratch/<feature>/progress.md` 的 Status/Commit/Review/Tests;
20
+ - 记录 commit hash/message、最终测试和真实运行结果;
21
+ - 确认后续 blockers 是否解除。
22
+
23
+ ## 出口
24
+
25
+ - 当前 issue 的独立 commit 已创建;
26
+ - Acceptance Criteria 全部通过;
27
+ - Tracker/progress 与真实完成度一致。
@@ -1,8 +1,8 @@
1
1
  # 多 issue 编排(按依赖分层串行)
2
2
 
3
- 本文件仅在 `.scratch/<feature>/issues/` 下存在多个 `Type: task` issue 时生效。单 `spec` / 单 `task` 直接按 [stages.md](stages.md) 的四阶段闭环执行。A0-A5 是编排控制活动,不是额外的产品交付阶段。
3
+ 本文件仅在 `.scratch/<feature>/issues/` 下存在多个 `Type: task` issue 时生效。单 `spec` / 单 `task` 直接按 [stages.md](stages.md) 的三个交付阶段执行,并在 Verify 后 Finalize。A0-A5 是编排控制活动,不是额外的产品交付阶段。
4
4
 
5
- 主代理按依赖分层、层内按编号串行执行;每个 issue 由同一个主代理完成 Contract → Red-Green → Verify Deliver,并创建一个独立 commit。实现细节以 [stages.md](stages.md) 为准,TDD 语义以 [tdd 技能](.agents/skills/tdd/SKILL.md) 为准。
5
+ 主代理按依赖分层、层内按编号串行执行;每个 issue 由同一个主代理完成 Contract → Red-Green → Verify,再执行非阶段 Finalize 并创建一个独立 commit。实现细节以 [stages.md](stages.md) 为准,TDD 语义以 [tdd 技能](.agents/skills/tdd/SKILL.md) 为准。
6
6
 
7
7
  ## 目录
8
8
 
@@ -20,8 +20,8 @@
20
20
  1. 扫描 `.scratch/<feature>/issues/` 下全部 `NN-<slug>.md`,逐文件解析 `Blocked by`:
21
21
  - `Blocked by: None`、`Blocked by: (无)` 或无此行:无依赖;
22
22
  - `Blocked by: 01, 02` 或 `Blocked by: 01(…)`:依赖对应编号 issue;
23
- - 无法解析:按无依赖处理,并在编排总结中记录告警。
24
- 2. 以 issue 编号为节点、`Blocked by` 为有向边构建 DAG;检测到环时列出环上节点并停止调度。
23
+ - `Blocked by` 行存在但无法解析:**fail closed**。将该 issue 标记为 `blocked`,记录原始字段和值,不把它加入可调度 DAG,也不得按“无依赖”继续。只有字段修正或用户明确确认依赖后才能继续编排。
24
+ 2. 以 issue 编号为节点、`Blocked by` 为有向边构建 DAG;检测到环时列出环上节点并停止调度。依赖引用了不存在的 issue 时同样 fail closed:对应 issue 保持 `blocked`,报告缺失节点,不静默忽略该依赖。
25
25
  3. 读取共享 `spec.md`(若存在)、`CONTEXT.md` 和与本次改动有关的 ADR。
26
26
  4. 完成编排级 Preflight:记录当前 `HEAD`、工作区状态、`BASE_HEAD=$(git rev-parse HEAD)`、测试/typecheck/build 命令、真实运行路径和敏感信息扫描脚本可用性。后续只使用已经确认的命令和路径。
27
27
  5. 强制初始化 `.scratch/<feature>/progress.md`:
@@ -38,10 +38,11 @@
38
38
 
39
39
  ### A0 出口
40
40
 
41
+ - 所有 `Blocked by` 字段均可解析且依赖节点存在;否则相关 issue 保持 `blocked`,A1 不开始;
41
42
  - DAG 已构建且无环;
42
43
  - 编排 Preflight 和 `BASE_HEAD` 已记录;
43
44
  - `progress.md` 已存在并可回写;
44
- - 依赖解析告警已记录。
45
+ - 依赖解析或缺失节点问题已明确报告,而不是降级成无依赖。
45
46
 
46
47
  ## A1:Kahn 拓扑分层
47
48
 
@@ -59,7 +60,8 @@ Ln = 最后一层
59
60
  ### A1 出口
60
61
 
61
62
  - Kahn 分层结果已展示并确认;
62
- - 每个 issue 都属于一个层;
63
+ - 每个可调度 issue 都属于一个层;
64
+ - 不存在因无法解析依赖而被误放入 L1 的 issue;
63
65
  - 同文件预期冲突已记录,必要时已通过依赖顺序隔离。
64
66
 
65
67
  ## A2:分层串行调度
@@ -67,22 +69,22 @@ Ln = 最后一层
67
69
  ```text
68
70
  for each layer Li in L1..Ln:
69
71
  for each issue in Li(按编号顺序):
70
- 主代理执行四阶段:
72
+ 主代理执行三个阶段:
71
73
  ① Contract
72
74
  ② Red-Green
73
- ③ Verify(当前 issue 影响范围)
74
- Deliver(独立 commit + Tracker 收尾)
75
+ ③ Verify(当前 issue 影响范围 + 当前 issue review)
76
+ 执行 Finalize(非阶段:独立 commit + Tracker 收尾)
75
77
  产出回执卡片并回写 issue
76
78
  强制更新 progress.md 的 Status/Commit/Review/Tests
77
79
  通过 A3 层收敛后进入下一层
78
80
  全部层完成后进入 A4
79
81
  ```
80
82
 
81
- 每个 issue 的 Verify 只运行当前 issue 影响范围内的完整测试;全仓测试不在每个 issue 中重复执行。每个 issue 只做一次正式 Standards + Spec Review;修复 blocking finding 后执行定向复核,不重新启动完整 review
83
+ 每个 issue 的 Verify 只运行当前 issue 影响范围内的完整测试;全仓测试不在每个 issue 中重复执行。当前 issue 的最终 diff 稳定后只调用一次 `code-review`;review 的内部方法完全由 `code-review` 定义。修复 blocking finding 后执行受影响验证和 finding delta recheck,不重复调用完整 `code-review`。
82
84
 
83
- 主代理在层内和层间连续调度:一个 issue 的 Deliver 出口满足后,立即取下一个 issue,直到全部层完成或发生明确外部阻塞。进度输出并入执行序列,不在正常切换点等待用户“继续”。
85
+ 主代理在层内和层间连续调度:一个 issue 的 Finalize 出口满足后,立即取下一个 issue,直到全部层完成或发生明确外部阻塞。进度输出并入执行序列,不在正常切换点等待用户“继续”。
84
86
 
85
- 进入 A2 前记录的 `BASE_HEAD` 必须在每个 issue 的阶段出口和 commit 前校验:
87
+ 进入 A2 前记录的 `BASE_HEAD` 必须在每个 issue 的三个阶段出口和 Finalize commit 前校验:
86
88
 
87
89
  ```bash
88
90
  git merge-base --is-ancestor $BASE_HEAD HEAD
@@ -100,7 +102,7 @@ Status: resolved
100
102
  Commit: <hash> — <message>
101
103
  Behaviors: <completed list>
102
104
  Acceptance Criteria: <checkbox result>
103
- Review: Standards + Spec, no blocking finding
105
+ Review: code-review completed once, no blocking finding
104
106
  Tests: <targeted command and actual result>
105
107
  Runtime: <actual request/page-visible result or not required>
106
108
  Docs: <updated files or no update required>
@@ -108,13 +110,15 @@ Docs: <updated files or no update required>
108
110
 
109
111
  ### A2 出口
110
112
 
111
- - 当前层每个 issue 均完成四阶段并有独立 commit;
113
+ - 当前层每个 issue 均完成三个阶段与 Finalize 并有独立 commit;
112
114
  - issue、回执卡片和 `progress.md` 一致;
113
115
  - 相关测试通过,工作区卫生和历史校验通过;
114
116
  - 没有未记录的跨 issue 改动。
115
117
 
116
118
  ## A3:层收敛
117
119
 
120
+ A3 只做编排收敛,不再次调用 `code-review`;正式 review 已在每个 issue 的 Verify 中完成。
121
+
118
122
  每层全部 issue 串行完成后检查以下项目,全部通过才进入下一层:
119
123
 
120
124
  1. 所有 issue `Status: resolved`,实施总结已落盘,`progress.md` 对应行已为 `done`;
@@ -147,16 +151,17 @@ A5 负责所有编排级失败,不把失败静默吞掉,也不把不相关
147
151
 
148
152
  | 失败类别 | 处理 |
149
153
  |---|---|
154
+ | `Blocked by` 存在但无法解析,或依赖节点不存在 | fail closed:该 issue 保持 `blocked`,保留原始依赖值并停止其调度;字段修正或用户明确确认依赖后才重新构建 DAG |
150
155
  | Contract 歧义、验收缺口、范围变化 | 回到该 issue 的 Contract,补 Scope Ledger、Behavior 和验证矩阵 |
151
156
  | Red-Green 的有效 Red、实现、typecheck 或 targeted test 失败 | 回到该 issue 的 Red-Green,修复当前 Behavior 并重新验证 |
152
157
  | Verify 的测试、build、真实运行或 review blocking finding 失败 | 回到受影响 issue 的对应阶段;修复后只做受影响检查和 delta review |
153
- | Deliver docs、敏感扫描、commit 或 Tracker 失败 | 保持 issue 未 resolved,修复 Deliver 门禁后重新验证 |
158
+ | Finalize 的必要 docscommit 或 Tracker 失败 | 保持 issue 未 resolved,修复 Finalize 问题后重新验证 |
154
159
  | 全量测试失败 | 定位到引入失败的 issue,按上述路径修复;只在修复后重跑必要范围和全量测试 |
155
160
  | `Blocked by` 依赖未完成 | 后续 issue 保持 `blocked`,前置 issue resolved 后自动解阻 |
156
161
  | 多 issue 预期修改同一文件 | 记录冲突,按编号串行;无法安全归属时暂停并请求用户决定 |
157
162
  | Git 历史祖先校验失败 | 立即停止写入,使用 `git reflog` 找回 `BASE_HEAD` 之后的提交,校验通过后继续 |
158
163
 
159
- 主代理不跨 issue 无记录改动;不通过第二次完整双轴 review 来掩盖定向修复。外部权限、model、browser 或 tool 不可用时遵循 [stages.md](stages.md) 的 Tool Failure Budget,最多一次有依据的 fallback,仍失败则标记 `blocked/unavailable` 并报告实际状态。
164
+ 主代理不跨 issue 无记录改动;不通过第二次完整 `code-review` 来掩盖定向修复。外部权限、model、browser 或 tool 不可用时遵循 [stages.md](stages.md) 的 Tool Failure Budget,最多一次有依据的 fallback,仍失败则标记 `blocked/unavailable` 并报告实际状态。
160
165
 
161
166
  ### A5 出口
162
167
 
@@ -0,0 +1,25 @@
1
+ # Red-Green
2
+
3
+ 仅在 `tdd-implement` Step ② 读取。TDD 语义以 `.agents/skills/tdd/SKILL.md` 为唯一事实源;本文件只描述交付阶段编排。
4
+
5
+ ## 操作
6
+
7
+ 1. 加载 `tdd` 核心规则;每个 Behavior 只按需读取 `tdd/tests.md` / `tdd/mocking.md`。
8
+ 2. Todo 以 Behavior 为粒度;一个 Behavior 是一个 `Red → Green → formatter/typecheck → 最小相关测试` cycle。
9
+ 3. 有效 Red 必须从公共接口观察到“目标行为尚未实现”的断言失败;语法错误、fixture/helper 缺失、环境启动失败、timeout 或工具错误都不是有效 Red。
10
+ 4. 只写让当前 Behavior Green 的最小实现;每次修改后即时 formatter/typecheck 和最小相关测试。
11
+ 5. 每个 Behavior 完成后更新 Todo,然后立即进入下一个 Behavior;一个 Seam 全绿不是阶段出口。
12
+
13
+ ## Turn Continuity / Chunking
14
+
15
+ - 每个 Behavior 的 Red → Green → 验证在一个回合内连续完成;预告下一步后立即执行。
16
+ - 所有 Behaviors 完成前持续推进,除非遇到合规交互点或明确外部阻塞。
17
+ - 单次 write 超过约 150 行时先骨架后分批;超过约 5 处 replace 时拆批验证。
18
+
19
+ ## 出口
20
+
21
+ - 所有 Behaviors 都有有效 Red;
22
+ - 最小实现全部 Green;
23
+ - formatter/typecheck 与最小相关测试通过;
24
+ - Todo 全部反映真实完成状态;
25
+ - `BASE_HEAD` 祖先校验通过。
@@ -1,13 +1,13 @@
1
- # 四阶段详细定义
1
+ # 三阶段详细定义 + Finalize
2
2
 
3
- 单 `spec` / 单 `task` 与多 `task` 共用下表四阶段。多 issue 的依赖图、Kahn 分层、层收敛、全量收敛和回退/冲突处理见 [orchestration.md](orchestration.md)。TDD 语义以 [tdd 技能](.agents/skills/tdd/SKILL.md) 为唯一事实源,不在此重写。
3
+ 单 `spec` / 单 `task` 与多 `task` 共用下列三个交付阶段;Verify 通过后执行 Finalize 收尾,Finalize 不计入阶段。多 issue 的依赖图、Kahn 分层、层收敛、全量收敛和回退/冲突处理见 [orchestration.md](orchestration.md)。TDD 语义以 [tdd 技能](.agents/skills/tdd/SKILL.md) 为唯一事实源,不在此重写。
4
4
 
5
5
  ## 目录
6
6
 
7
7
  - [① Contract:明确交付契约](#阶段-①-contract明确交付契约)
8
8
  - [② Red-Green:行为级 TDD](#阶段-②-red-green行为级-tdd)
9
9
  - [③ Verify:最终验证与审查](#阶段-③-verify最终验证与审查)
10
- - [④ Deliver:提交与 Tracker 收尾](#阶段-④-deliver提交与-tracker-收尾)
10
+ - [Finalize:非阶段交付收尾](#finalize非阶段交付收尾)
11
11
  - [跨阶段运行纪律](#跨阶段运行纪律)
12
12
  - [状态统一](#状态统一)
13
13
  - [回退路由](#回退路由)
@@ -21,12 +21,12 @@
21
21
  2. 产品实现之前存在有效 Red;
22
22
  3. 最终 diff 对应的相关测试和 typecheck 通过;
23
23
  4. ticket 要求真实运行时,真实运行验证已完成;
24
- 5. Standards Spec Review blocking finding;
24
+ 5. 当前稳定 diff 已完成一次 `code-review` 且无 blocking finding;
25
25
  6. README/docs 与实现一致;
26
26
  7. 每个 issue 形成独立、可追溯的 commit;
27
27
  8. Tracker 状态与真实完成度一致。
28
28
 
29
- Seam 或专项测试绿色不等于 issue 完成;只有四个阶段全部通过,issue 才能标记为 `resolved`。
29
+ Seam 或专项测试绿色不等于 issue 完成;只有三个阶段与 Finalize 全部通过,issue 才能标记为 `resolved`。
30
30
 
31
31
 
32
32
  ## 阶段 ① Contract:明确交付契约
@@ -58,11 +58,10 @@ Seam 或专项测试绿色不等于 issue 完成;只有四个阶段全部通
58
58
  5. 完成一次 **Preflight** 并记录真实结果:
59
59
  - 当前 `HEAD`、工作区状态和 `BASE_HEAD=$(git rev-parse HEAD)`;
60
60
  - 可用的 test、typecheck、build 命令;
61
- - 可用的 subagent model;
61
+ - `code-review` 可用性;
62
62
  - 可用的 browser 或 Playwright 路径;
63
- - 可用的敏感信息扫描脚本;
64
63
  - ticket 要求的真实运行验证方式。
65
- 6. 建立一次验证矩阵,列出 targeted tests、typecheck、全量测试、必要 build、smoke/package/security check 和真实运行验证,并记录各项的触发条件,后续只复用这份矩阵。
64
+ 6. 建立一次验证矩阵,列出 targeted tests、typecheck、全量测试、必要 build、smoke/package check 和真实运行验证,并记录各项的触发条件,后续只复用这份矩阵。
66
65
  7. 识别公共测试边界和 Behaviors。一个 Seam 是一个公共可观察边界;一个 Behavior 是一个红-绿 cycle;一个 Seam 可以包含多个 Behaviors。每个 Behavior 明确输入、可观察输出、对应 Acceptance Criterion 和验证层级。
67
66
  8. spec 已确认且未变化的 Seam 直接复用;只有出现需求歧义、验收缺口、范围变化、破坏性操作或互斥方案时才请求用户确认。
68
67
 
@@ -137,7 +136,7 @@ Seam 或专项测试绿色不等于 issue 完成;只有四个阶段全部通
137
136
  当前 issue 影响范围测试
138
137
  → 必要 build
139
138
  → 必要真实运行验证
140
- 一次 Standards + Spec Review
139
+ 当前稳定 diff 调用一次 code-review
141
140
  → 修复 blocking finding 后的定向复核
142
141
  ```
143
142
 
@@ -150,46 +149,36 @@ Seam 或专项测试绿色不等于 issue 完成;只有四个阶段全部通
150
149
 
151
150
  ### Review
152
151
 
153
- 1. 每个 issue 恰好执行一次正式双轴 review
154
- - **Standards**:是否符合仓库规则和代码质量要求;
155
- - **Spec**:是否逐条满足当前 issue Acceptance Criteria。
156
- 2. 两个轴独立输出、互不掩盖;每个轴明确限制输出,例如 `≤ 400 words / 40 行`。
157
- 3. findings 分类为:当前 issue blocking、后续 ticket、advisory、out of scope。只处理当前 issue blocking finding;其余记录而不扩大范围。
158
- 4. 修复 blocking finding 后只运行受影响测试、typecheck 和 finding 的 delta recheck,不重新启动完整双轴 review。审查结果只在对话输出,不生成 `review-*.md` 等书面报告文件。
152
+ 1. 当前 issue 的最终 diff 稳定后,调用一次 [code-review](.agents/skills/code-review/SKILL.md)。
153
+ 2. `tdd-implement` 只负责 **何时调用 review**;审查维度、reviewer 数量、提示词、上下文与输出格式全部以 `code-review` 为唯一事实源,不在这里复制或弱化。
154
+ 3. `code-review` 未完成或存在 blocking finding 时,issue 保持未完成。只修当前 issue blocking finding;其余 findings 按 `code-review` 的分类与输出处理,不无记录地扩大范围。
155
+ 4. 修复 blocking finding 后,只运行受影响测试/typecheck 与 finding delta recheck,不再次调用完整 `code-review`。若修复引入新的 Behavior、改变 Scope 或使原 Review 对象不再成立,则回到 Contract/Red-Green,重新形成稳定最终 diff 后再进入 Verify。
156
+ 5. Review 结果只在对话/运行记录中消费,不由 `tdd-implement` 额外生成自己的 review 报告格式。
159
157
 
160
158
  ### 出口条件
161
159
 
162
160
  - 最终 diff 对应的相关测试通过;
163
161
  - 必要 typecheck/build 通过;
164
162
  - ticket 要求的真实运行验证已完成并记录实际结果;
165
- - 一次 Standards + Spec Review 已完成;
163
+ - 当前稳定 diff 已完成一次 `code-review`;
166
164
  - 无 blocking finding;
167
165
  - 受影响范围的最后一次证据对应当前 diff。
168
166
 
169
167
  ---
170
168
 
171
- ## 阶段 ④ Deliver:提交与 Tracker 收尾
169
+ ## Finalize:非阶段交付收尾
172
170
 
173
171
  ### 入口条件
174
172
 
175
173
  - Verify 出口条件满足。
176
174
 
177
- ### Commit 前门禁
175
+ ### Commit
178
176
 
179
- 按以下顺序完成并记录事实:
177
+ 1. 如本次实现要求 README/docs/config/package 同步,完成必要更新。
178
+ 2. 按当前 issue 范围直接创建一个独立 commit。
179
+ 3. 不执行额外敏感信息/安全扫描,不做 `git diff --cached` 复核,也不设置额外 commit message 门禁。
180
180
 
181
- 1. 最终逐条检查 Acceptance Criteria;
182
- 2. 检查 README/docs/config/package 与实现一致;
183
- 3. 复核 Scope Ledger,确认没有未记录的范围扩张;
184
- 4. 确认证据对应最后一次代码或测试修改;
185
- 5. 检查临时文件、构建产物和未跟踪文件;
186
- 6. 对 staged diff 执行敏感信息检查;
187
- 7. 执行 `git merge-base --is-ancestor $BASE_HEAD HEAD`;
188
- 8. 检查 commit message;
189
- 9. 确认暂存区只包含当前 issue;
190
- 10. 执行 `git diff --cached`,再创建当前 issue 的独立 commit。
191
-
192
- 执行敏感信息扫描脚本(`bash .agents/skills/commit-check/scripts/scan-sensitive.sh --staged-only`),检查 staged diff、commit message 和 Git history preservation,全部通过后创建当前 issue 的独立 commit。
181
+ 仓库级 Git 安全与历史保护规则仍然适用;Finalize 不重复定义或扩展这些规则。
193
182
 
194
183
  ### Tracker 收尾
195
184
 
@@ -200,19 +189,16 @@ Commit 成功后:
200
189
  - 追加实施总结;
201
190
  - 更新 `.scratch/<feature>/progress.md` 的 `Status`、`Commit`、`Review`、`Tests`;
202
191
  - 记录 commit hash、message、最终测试命令/数量/结果和真实运行结果;
203
- - 清理本次产生的临时进程、目录和一次性文件;
204
192
  - 确认下一 issue 的 blockers 已解除。
205
193
 
206
- 阶段 开始后不新增产品 Behavior。若实现、测试或文档不完整,回到对应阶段;不要在 Tracker 收尾后继续修改源码,也不要通过额外 docs-only commit 掩盖遗漏。只有四个阶段全部通过,才可把 issue 标记为 `resolved`。
194
+ Finalize 开始后不新增产品 Behavior。若实现、测试或文档不完整,回到对应阶段;只有三个阶段与 Finalize 全部通过,才可把 issue 标记为 `resolved`。
207
195
 
208
196
  ### 出口条件
209
197
 
210
198
  - commit 已创建且为当前 issue 的独立提交;
211
199
  - Acceptance Criteria 全部通过;
212
200
  - issue 状态为 `resolved`(无关联 issue 的直接 spec 则在会话中输出总结);
213
- - 实施总结和 `progress.md` 已同步;
214
- - 工作区符合预期,无本次临时产物或残留未跟踪文件;
215
- - 文档与实现一致,Git 历史保护校验通过。
201
+ - 实施总结和 `progress.md` 已同步。
216
202
 
217
203
  ---
218
204
 
@@ -231,7 +217,7 @@ Commit 成功后:
231
217
 
232
218
  ### 验证证据失效
233
219
 
234
- 任何产品代码或测试文件再次变化,旧的测试、typecheck、build review 证据立即失效;必须重新验证受影响范围。只能使用最后一次修改之后的结果证明当前 diff 已完成。
220
+ 任何产品代码或测试文件再次变化,旧的测试、typecheck、build 等受影响证据立即失效,必须重新验证受影响范围。正式 `code-review` 调用本身不因 finding 修复而重复;post-review 修复必须完成受影响验证和 finding delta recheck。若修改引入新的 Behavior、改变 Scope 或使原 Review 对象不再成立,则回到 Contract/Red-Green,重新形成稳定最终 diff 后再进入 Verify。
235
221
 
236
222
  ### Git History Preservation
237
223
 
@@ -253,7 +239,7 @@ Issue: ready-for-agent | in_progress | resolved | blocked
253
239
  Progress: pending | in_progress | done | blocked
254
240
  ```
255
241
 
256
- 状态转换:Contract 完成后 Issue/Progress 为 `in_progress`;Red-Green 完成后 Behaviors 为 `completed`,Issue 仍为 `in_progress`;Verify 完成后 Issue 仍为 `in_progress`;Deliver 完成后 Issue 为 `resolved`、Progress 为 `done`。外部阻塞记录为 `blocked`,恢复后回到 `in_progress`。
242
+ 状态转换:Contract 完成后 Issue/Progress 为 `in_progress`;Red-Green 完成后 Behaviors 为 `completed`,Issue 仍为 `in_progress`;Verify 完成后 Issue 仍为 `in_progress`;Finalize 完成后 Issue 为 `resolved`、Progress 为 `done`。外部阻塞记录为 `blocked`,恢复后回到 `in_progress`。
257
243
 
258
244
  ---
259
245
 
@@ -264,6 +250,6 @@ Progress: pending | in_progress | done | blocked
264
250
  | ① Contract | 需求歧义、验收缺口、范围变化 | → ① 补充契约和验证矩阵 |
265
251
  | ② Red-Green | 有效 Red、实现、formatter、typecheck 或相关测试失败 | → ② 修复当前 Behavior |
266
252
  | ③ Verify | 测试、build、真实运行或 review finding 失败 | → ② 修复 Behavior;需求偏差 → ① |
267
- | Deliver | docs、敏感扫描、staged diff、commit message Tracker 信息不完整 | → ①/③ 修复对应证据;仍在 Deliver 前完成 |
253
+ | Finalize | 必要 docs 未同步、commit 失败或 Tracker 信息不完整 | → ①/③ 修复对应问题;仍在 Finalize 完成前解决 |
268
254
 
269
255
  多 issue 的层收敛、全量失败、依赖冲突和跨 issue 修改冲突按 [orchestration.md](orchestration.md) A5 回退,不跨 issue 无记录改动。
@@ -0,0 +1,24 @@
1
+ # Verify
2
+
3
+ 仅在 `tdd-implement` Step ③ 读取。验证必须对应当前最终 diff;产品代码或测试再次变化时,测试/typecheck/build 等受影响证据失效。
4
+
5
+ ## 固定顺序
6
+
7
+ `影响范围测试 → 必要 build → 必要真实运行验证 → code-review 一次 → blocking 修复后的定向复核`
8
+
9
+ ## 规则
10
+
11
+ - 单 issue / 单 spec:按 Contract 验证矩阵运行完整相关测试;多 issue:只跑当前 issue 影响范围,全仓测试留给 orchestration A4。
12
+ - ticket 要求真实运行时,优先专用 browser,其次项目已有 Playwright;HTTP/CLI 不能替代 WebUI 可见验证。
13
+ - 临时进程必须使用隔离配置/端口,记录 PID 与实际结果,结束后清理。
14
+ - 当前 issue 的最终 diff 稳定后,调用一次 [code-review](.agents/skills/code-review/SKILL.md)。`tdd-implement` 只规定调用时机;审查维度、reviewer 数量、提示词、上下文与输出格式以 `code-review` 为唯一事实源。
15
+ - `code-review` 未完成或返回 blocking finding 时,issue 保持未完成;只修当前 issue 的 blocking finding,其余按 review 结果记录。
16
+ - 修复 blocking finding 后,只重跑受影响测试/typecheck 并对该 finding 做 delta recheck;不再次调用完整 `code-review`。若修复引入新的 Behavior、改变 Scope 或使原 Review 对象不再成立,则回到 Contract/Red-Green,重新形成稳定最终 diff 后再进入 Verify。
17
+
18
+ ## 出口
19
+
20
+ - 最终 diff 的相关测试/typecheck/build 通过;
21
+ - 要求的真实运行验证有实际证据;
22
+ - 当前稳定 diff 已完成一次 `code-review`;
23
+ - 无 blocking finding;
24
+ - post-review 修复(如有)的受影响验证与 finding delta recheck 已完成。
@@ -5,7 +5,7 @@ The domain vocabulary for this repo — two sections: how this repository is pos
5
5
  ## Repository
6
6
 
7
7
  **Template Repository** (模板仓库):
8
- This repository's identity. It is the config repo for mattpocock/skills: it distributes project-level config (AGENTS.md behavior routing, `.opencode/docs/agents/` discipline files, `.opencode/CONTEXT.md` glossary) plus ALL skills via `.agents/skills` (upstream 26 + proprietary 6). The workspace content is mirrored into `template/` as a Template Snapshot, and initializing a Target Repository is a one-time copy of that snapshot. The workspace copy also serves this repo's own sessions.
8
+ This repository's identity. It is the config repo for mattpocock/skills: it distributes project-level config (AGENTS.md behavior routing, `.opencode/docs/agents/` discipline files, `.opencode/CONTEXT.md` glossary) plus the explicitly allowed distributable skills via `.agents/skills`. The workspace also retains repo-local maintenance skills that are never distributed. The workspace content is projected into `template/` as a Template Snapshot, and initializing a Target Repository is a one-time copy of that snapshot. The workspace copy also serves this repo's own sessions.
9
9
  _Avoid_: skill distribution repo
10
10
 
11
11
  **Upstream Repository** (上游仓库):
@@ -13,27 +13,27 @@ mattpocock/skills — the source of the 26 skill bodies (skills/engineering + sk
13
13
  _Avoid_: source repo, skill origin
14
14
 
15
15
  **Proprietary Skill** (独有技能):
16
- A skill that does not exist upstream and lives only in this repo (currently ci-guard, tdd-implement, grill-to-spec, diagnose-fix, commit-check and scaffold-functional-test). Before adding a new skill, check the Upstream Repository first; only skills absent there qualify as proprietary. The issue-audit subagent is NOT a skill: it ships as a subagent + command under `.opencode/` and is distributed through the Template Snapshot without a skill directory.
16
+ A skill that does not exist upstream and lives only in this repo (currently ci-guard, tdd-implement, grill-to-spec, diagnose-fix, commit-check, scaffold-functional-test and show-me). Before adding a new skill, check the Upstream Repository first; only skills absent there qualify as proprietary. The 7 proprietary skills are classified as 5 distributable (`tdd-implement`, `diagnose-fix`, `grill-to-spec`, `scaffold-functional-test`, `show-me`) and 2 repo-local (`ci-guard`, `commit-check`). The default programming set includes 4 proprietary skills: `tdd-implement`, `diagnose-fix`, `grill-to-spec` and `show-me`; `scaffold-functional-test` is distributable but optional. Repo-local skills serve matt-skills maintenance and are never distributed. The issue-audit subagent is NOT a skill: it ships as a subagent + command under `.opencode/` and is distributed through the Template Snapshot without a skill directory.
17
17
  _Avoid_: private skill, local skill
18
18
 
19
19
  **Workspace** (工作区):
20
- The root-level working copies of the template content — `.agents/skills/` (ALL skills: upstream + proprietary, single source), `.opencode/` (issue-audit agent, explicit-skill commands), `.pi/` (pi-agent prompts: `issue-audit`), `AGENTS.md`, `CONTEXT.md`, `docs/`. Where this repo's own sessions load, modify, and test the content. The template paths mirror them: `.agents/skills/` → `template/.agents/skills/` (full 32-skill snapshot), `.opencode/commands/*.md` → `template/.opencode/commands/`, `.pi/prompts/issue-audit.md` → `template/.pi/prompts/issue-audit.md`, root-level `CONTEXT.md` and `docs/agents/` → `template/.opencode/` + `template/.pi/`. Harness-specific skill dirs `.pi/skills/` and `.opencode/skills/` are reserved for project-local custom skills (empty placeholders with `.gitkeep` + `README.md` in the template).
20
+ The root-level working copies of the template content — `.agents/skills/` (upstream plus all proprietary skills, single source), `.opencode/` (issue-audit agent, explicit-skill commands), `.pi/` (pi-agent prompts: `issue-audit`), `AGENTS.md`, `CONTEXT.md`, `docs/`. Where this repo's own sessions load, modify, and test the content. The template paths project only the distributable subset: `.agents/skills/` → `template/.agents/skills/`, `.opencode/commands/*.md` → `template/.opencode/commands/`, `.pi/prompts/issue-audit.md` → `template/.pi/prompts/issue-audit.md`, root-level `CONTEXT.md` and `docs/agents/` → `template/.opencode/` + `template/.pi/`. Harness-specific skill dirs `.pi/skills/` and `.opencode/skills/` are reserved for project-local custom skills (empty placeholders with `.gitkeep` + `README.md` in the template).
21
21
  _Avoid_: working copy, source repo
22
22
 
23
23
  **Template Snapshot** (模板快照):
24
- Everything under `template/` — the mirror of the workspace content: ALL skills under `.agents/skills/` (single source, auto-discovered by pi/codex/claude and, via convention, by opencode from the same path), harness skill dirs `.pi/skills/` + `.opencode/skills/` as empty placeholders for project custom skills, opencode commands under `.opencode/commands/`, the pi issue-audit command under `.pi/prompts/`, discipline files and glossary under `.opencode/` + `.pi/`, AGENTS.md at the top level, generated by `node scripts/build-template.js`, used to initialize other repositories. The sync direction is one-way: workspace → snapshot. `test/template-sync.test.js` guards the mirror stays in sync.
24
+ Everything under `template/` — the distributable snapshot of workspace content: only allowed skills under `.agents/skills/` (single source for user projects), harness skill dirs `.pi/skills/` + `.opencode/skills/` as empty placeholders for project custom skills, distributable opencode commands under `.opencode/commands/`, the pi issue-audit command under `.pi/prompts/`, discipline files and glossary under `.opencode/` + `.pi/`, AGENTS.md at the top level, generated by `node scripts/build-template.js`, used to initialize other repositories. Repo-local skills and commands remain workspace-only. The sync direction is one-way: workspace → snapshot. `test/template-sync.test.js` guards the mirror stays in sync.
25
25
  _Avoid_: release snapshot, published snapshot
26
26
 
27
27
  **Target Repository** (目标仓库):
28
- A repository initialized by copying `template/` into its root (`cp -r template/. <target>/`). It then loads ALL shared skills from its own `.agents/skills/` (single source, 32 skills), project-local custom skills from `.pi/skills/` / `.opencode/skills/` (if any), the explicit-skill commands from `.opencode/commands/` (opencode) and the `issue-audit` command from `.pi/prompts/` (pi) / `.opencode/commands/` (opencode), and the project-level global config from `.opencode/` + `.pi/` and `AGENTS.md`.
28
+ A repository initialized by copying `template/` into its root (`cp -r template/. <target>/`). It then loads all distributable shared skills from its own `.agents/skills/`, project-local custom skills from `.pi/skills/` / `.opencode/skills/` (if any), the distributable commands from `.opencode/commands/` (opencode) and the `issue-audit` command from `.pi/prompts/` (pi) / `.opencode/commands/` (opencode), and the project-level global config from `.opencode/` + `.pi/` and `AGENTS.md`. Repo-local matt-skills maintenance skills are not part of a Target Repository by default.
29
29
  _Avoid_: inheriting repo, child repo
30
30
 
31
31
  **Initialize** (初始化):
32
- The one-time action of setting up a Target Repository: copying `template/` into its root (`cp -r template/. <target>/`). All 32 skills are already included via `template/.agents/skills/`; no separate upstream fetch is needed. Copying, not inheriting — no runtime relationship survives the copy.
32
+ The one-time action of setting up a Target Repository: copying `template/` into its root (`cp -r template/. <target>/`). All distributable skills are already included via `template/.agents/skills/`; no separate upstream fetch is needed. Repo-local skills are intentionally absent. Copying, not inheriting — no runtime relationship survives the copy.
33
33
  _Avoid_: inherit, bootstrap
34
34
 
35
35
  **Sync** (同步):
36
- `matt-skills sync` 同步 Target Repository 的模板与技能:`--dry-run` 仅对比不写盘(`check`,`--json` 可解析,有差异 `exit 1`),默认安全增量(`AGENTS.md` 有定制如 `tdd-implement` 则跳过,`.agents/skills` 按默认范围 26 `rm+cp` 覆盖但不删多余技能,`template/.opencode/.pi` 增量 `add/update`,旧镜像 `.pi/skills` + `.opencode/skills` 中残留的共享技能自动清理但保留项目自定义)、`--all` 仅更新同名技能内容(存在则覆盖,不存在则新增)并更新 `AGENTS.md`(不跳过定制),不删多余技能。`update` 已合并到 `sync` 并删除。
36
+ `matt-skills sync` 同步 Target Repository 的模板与技能:`--dry-run` 仅对比不写盘(`check`,`--json` 可解析,有差异 `exit 1`),默认安全增量(`AGENTS.md` 有定制如 `tdd-implement` 则跳过,`.agents/skills` 按默认 programming 范围覆盖但不删多余技能,`template/.opencode/.pi` 增量 `add/update`,旧镜像 `.pi/skills` + `.opencode/skills` 中残留的共享技能自动清理但保留项目自定义)、`--all` 仅更新同名可分发技能内容(存在则覆盖,不存在则新增)并更新 `AGENTS.md`(不跳过定制),不删多余技能。Repo-local skill 永远不新增、不覆盖、不删除,只在发现历史副本时提示保留。`update` 已合并到 `sync` 并删除。
37
37
  _Avoid_: update, force sync
38
38
 
39
39
  ## Skill Design
@@ -11,7 +11,7 @@ Every **Long-Horizon Skill** must carry a positive **Turn Continuity** rule of i
11
11
  - It must be **self-contained** — the skill cannot rely on the harness `/goal` line, because no `/goal` exists when the user does not activate one.
12
12
  - Every stage ends on a checkable exit condition; reaching it is the only thing that ends the turn.
13
13
  - A sub-step going green (e.g. one seam) is not a stage exit — a stage ends only when all of its seams are complete. Progress output does not itself end the turn: output, then keep executing until one of the three endpoints (compliance checkpoint, external blocker, stage exit) is reached.
14
- - Canonical example: the 回合连续性 rule in [`.agents/skills/tdd-implement/references/stages.md`](.agents/skills/tdd-implement/references/stages.md) stage ③.
14
+ - Canonical example: the 回合连续性 rule in [`.agents/skills/tdd-implement/references/stages.md`](.agents/skills/tdd-implement/references/stages.md), especially the Red-Green continuity section.
15
15
 
16
16
  ## Rule 2 — Model Selection
17
17
 
@@ -31,7 +31,7 @@ Every skill that touches git must preserve history after `BASE_HEAD`: history ma
31
31
 
32
32
  To achieve "directory clean" (`git status` clean) the skill may only delete its own temporary artifacts (`[DEBUG-...]`, one-off scripts, untracked probe files) — it must never use git-level destructive commands to reach a clean state. The following are forbidden without explicit user confirmation: `git reset --hard`, `git checkout .`, `git clean -fd`, `git stash push --include-untracked` (use `--keep-index` instead and `pop` with verification), `git push --force`, `git rebase -i` and any `reset`/`checkout` that moves `HEAD` backward.
33
33
 
34
- Canonical enforcement: [`tdd-implement/references/stages.md`](.agents/skills/tdd-implement/references/stages.md) stage ③/⑥/⑦/A2-A4 Git 安全红线 and [`commit-check/SKILL.md`](.agents/skills/commit-check/SKILL.md) 目录卫生.
34
+ Canonical enforcement: [`tdd-implement/references/stages.md`](.agents/skills/tdd-implement/references/stages.md) checks `BASE_HEAD` at every delivery-stage exit and before the Finalize commit; multi-issue enforcement lives in [`tdd-implement/references/orchestration.md`](.agents/skills/tdd-implement/references/orchestration.md) A2-A4. Repository-local commit gating remains a workspace-only concern and is not part of the distributable template.
35
35
  ## Long-horizon skills inventory
36
36
 
37
- Skills currently classified as Long-Horizon, to be evolved against these rules as they are touched: `tdd-implement` (fixed), `diagnose-fix` (fixed — new orchestration skill for diagnosis + TDD fix, carries its own Turn Continuity rule), `diagnosing-bugs`, `improve-codebase-architecture`, `wayfinder`, `grill-to-spec`, `to-spec`. Backfilling existing skill texts is out of scope for now — these rules bind new and edited skills going forward.
37
+ Skills currently classified as Long-Horizon, to be evolved against these rules as they are touched: `tdd-implement` (fixed), `diagnose-fix` (fixed — orchestration for diagnosis + TDD fix), `diagnosing-bugs`, `improve-codebase-architecture`, `wayfinder`, `grill-to-spec` (fixed — carries its own Turn Continuity rule), `to-spec`. Backfilling existing skill texts is out of scope for now — these rules bind new and edited skills going forward.
@@ -1,4 +1,4 @@
1
1
  # 项目技能(opencode)
2
2
 
3
3
  此目录用于存放项目自定义技能(project-local skills)。
4
- 共享技能(上游 + 独有)统一在 `.agents/skills/`。
4
+ 共享技能统一在 `.agents/skills/`。