@captain_z/zsk-skills 0.1.0

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 (55) hide show
  1. package/README.md +263 -0
  2. package/bundles.yaml +104 -0
  3. package/design-handoff/.gitkeep +0 -0
  4. package/design-handoff/figma-to-code/SKILL.md +265 -0
  5. package/design-handoff/ue-mcp/SKILL.md +184 -0
  6. package/frontend/.gitkeep +0 -0
  7. package/frontend/a11y-web/SKILL.md +169 -0
  8. package/frontend/api-contract-ts/SKILL.md +275 -0
  9. package/frontend/css-bem/SKILL.md +268 -0
  10. package/frontend/design-frontend/SKILL.md +163 -0
  11. package/frontend/dor-dod-frontend/SKILL.md +114 -0
  12. package/frontend/feature-tasks-frontend/SKILL.md +246 -0
  13. package/frontend/i18n/SKILL.md +296 -0
  14. package/frontend/nfr-web/SKILL.md +258 -0
  15. package/frontend/performance-web/SKILL.md +299 -0
  16. package/frontend/react-components/SKILL.md +211 -0
  17. package/frontend/react-naming/SKILL.md +224 -0
  18. package/frontend/review-frontend/SKILL.md +126 -0
  19. package/frontend/security-web/SKILL.md +286 -0
  20. package/frontend/spec-frontend/SKILL.md +141 -0
  21. package/frontend/testing-web/SKILL.md +252 -0
  22. package/frontend/typescript/SKILL.md +219 -0
  23. package/meta/.gitkeep +0 -0
  24. package/meta/philosophy/SKILL.md +221 -0
  25. package/package.json +24 -0
  26. package/quality/.gitkeep +0 -0
  27. package/quality/a11y-principles/SKILL.md +155 -0
  28. package/quality/code-hygiene/SKILL.md +126 -0
  29. package/quality/release/SKILL.md +209 -0
  30. package/quality/security-owasp/SKILL.md +157 -0
  31. package/quality/testing-pyramid/SKILL.md +173 -0
  32. package/sdlc/.gitkeep +0 -0
  33. package/sdlc/archive/SKILL.md +267 -0
  34. package/sdlc/bugfix/SKILL.md +181 -0
  35. package/sdlc/bugfix-tasks/SKILL.md +232 -0
  36. package/sdlc/coding/SKILL.md +177 -0
  37. package/sdlc/design/SKILL.md +299 -0
  38. package/sdlc/dor-dod/SKILL.md +120 -0
  39. package/sdlc/feature/SKILL.md +162 -0
  40. package/sdlc/proposal/SKILL.md +271 -0
  41. package/sdlc/refactor/SKILL.md +220 -0
  42. package/sdlc/refactor-tasks/SKILL.md +265 -0
  43. package/sdlc/reviewing/SKILL.md +197 -0
  44. package/sdlc/spec/SKILL.md +235 -0
  45. package/sdlc/task/SKILL.md +116 -0
  46. package/sdlc/task-evidence/SKILL.md +178 -0
  47. package/sdlc/task-structure/SKILL.md +153 -0
  48. package/sdlc/task-tracking/SKILL.md +192 -0
  49. package/sdlc/verify/SKILL.md +181 -0
  50. package/system/.gitkeep +0 -0
  51. package/system/adr/SKILL.md +169 -0
  52. package/system/architecture/SKILL.md +182 -0
  53. package/system/glossary/SKILL.md +141 -0
  54. package/system/nfr-baseline/SKILL.md +156 -0
  55. package/system/project-constraints-template/SKILL.md +241 -0
@@ -0,0 +1,267 @@
1
+ ---
2
+ name: zsk:archive
3
+ description: Iteration closing / archive — move historical snapshots to
4
+ docs/{module}/archive/, write postmortem (P0/P1 mandatory), update changelog
5
+ (SemVer + Keep a Changelog), flush ADRs, update SYSTEM-SPEC if cross-module
6
+ constraints emerged, feed back to standards/system docs. Stage 7 of the
7
+ 7-stage SDLC.
8
+ category: stage
9
+ domain: sdlc
10
+ tier: core
11
+ stage: 7
12
+ variants:
13
+ - feature
14
+ - bugfix
15
+ - refactor
16
+ related:
17
+ - ../verify/SKILL.md
18
+ - ../proposal/SKILL.md
19
+ - ../../system/adr/SKILL.md
20
+ - ../../quality/release/SKILL.md
21
+ triggers:
22
+ - archive iteration
23
+ - postmortem
24
+ - changelog
25
+ - ADR flush
26
+ - blameless
27
+ - retrospective
28
+ - knowledge capture
29
+ - close the loop
30
+ ---
31
+
32
+ # Stage 7: Archive
33
+
34
+ > **阶段定位**:归档 / 知识沉淀 - Archive & Knowledge Capture
35
+ > **回答的问题**:这一轮做完了,**什么知识要留下**来让下一轮能吃到?文档怎么收尾、Postmortem 怎么写、系统规约是否要更新?
36
+ > **参考规范**:Blameless Postmortem(Google SRE)、ADR(Michael Nygard)、SemVer、Keep a Changelog
37
+ > **吸收硬原则**:
38
+ > - **归档即沉淀**:如果归档只是"挪文件",价值为零。真正的价值是**把个案提炼成通用约束**(ADR / SYSTEM-SPEC / standards/ 更新)。
39
+ > - **Blameless**:Postmortem 对事不对人,目标是系统改进,不是追责
40
+
41
+ ## Skill 映射
42
+
43
+ | 场景 | Primary Skill |
44
+ | --- | --- |
45
+ | 归档流程 | `zsk:archive`(本 skill) |
46
+ | 知识图 | `graphify` |
47
+ | 写作提炼 | `learn` |
48
+ | 发布收尾 | `document-release` |
49
+ | 里程碑复盘 | `retro` |
50
+
51
+ ## 变更类型差异
52
+
53
+ | 类型 | Archive 侧重 |
54
+ | --- | --- |
55
+ | **Feature** | Changelog `Added` + ADR 更新 + 模块文档封存 + 反哺上游 `standards/*` |
56
+ | **Bugfix** | **Postmortem(P0 / P1 强制)** + Changelog `Fixed` + 归档复现材料 + 回归测试保留 |
57
+ | **Refactor** | Changelog `Changed` / `Removed` + ADR 更新(为什么这样改)+ 性能对照数据归档 |
58
+
59
+ ## 1. 模块文档归档
60
+
61
+ ### 触发条件
62
+
63
+ 模块本轮迭代完成(合并主干 + 发布)后:
64
+
65
+ - 本轮的 `proposal.md` / `spec.md` / `design.md` / `tasks.md` **保留在 `docs/{module}/`**(不删除、不移动)
66
+ - 历史快照(过去版本、已废弃的设计)移到 `docs/{module}/archive/{YYYY-MM-DD}-{标签}/`
67
+
68
+ ### 目录结构
69
+
70
+ ```text
71
+ docs/{module}/
72
+ ├── proposal.md # 当前有效版本
73
+ ├── spec.md # 当前有效版本
74
+ ├── design.md # 当前有效版本
75
+ ├── tasks.md # 当前有效版本
76
+ └── archive/
77
+ ├── 2026-04-19-v1-discarded-design/
78
+ │ ├── design.md # 废弃的旧设计(保留为历史)
79
+ │ └── README.md # 为什么废弃
80
+ └── 2026-04-19-postmortem-bug-123/
81
+ ├── postmortem.md
82
+ ├── repro-before.mov
83
+ └── repro-after.mov
84
+ ```
85
+
86
+ ### 归档不是"清理"
87
+
88
+ - **不得**删除当前有效文档(即便看起来"过期")
89
+ - **不得**把主文档移到 `archive/`(让 AI 与人继续读主目录)
90
+ - 归档只做两件事:
91
+ 1. 历史快照挪到 `archive/{日期}-{标签}/`
92
+ 2. 本轮沉淀出的通用知识更新到 `SYSTEM-SPEC.md` / `system/` / `standards/`
93
+
94
+ ## 2. Postmortem(P0 / P1 Bugfix 强制)
95
+
96
+ ### 触发条件
97
+
98
+ - P0:生产事故、数据损坏、安全事件
99
+ - P1:核心流程不可用、影响多用户
100
+
101
+ **Blameless 原则**:不针对个人,针对系统 / 流程 / 工具。
102
+
103
+ ### 模板
104
+
105
+ ```md
106
+ # Postmortem: {bug 简述}
107
+
108
+ > 严重度:P0 / P1
109
+ > 模块:{module}
110
+ > 相关 Issue:#{id}
111
+ > 作者:{姓名} | 日期:{YYYY-MM-DD}
112
+ > Blameless 声明:本文档对事不对人,用于系统改进
113
+
114
+ ## 时间线
115
+
116
+ | 时间 | 事件 |
117
+ | --- | --- |
118
+ | {t0} | 引入(commit / PR) |
119
+ | {t1} | 发现(谁、如何) |
120
+ | {t2} | 影响开始 |
121
+ | {t3} | 定位根因 |
122
+ | {t4} | 修复合并 |
123
+ | {t5} | 影响结束 |
124
+
125
+ ## 根因(与 `design.md` RCA 一致)
126
+
127
+ - 直接原因:...
128
+ - 深层原因(5 Whys):
129
+ 1. Why 1:...
130
+ 2. Why 2:...
131
+ 3. Why 3:...
132
+ 4. Why 4:...
133
+ 5. Why 5:...(系统性根因)
134
+
135
+ ## 影响范围
136
+
137
+ - 用户:{数量 / 比例}
138
+ - 业务:{功能 / 流程}
139
+ - 数据:{是否有损坏 / 污染}
140
+ - 时长:{开始 → 结束}
141
+
142
+ ## 做对的地方(What went well)
143
+ ## 做得不好的地方(What went wrong)
144
+
145
+ ## 检测与响应效率
146
+
147
+ | 指标 | 值 | 目标 | 评估 |
148
+ | --- | --- | --- | --- |
149
+ | Time to Detect (TTD) | {min} | < 5min | ✅ / ❌ |
150
+ | Time to Mitigate (TTM) | {min} | < 30min | ✅ / ❌ |
151
+ | Time to Resolve (TTR) | {min} | < 4h(P0) | ✅ / ❌ |
152
+
153
+ ## 行动项(Action Items)
154
+
155
+ | # | 行动 | 类别 | 负责人 | 期限 | 状态 |
156
+ | --- | --- | --- | --- | --- | --- |
157
+
158
+ ## 知识沉淀(供其他模块复用)
159
+
160
+ - 新约束:{是否更新到 SYSTEM-SPEC.md?}
161
+ - 新模板:{是否更新到 standards/*?}
162
+ - 新 ADR:{链接}
163
+ ```
164
+
165
+ ## 3. Changelog 纪律
166
+
167
+ 遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/) + SemVer(详见 [`quality/release`](../../quality/release/SKILL.md))。
168
+
169
+ ```md
170
+ ## [1.2.0] - 2026-04-19
171
+
172
+ ### Added
173
+ - {新功能描述}(#PR / Refs Spec FR-x)
174
+
175
+ ### Changed
176
+ - {行为修改或重构}
177
+
178
+ ### Deprecated
179
+ - {即将移除的 API / 功能}
180
+
181
+ ### Removed
182
+ - {已移除的内容}
183
+
184
+ ### Fixed
185
+ - {bug 修复}(#issue / Refs Postmortem)
186
+
187
+ ### Security
188
+ - {安全修复 / 依赖升级}
189
+ ```
190
+
191
+ **硬规则**:
192
+
193
+ - **Refactor**:只能进 `Changed` / `Removed`,**禁止**写 `Added` / `Fixed`(否则违反"行为不变")
194
+ - **Bugfix**:必须有 `Fixed` 条目,P0 / P1 还要链接 Postmortem
195
+ - **Feature**:`Added` 条目引用 Spec 的 FR 编号(追溯锚)
196
+
197
+ ## 4. SYSTEM-SPEC 更新约定
198
+
199
+ **何时更新 `SYSTEM-SPEC.md`**(工程级宪法):
200
+
201
+ - 本轮迭代发现新的**跨模块约束**
202
+ - 本轮迭代引入新的**技术选型**(如禁用 X 库、强制 Y 库)
203
+ - Postmortem 的 Action Item 指向系统级改进
204
+ - ADR 通过后,其摘要进 SYSTEM-SPEC
205
+
206
+ **怎么更新**:
207
+
208
+ 1. 打开 `SYSTEM-SPEC.md`,在相关章节追加条目
209
+ 2. 链接对应的 ADR 路径(`docs/system/adrs/ADR-NNN-{title}.md`)
210
+ 3. 在本阶段归档清单里勾选"SYSTEM-SPEC 已更新"
211
+ 4. 同步更新 `standards/` 下相关的落地文档(如果是执行规范级)
212
+
213
+ ## 5. ADR 归档
214
+
215
+ 本轮迭代产生的 ADR(在 `design.md` 中记录的)→ 正式产出到:
216
+
217
+ ```text
218
+ docs/system/adrs/ADR-{NNN}-{kebab-title}.md
219
+ ```
220
+
221
+ 编号规则:全工程递增,不按模块划分(便于引用)。模板见 [`zsk:adr`](../../system/adr/SKILL.md)。
222
+
223
+ ## 6. 知识图沉淀(可选,大改动推荐)
224
+
225
+ 使用 `graphify` skill:
226
+ - 把本轮的代码 / 文档 / 决策映射为**节点 + 边**
227
+ - 发现跨模块的**重复模式**(候选抽象)
228
+ - 输出 HTML + JSON + 审计报告到 `docs/{module}/archive/{日期}-graphify/`
229
+
230
+ 适用场景:
231
+ - 涉及 3+ 模块的改动
232
+ - 引入新架构模式
233
+ - 发现了值得复用的设计(可提议进 `standards/` 或 `system/`)
234
+
235
+ ## 7. 反哺上游(把个案变通用)
236
+
237
+ 本轮从个案**向上沉淀**的三个方向:
238
+
239
+ | 方向 | 目标文件 | 示例 |
240
+ | --- | --- | --- |
241
+ | **standards/** 更新 | `quality/*` / `frontend/*` | 新发现的测试 / a11y / 性能技巧 |
242
+ | **system/** 更新 | `system/adrs/` + `SYSTEM-SPEC.md` | 架构决策 / 跨模块约束 |
243
+ | **templates/** 更新 | 各领域模板 | 新发现的可复用模板 |
244
+
245
+ **原则**:如果一个"个案经验"在下一轮中大概率还会再遇到 → 立刻上沉。
246
+
247
+ ## 8. 发布同步
248
+
249
+ 使用 `document-release` skill:
250
+ - 更新 `README.md` / `ARCHITECTURE.md` / `CLAUDE.md` / `CONTRIBUTING.md`(若相关)
251
+ - 校正 `CHANGELOG.md`
252
+ - 清理已完成的 TODO
253
+
254
+ ## 质量门禁(关闭本轮迭代前)
255
+
256
+ - [ ] Changelog 更新到位且符合规约
257
+ - [ ] P0 / P1 Bugfix → Postmortem 完成且入 `docs/{module}/archive/`
258
+ - [ ] Postmortem 的 Action Items 全部有负责人 + 期限
259
+ - [ ] ADR 已产出(若有架构决策)且进 `docs/system/adrs/`
260
+ - [ ] SYSTEM-SPEC.md 已更新(若有跨模块约束)
261
+ - [ ] 本轮沉淀出的通用知识已反哺到 `standards/` / `system/`
262
+ - [ ] 历史快照(不再生效的旧设计)已进 `archive/{日期}-{标签}/`
263
+ - [ ] 当前有效文档**保留在主目录**(proposal / spec / design / tasks 不挪动)
264
+ - [ ] 知识图(大改动可选)已归档
265
+
266
+ > **前序阶段**:`zsk:verify`
267
+ > **下一轮循环**:新的 `zsk:proposal` 启动
@@ -0,0 +1,181 @@
1
+ ---
2
+ name: zsk:bugfix
3
+ description: Bugfix end-to-end orchestration — triage → reproduce → RCA (5 Whys
4
+ with confidence questions) → TDD fix (red first) → regression coverage →
5
+ postmortem (P0/P1 mandatory). Enforces Superpowers' bug confidence questioning
6
+ discipline.
7
+ category: workflow
8
+ domain: sdlc
9
+ tier: core
10
+ change_type: bugfix
11
+ related:
12
+ - ../proposal/SKILL.md
13
+ - ../spec/SKILL.md
14
+ - ../design/SKILL.md
15
+ - ../coding/SKILL.md
16
+ - ../bugfix-tasks/SKILL.md
17
+ - ../archive/SKILL.md
18
+ - ../../quality/release/SKILL.md
19
+ triggers:
20
+ - bug fix workflow
21
+ - fix defect
22
+ - RCA
23
+ - 5 whys
24
+ - bug confidence questions
25
+ - hotfix
26
+ - postmortem workflow
27
+ ---
28
+
29
+ # Workflow: Bugfix(Bug 修复端到端)
30
+
31
+ > **定位**:在 7 阶段基础上,针对"**修复已存在的错误行为**"编排工作流
32
+ > **阶段映射**:proposal(Bug 报告)→ spec(Expected vs Actual)→ design(RCA + 修复)→ coding(TDD 红绿)→ reviewing(审 RCA 与回归)→ verify(证据链)→ archive(Postmortem)
33
+ > **吸收硬原则**:Bug 置信度质疑(Superpowers `systematic-debugging`)
34
+
35
+ ## 核心纪律
36
+
37
+ **动手修 bug 前先问三个问题**:
38
+
39
+ 1. 这个 bug **确实存在**吗?(有复现证据吗)
40
+ 2. 这个原因**真的是根因**吗?(还是上游问题的表现)
41
+ 3. 我的修复**真的会生效**吗?(有没有测试能断言)
42
+
43
+ 三问都有答案再动手。
44
+
45
+ ## 总览
46
+
47
+ ```text
48
+ [Triage] [Reproduce] [RCA] [TDD Fix] [Regression] [Ship] [Postmortem]
49
+ Proposal → Spec → Design → Coding → Verify → Ship → Archive
50
+ Bug报告 复现+期望 5 Whys Red→Green 相邻回归+证据 Hotfix? Blameless
51
+ ```
52
+
53
+ ## 分步流程
54
+
55
+ ### Step 1:Triage & Proposal — Bug 报告与分级
56
+
57
+ **Primary Skill**: `zsk:proposal`(Bugfix 模板) · GSD: Capture
58
+
59
+ **Addendum**:
60
+ - 按 [`zsk:proposal`](../proposal/SKILL.md) 的 Bugfix 型模板
61
+ - 严重度 P0–P3 明确
62
+ - 是否 Hotfix 决策在此做出(见 [`quality:release`](../../quality/release/SKILL.md))
63
+
64
+ **Exit**: 严重度 / 影响范围 / 复现步骤明确 · 证据完整(截图 / 录屏 / 日志 / trace)
65
+
66
+ ---
67
+
68
+ ### Step 2:Reproduce & Spec — 复现并明确期望
69
+
70
+ **Primary Skill**: `superpowers:systematic-debugging`(先质疑 bug 存在)· `hunt` · `investigate` · 按栈选浏览器/环境复现工具 · GSD: Clarify
71
+
72
+ **Addendum**:
73
+ - 按 [`zsk:spec`](../spec/SKILL.md) 的 Bugfix 型模板
74
+ - **最小复现用例(MCVE)**
75
+ - Expected vs Actual 行为矩阵
76
+ - BDD 场景描述
77
+ - 回归测试覆盖范围声明
78
+
79
+ **Output**: `docs/{module}/spec.md`(Bugfix 规格)· 最小复现脚本
80
+
81
+ **Exit**: 能稳定复现 · Expected vs Actual 清晰 · Bug 存在性通过置信度质疑
82
+
83
+ ---
84
+
85
+ ### Step 3:RCA & Design — 根因分析与修复方案
86
+
87
+ **Primary Skill**: `superpowers:systematic-debugging` · `debugging` / `investigate` · `codex`(独立二意见)· `graphify`(查调用链)· GSD: Reflect
88
+
89
+ **Addendum**:
90
+ - 按 [`zsk:design`](../design/SKILL.md) 的 Bugfix 型模板
91
+ - **5 Whys** 根因分析
92
+ - 修复点最小化(不借机重构)
93
+ - 影响面评估(直接 / 上游 / 下游)
94
+ - 防回归方案
95
+ - **通过三问置信度质疑**(bug 存在?RCA 是真根因?修复真的消除?)
96
+
97
+ **Exit**: 5 Whys 到达根因(不止步于表层)· 修复范围最小 · 有测试能断言修复有效 · 置信度三问全部回答
98
+
99
+ ---
100
+
101
+ ### Step 4:Coding — TDD Fix
102
+
103
+ **Primary Skill**: `superpowers:test-driven-development`(强制)· `superpowers:executing-plans` · `zsk:coding`
104
+
105
+ **Addendum**: 按 [`zsk:bugfix-tasks`](../bugfix-tasks/SKILL.md) 模板
106
+
107
+ - **Red**:先写一个**必然失败**的测试覆盖 bug(用 Step 2 的最小复现)
108
+ - **Green**:按 Design 的 RCA 修复,让测试变绿
109
+ - **Refactor**:清理代码(不借机扩大)
110
+ - 所有现有测试仍全绿
111
+
112
+ **Exit**: 先红后绿的 commit 证据清晰 · 现有测试仍全绿 · 修复最小化
113
+
114
+ ---
115
+
116
+ ### Step 5:Reviewing — 审 RCA 与回归
117
+
118
+ **Primary Skill**: `zsk:reviewing` · `codex review` / `merge-review`
119
+
120
+ **Addendum**:
121
+ - PR 描述包含:Bug 链接 / RCA 摘要 / 修复点 / 回归覆盖范围
122
+ - Reviewer 必须确认:
123
+ - RCA 合理(非"凑巧 work")
124
+ - 修复最小化(无借机重构)
125
+ - 新增测试能断言 bug 不会回归(可 checkout 修复前验证"确实红")
126
+ - 高风险 bug(P0 / P1)强制第二 Reviewer
127
+
128
+ **Exit**: Reviewer Approve · 所有 `blocking:` 评论 resolved
129
+
130
+ ---
131
+
132
+ ### Step 6:Verify — 回归证据链
133
+
134
+ **Primary Skill**: `superpowers:verification-before-completion` · `zsk:verify` · `qa`
135
+
136
+ **Addendum**:
137
+ - 原复现步骤走通(截图 / 录屏对照 —— before/after)
138
+ - 相邻场景测试(状态矩阵邻项)
139
+ - 边界条件测试
140
+ - 相关质量维度核对(前端:a11y / i18n / 性能;后端:幂等 / 并发 / 权限)
141
+ - **证据归档**:log 前后对照、测试报告、复现步骤回归
142
+ - **P0 / P1 → Hotfix 流程**(见 [`quality:release`](../../quality/release/SKILL.md))
143
+ - **P2 / P3 → 常规发布**
144
+
145
+ **Output**: 修复代码 + 回归测试 · 证据链(前后对照截图 / 报告)
146
+
147
+ **Exit**: 原 bug 不再复现 · 所有测试全绿 · canary 无新异常
148
+
149
+ ---
150
+
151
+ ### Step 7:Archive — Postmortem(P0 / P1 必做)
152
+
153
+ **Primary Skill**: `zsk:archive` · `retro`(团队复盘)· `graphify`(识别系统性风险)· `document-release`
154
+
155
+ **Addendum(Blameless)**:
156
+ - 按 [`zsk:archive`](../archive/SKILL.md) 的 Postmortem 模板
157
+ - 归档位置:`docs/{module}/archive/{YYYY-MM-DD}-postmortem-{id}/`
158
+ - Changelog 更新 **Fixed** 章节,链接 Postmortem
159
+
160
+ 必含:时间线 · 根因(与 RCA 一致)· 影响范围(用户 / 业务 / 数据)· 做对的 · 做得不好的 · **行动项**(可执行 + 负责人 + 期限)
161
+
162
+ **原则**:对事不对人 · 聚焦系统性改进 · 行动项必须跟进到关闭
163
+
164
+ **Exit**: Postmortem 已归档 · 行动项已录入后续迭代 · 预防性改进(monitor / 测试 / 文档)已落地
165
+
166
+ ## Skip 规则
167
+
168
+ - P3 typo / 样式错别字:可跳过 Proposal / Design,直接测试 + 修复
169
+ - P2 以上:不得跳过 RCA(不允许"先改改试试")
170
+ - P0 / P1:**必做 Postmortem**,不允许跳过
171
+
172
+ ## 质量门禁(端到端)
173
+
174
+ - [ ] Bug 置信度三问全部回答
175
+ - [ ] 5 Whys 到达真根因
176
+ - [ ] TDD 流程严格执行(先红后绿)
177
+ - [ ] 回归测试覆盖本 bug + 相邻场景
178
+ - [ ] 修复最小化(无借机重构)
179
+ - [ ] 证据链完整(log / 截图 / 报告)
180
+ - [ ] Changelog Fixed 条目更新
181
+ - [ ] P0 / P1 Postmortem 归档
@@ -0,0 +1,232 @@
1
+ ---
2
+ name: zsk:bugfix-tasks
3
+ description: Bugfix task template with TDD enforcement — Step 1 Red (write
4
+ failing reproduction test), Step 2 Green (minimal fix, no opportunistic
5
+ refactor), Step 3 Regression (adjacent scenarios), Step 4 Evidence
6
+ (before/after reproduction). Requires Superpowers' 3 confidence questions
7
+ before starting.
8
+ category: resource
9
+ domain: sdlc
10
+ tier: core
11
+ change_type: bugfix
12
+ related:
13
+ - ../bugfix/SKILL.md
14
+ - ../dor-dod/SKILL.md
15
+ - ../task-evidence/SKILL.md
16
+ - ../task-tracking/SKILL.md
17
+ triggers:
18
+ - bugfix task template
19
+ - TDD bug fix
20
+ - red green regression
21
+ - bug confidence questions
22
+ ---
23
+
24
+ # Bugfix Tasks — TDD 驱动的 Bug 修复任务模板
25
+
26
+ > **用途**:Bug 修复的**任务列表模板**,直接复制到 `docs/{module}/tasks.md`
27
+ > **适用**:修复已存在的错误行为
28
+ > **硬原则**:**TDD 强制** — 先写必然失败的复现测试(Red),再修(Green),再回归验证
29
+
30
+ ## 核心纪律
31
+
32
+ ### Superpowers 置信度质疑(修 bug 前必问三问)
33
+
34
+ 1. **这个 bug 确实存在吗**?(有复现证据吗)
35
+ 2. **这个原因真的是根因吗**?(还是上游问题的表现)
36
+ 3. **我的修复真的会生效吗**?(有没有测试能断言)
37
+
38
+ 三问都有答案再动手。
39
+
40
+ ### TDD 硬流程
41
+
42
+ ```text
43
+ Red(复现) → Green(修复) → Regression(回归)
44
+ 必然失败 最小修复 相邻场景 + 边界
45
+ 的测试 (不借机重构) + 相关质量维度
46
+ ```
47
+
48
+ ## 完整模板(复制到 `docs/{module}/tasks.md`)
49
+
50
+ ```md
51
+ # Bugfix Tasks: {简要描述}
52
+
53
+ > 变更类型:Bugfix
54
+ > 严重度:P0 / P1 / P2 / P3
55
+ > 关联文档:proposal.md(Bug 报告)/ spec.md(Expected vs Actual)/ design.md(RCA)
56
+ > 责任人:@{handle}
57
+ > 日期:{YYYY-MM-DD}
58
+ > 相关 Issue / Incident:#{id}
59
+
60
+ ## 任务概述
61
+
62
+ {一句话描述 bug 现象 + 根因摘要,引用 design.md 的 RCA}
63
+
64
+ ## 置信度三问
65
+
66
+ | 问题 | 答案 | 证据 |
67
+ | --- | --- | --- |
68
+ | bug 确实存在? | ✅ / ❌ | {复现录屏链接} |
69
+ | RCA 是真根因? | ✅ / ❌ | {5 Whys 推理链接 → design.md} |
70
+ | 修复点真的能消除? | ✅ / ❌ | {测试用例能断言} |
71
+
72
+ 三项全 ✅ 方可进入执行。
73
+
74
+ ## DoR(启动前门禁)
75
+
76
+ 见 `zsk:dor-dod` 的 **通用 + Bugfix 专用** 清单。
77
+
78
+ - [ ] 最小复现用例(MCVE)已捕获
79
+ - [ ] 严重度明确
80
+ - [ ] RCA(5 Whys)到达系统性根因(design.md)
81
+ - [ ] 是否 Hotfix 已决策
82
+
83
+ ---
84
+
85
+ ## TDD 驱动修复流程
86
+
87
+ ### Step 1:复现 bug(Red)
88
+
89
+ 状态:`TODO`
90
+ 负责人:@{handle}
91
+ 覆盖 FR:{受影响的 FR 编号,引自 spec.md 的 "受影响契约项"}
92
+
93
+ 子任务:
94
+ - [ ] 1.1 最小复现用例(MCVE)代码化(从 proposal.md 的复现步骤转成可执行)
95
+ - [ ] 1.2 写一个**必然失败**的测试覆盖这个 bug
96
+ - [ ] 1.3 运行测试 → 确认红(**不是语法错误**,是断言失败)
97
+ - [ ] 1.4 commit:`test(scope): add failing test for bug #{id}`
98
+
99
+ 交付物:
100
+ - 复现测试代码(单独 commit)
101
+ - 失败输出截图 / CI 链接
102
+
103
+ 验证:
104
+ - 新增测试能在 `git checkout HEAD^` 后仍然失败(真的在测 bug)
105
+
106
+ ---
107
+
108
+ ### Step 2:修复(Green)
109
+
110
+ 状态:`TODO`
111
+ 负责人:@{handle}
112
+ 覆盖 FR:{受影响的 FR 编号}
113
+
114
+ 子任务:
115
+ - [ ] 2.1 按 design.md 的 RCA 修改代码(**最小改动**,不借机重构)
116
+ - [ ] 2.2 运行 Step 1 的测试 → 变绿
117
+ - [ ] 2.3 运行所有已有测试 → 全绿(无回归)
118
+ - [ ] 2.4 commit:`fix(scope): {bug 简述} (#{id})`
119
+
120
+ 交付物:
121
+ - 修复代码(独立 commit 与 Step 1 分开)
122
+ - 测试全绿输出 / CI 链接
123
+
124
+ 验证:
125
+ - `git diff HEAD~2` 能看到"先加失败测试再修"的 commit 序列
126
+
127
+ ---
128
+
129
+ ### Step 3:回归验证(Regression)
130
+
131
+ 状态:`TODO`
132
+ 负责人:@{handle}
133
+ 覆盖 FR:{相关 FR / NFR 编号}
134
+
135
+ 子任务:
136
+ - [ ] 3.1 相邻场景测试(状态矩阵邻项)
137
+ - [ ] 3.2 边界条件测试(空 / 极值 / 异常输入)
138
+ - [ ] 3.3 相关质量维度未受影响(前端:a11y / i18n / 视觉;后端:幂等 / 并发 / 权限)
139
+ - [ ] 3.4 性能未回退(若 bug 涉及性能路径)
140
+
141
+ 交付物:
142
+ - 回归测试用例(新增 / 更新)
143
+ - 回归运行报告
144
+
145
+ 验证:
146
+ - 回归套件 100% 绿
147
+
148
+ ---
149
+
150
+ ### Step 4:证据归档(硬规则)
151
+
152
+ 状态:`TODO`
153
+ 负责人:@{handle}
154
+ 覆盖 FR:兜底 —— 证据链完整
155
+
156
+ 子任务:
157
+ - [ ] 4.1 原复现步骤走通截图 / 录屏(对照 before 录屏)
158
+ - [ ] 4.2 回归测试报告链接(含新增用例)
159
+ - [ ] 4.3 log / trace 前后对照(如适用)
160
+ - [ ] 4.4 AC 勾选(若 spec.md 有 bug 专用 AC)
161
+
162
+ 交付物:
163
+ - 证据文件归档到 `docs/{module}/archive/{YYYY-MM-DD}-bug-{id}/`
164
+ - 填写 `zsk:task-evidence` 的 **复现对照表** + **校验记录**
165
+
166
+ 验证:
167
+ - 证据链接可点开、可追溯
168
+
169
+ ---
170
+
171
+ ## 发布决策(在 verify 阶段执行,此处仅登记)
172
+
173
+ | 严重度 | 流程 |
174
+ | --- | --- |
175
+ | P0 / P1 | Hotfix 流程(`zsk:release`)+ Postmortem 强制 |
176
+ | P2 / P3 | 常规发布 |
177
+
178
+ ## 任务依赖
179
+
180
+ \`\`\`mermaid
181
+ graph LR
182
+ S1[1. Red 复现测试] --> S2[2. Green 修复]
183
+ S2 --> S3[3. Regression 回归]
184
+ S3 --> S4[4. 证据归档]
185
+ \`\`\`
186
+
187
+ 严格顺序,不可并行(TDD 纪律)。
188
+
189
+ ## 证据记录
190
+
191
+ 见 `zsk:task-evidence`,Bugfix 重点填:
192
+ - **复现对照**(before/after 录屏)
193
+ - **校验记录**(回归套件 + 相关质量维度)
194
+ - **FR 覆盖矩阵**(受影响的 FR / NFR)
195
+
196
+ ## 总工作量
197
+
198
+ - T-shirt:`S` / `M` / `L`(按 RCA 复杂度)
199
+ - 人天:`{N}.{M}`
200
+
201
+ ---
202
+
203
+ ## DoD(关闭前门禁)
204
+
205
+ 见 `zsk:dor-dod` 的 **通用 + Bugfix 专用** 清单。
206
+
207
+ - [ ] 原 bug 不再复现
208
+ - [ ] 所有测试全绿(含新增回归)
209
+ - [ ] 相邻场景无回归
210
+ - [ ] P0 / P1 → Postmortem 已入 `docs/{module}/archive/`
211
+ - [ ] Changelog `Fixed` 章节已写
212
+ ```
213
+
214
+ ## Skip 规则
215
+
216
+ | 场景 | 简化 |
217
+ | --- | --- |
218
+ | P3 typo / 样式错别字 | 可以合并 Step 1+2(同一 commit 加测试 + 修),但必须有测试 |
219
+ | 性能 bug(有 profile) | Step 3 必须补性能对照 |
220
+ | 三方依赖 bug | Step 2 改为升级依赖 + 记 ADR,Step 3 重点回归相邻功能 |
221
+
222
+ **不能省**:
223
+ - ❌ 不能跳 Step 1(Red)— 违反 TDD 纪律
224
+ - ❌ 不能跳 Step 4(证据)— P0/P1 尤其不能
225
+
226
+ ## 反模式(禁止)
227
+
228
+ - ❌ **先改代码再补测试**(TDD 倒转,无法证明修复有效)
229
+ - ❌ **借机重构**(扩大 diff,RCA 不清 + 风险放大)
230
+ - ❌ **"大概这样就行"**(未跑回归就 merge)
231
+ - ❌ **跳过置信度三问**(修错地方的典型前兆)
232
+ - ❌ **Postmortem 只写不分析**(P0/P1 必须有 Action Items 到人到期)