@educa-corp/sdd-framework 0.6.0 → 0.7.1

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 (223) hide show
  1. package/bin/gate-trace.js +25 -2
  2. package/bin/index.js +32 -5
  3. package/bin/lint-trace.js +41 -0
  4. package/bin/self-check.js +430 -3
  5. package/bin/trace-schema.json +418 -31
  6. package/core/FRAMEWORK_VERSION +1 -1
  7. package/{commands/extend-prd.md → core/commands/amend-prd.md} +206 -173
  8. package/core/commands/dev-run-test.md +48 -10
  9. package/core/commands/extend-prd.md +39 -12
  10. package/core/commands/generate-bdd.md +52 -10
  11. package/core/commands/generate-code.md +35 -2
  12. package/core/commands/generate-tech-docs.md +36 -4
  13. package/core/commands/map-testids.md +1 -1
  14. package/core/commands/qc-run-test.md +29 -3
  15. package/core/commands/refine-prd.md +13 -2
  16. package/core/commands/review-context.md +43 -8
  17. package/core/commands/sync.md +105 -1
  18. package/core/commands/validate-traces.md +289 -16
  19. package/core/rules/workflow.md +34 -0
  20. package/core/steps/context-loader.md +27 -6
  21. package/core/templates/feature.template +1 -1
  22. package/core/templates/project-context.yaml +3 -3
  23. package/core/templates/tech-design.template.md +2 -2
  24. package/docs/02-concepts/architecture.md +37 -1
  25. package/docs/02-concepts/overview.md +1 -1
  26. package/docs/02-concepts/pipeline-steps/02-specification.md +13 -7
  27. package/docs/02-concepts/pipeline-steps/07-dev-selftest.md +2 -0
  28. package/docs/02-concepts/pipeline-steps/08-qc-automation.md +1 -0
  29. package/docs/02-concepts/pipeline-steps/09-validate-traces.md +34 -3
  30. package/docs/02-concepts/pipeline-steps/10-feedback-loop.md +10 -1
  31. package/docs/02-concepts/traceability.md +187 -183
  32. package/docs/03-guides/architect.md +13 -4
  33. package/docs/03-guides/developer.md +1 -0
  34. package/docs/03-guides/product-owner.md +89 -72
  35. package/docs/03-guides/tester-qa.md +81 -81
  36. package/docs/04-reference/commands.md +148 -134
  37. package/docs/04-reference/trace-schema.md +45 -1
  38. package/docs/explain/02b-extend-prd.md +1 -1
  39. package/docs/explain/02c-amend-prd.md +152 -0
  40. package/docs/explain/06-generate-bdd.md +1 -1
  41. package/docs/explain/13-dev-run-test.md +15 -1
  42. package/docs/explain/19-qc-run-test.md +91 -87
  43. package/docs/explain/21-validate-traces.md +79 -75
  44. package/docs/explain/28-sync.md +25 -0
  45. package/docs/explain/README.md +136 -135
  46. package/package.json +1 -8
  47. package/commands/debug.md +0 -529
  48. package/commands/debug.tmpl +0 -260
  49. package/commands/define-product.md +0 -438
  50. package/commands/define-product.tmpl +0 -225
  51. package/commands/dev-gen-test.md +0 -700
  52. package/commands/dev-gen-test.tmpl +0 -490
  53. package/commands/dev-run-test.md +0 -435
  54. package/commands/dev-run-test.tmpl +0 -225
  55. package/commands/dev-smoke-test.md +0 -374
  56. package/commands/dev-smoke-test.tmpl +0 -217
  57. package/commands/extend-prd.tmpl +0 -273
  58. package/commands/fix-bug.md +0 -519
  59. package/commands/fix-bug.tmpl +0 -197
  60. package/commands/generate-architecture.md +0 -354
  61. package/commands/generate-architecture.tmpl +0 -197
  62. package/commands/generate-bdd.md +0 -923
  63. package/commands/generate-bdd.tmpl +0 -590
  64. package/commands/generate-code.md +0 -859
  65. package/commands/generate-code.tmpl +0 -649
  66. package/commands/generate-design-spec.md +0 -737
  67. package/commands/generate-design-spec.tmpl +0 -524
  68. package/commands/generate-prd.md +0 -722
  69. package/commands/generate-prd.tmpl +0 -226
  70. package/commands/generate-spec-manifest.md +0 -321
  71. package/commands/generate-spec-manifest.tmpl +0 -164
  72. package/commands/generate-tech-docs.md +0 -920
  73. package/commands/generate-tech-docs.tmpl +0 -273
  74. package/commands/learn.md +0 -399
  75. package/commands/learn.tmpl +0 -130
  76. package/commands/map-testids.md +0 -238
  77. package/commands/map-testids.tmpl +0 -81
  78. package/commands/propose-scenario.md +0 -359
  79. package/commands/propose-scenario.tmpl +0 -202
  80. package/commands/qc-analyze.md +0 -269
  81. package/commands/qc-analyze.tmpl +0 -112
  82. package/commands/qc-design-test.md +0 -226
  83. package/commands/qc-design-test.tmpl +0 -69
  84. package/commands/qc-plan.md +0 -206
  85. package/commands/qc-plan.tmpl +0 -49
  86. package/commands/qc-report.md +0 -217
  87. package/commands/qc-report.tmpl +0 -60
  88. package/commands/qc-review.md +0 -210
  89. package/commands/qc-review.tmpl +0 -53
  90. package/commands/qc-run-test.md +0 -326
  91. package/commands/qc-run-test.tmpl +0 -116
  92. package/commands/refine-prd.md +0 -653
  93. package/commands/refine-prd.tmpl +0 -281
  94. package/commands/report-bug.md +0 -305
  95. package/commands/report-bug.tmpl +0 -148
  96. package/commands/review-code.md +0 -415
  97. package/commands/review-code.tmpl +0 -146
  98. package/commands/review-context.md +0 -902
  99. package/commands/review-context.tmpl +0 -530
  100. package/commands/review-tech-docs.md +0 -561
  101. package/commands/review-tech-docs.tmpl +0 -404
  102. package/commands/setup-ai-first.md +0 -602
  103. package/commands/setup-ai-first.tmpl +0 -450
  104. package/commands/sync.md +0 -430
  105. package/commands/sync.tmpl +0 -429
  106. package/commands/update-framework.md +0 -203
  107. package/commands/update-framework.tmpl +0 -202
  108. package/commands/validate-traces.md +0 -1077
  109. package/commands/validate-traces.tmpl +0 -920
  110. package/hooks/data-guard.js +0 -232
  111. package/hooks/settings.json +0 -19
  112. package/modules/android-compose/module.yaml +0 -13
  113. package/modules/android-compose/stack-profile.yaml +0 -57
  114. package/modules/angular/architecture-snippets/component-patterns.md +0 -187
  115. package/modules/angular/module.yaml +0 -6
  116. package/modules/angular/stack-profile.yaml +0 -38
  117. package/modules/context-engineering/architecture-snippets/context-design.md +0 -119
  118. package/modules/context-engineering/module.yaml +0 -9
  119. package/modules/context-engineering/stack-profile.yaml +0 -61
  120. package/modules/dotnet/architecture-snippets/clean-arch.md +0 -160
  121. package/modules/dotnet/module.yaml +0 -6
  122. package/modules/dotnet/stack-profile.yaml +0 -50
  123. package/modules/flutter/module.yaml +0 -14
  124. package/modules/flutter/stack-profile.yaml +0 -59
  125. package/modules/golang/architecture-snippets/domain-layout.md +0 -283
  126. package/modules/golang/module.yaml +0 -6
  127. package/modules/golang/stack-profile.yaml +0 -40
  128. package/modules/ios-swiftui/module.yaml +0 -13
  129. package/modules/ios-swiftui/stack-profile.yaml +0 -55
  130. package/modules/java-spring/architecture-snippets/layered-arch.md +0 -201
  131. package/modules/java-spring/module.yaml +0 -15
  132. package/modules/java-spring/stack-profile.yaml +0 -28
  133. package/modules/nextjs/architecture-snippets/app-router-patterns.md +0 -269
  134. package/modules/nextjs/module.yaml +0 -14
  135. package/modules/nextjs/stack-profile.yaml +0 -74
  136. package/modules/nuxt/module.yaml +0 -14
  137. package/modules/nuxt/stack-profile.yaml +0 -58
  138. package/modules/phaser-game/architecture-snippets/phaser-scene-patterns.md +0 -646
  139. package/modules/phaser-game/module.yaml +0 -15
  140. package/modules/phaser-game/stack-profile.yaml +0 -90
  141. package/modules/php-laravel/architecture-snippets/service-repository.md +0 -302
  142. package/modules/php-laravel/module.yaml +0 -15
  143. package/modules/php-laravel/stack-profile.yaml +0 -56
  144. package/modules/qc-playwright/stack-profile.yaml +0 -66
  145. package/modules/react/architecture-snippets/hooks-query-patterns.md +0 -254
  146. package/modules/react/module.yaml +0 -14
  147. package/modules/react/stack-profile.yaml +0 -63
  148. package/modules/react-native/module.yaml +0 -14
  149. package/modules/react-native/stack-profile.yaml +0 -56
  150. package/modules/vue/module.yaml +0 -14
  151. package/modules/vue/stack-profile.yaml +0 -65
  152. package/rules/data-protection.md +0 -80
  153. package/rules/workflow.md +0 -99
  154. package/skills/code/SKILL.md +0 -19
  155. package/skills/code/SKILL.tmpl +0 -19
  156. package/skills/debug/SKILL.md +0 -19
  157. package/skills/debug/SKILL.tmpl +0 -19
  158. package/skills/design-spec/SKILL.md +0 -11
  159. package/skills/design-spec/SKILL.tmpl +0 -11
  160. package/skills/discovery/SKILL.md +0 -14
  161. package/skills/discovery/SKILL.tmpl +0 -14
  162. package/skills/prd/SKILL.md +0 -19
  163. package/skills/prd/SKILL.tmpl +0 -19
  164. package/skills/qc/qa-analyst/DOC_GAPS.template.md +0 -63
  165. package/skills/qc/qa-analyst/acceptance-criteria.md +0 -60
  166. package/skills/qc/qa-analyst/business-rules.md +0 -59
  167. package/skills/qc/qa-analyst/data-flow.md +0 -64
  168. package/skills/qc/qa-analyst/spec-breakdown.md +0 -61
  169. package/skills/qc/qa-designer/e2e/journey.md +0 -41
  170. package/skills/qc/qa-designer/exploratory/charter.md +0 -68
  171. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +0 -43
  172. package/skills/qc/qa-designer/functional/api.md +0 -45
  173. package/skills/qc/qa-designer/functional/gui-feature.md +0 -46
  174. package/skills/qc/qa-designer/functional/gui-screen.md +0 -52
  175. package/skills/qc/qa-designer/integration/api.md +0 -42
  176. package/skills/qc/qa-designer/integration/db.md +0 -39
  177. package/skills/qc/qa-designer/integration/gui.md +0 -40
  178. package/skills/qc/qa-designer/integration/kafka.md +0 -40
  179. package/skills/qc/qa-designer/non-functional.md +0 -40
  180. package/skills/qc/qa-planner/test-plan.md +0 -120
  181. package/skills/qc/qa-reviewer/script/e2e.md +0 -87
  182. package/skills/qc/qa-reviewer/script/exploratory.md +0 -45
  183. package/skills/qc/qa-reviewer/script/functional.md +0 -101
  184. package/skills/qc/qa-reviewer/script/integration.md +0 -91
  185. package/skills/qc/qa-reviewer/script/non-functional.md +0 -126
  186. package/skills/qc/qa-reviewer/test-case/e2e.md +0 -73
  187. package/skills/qc/qa-reviewer/test-case/exploratory.md +0 -43
  188. package/skills/qc/qa-reviewer/test-case/functional.md +0 -76
  189. package/skills/qc/qa-reviewer/test-case/integration.md +0 -69
  190. package/skills/qc/qa-reviewer/test-case/non-functional.md +0 -73
  191. package/skills/qc/qa-runner/e2e.md +0 -49
  192. package/skills/qc/qa-runner/exploratory/session.md +0 -36
  193. package/skills/qc/qa-runner/functional/api.md +0 -35
  194. package/skills/qc/qa-runner/functional/gui-feature.md +0 -51
  195. package/skills/qc/qa-runner/functional/gui-screen.md +0 -55
  196. package/skills/qc/qa-runner/integration.md +0 -47
  197. package/skills/qc/qa-runner/non-functional.md +0 -49
  198. package/skills/qc/qa-runner/report/report.md +0 -37
  199. package/skills/setup-ai-first/SKILL.md +0 -19
  200. package/skills/setup-ai-first/SKILL.tmpl +0 -19
  201. package/skills/spec/SKILL.md +0 -19
  202. package/skills/spec/SKILL.tmpl +0 -19
  203. package/skills/test/SKILL.md +0 -18
  204. package/skills/test/SKILL.tmpl +0 -18
  205. package/steps/business-language.md +0 -56
  206. package/steps/capture-lesson.md +0 -112
  207. package/steps/context-loader.md +0 -406
  208. package/steps/gate.md +0 -151
  209. package/steps/report-footer.md +0 -125
  210. package/steps/review-fanout.md +0 -159
  211. package/steps/spawn-agent.md +0 -129
  212. package/steps/trace-mirror.md +0 -53
  213. package/templates/README.md +0 -70
  214. package/templates/architecture.template.md +0 -394
  215. package/templates/ci/trace-gate.yml +0 -146
  216. package/templates/design-spec.template.md +0 -217
  217. package/templates/feature.template +0 -123
  218. package/templates/hooks/pre-push +0 -61
  219. package/templates/platform-guide.template.md +0 -145
  220. package/templates/prd.template.md +0 -283
  221. package/templates/product-definition.template.md +0 -188
  222. package/templates/project-context.yaml +0 -212
  223. package/templates/tech-design.template.md +0 -490
@@ -1,260 +0,0 @@
1
- # /debug — Phân tích Debug nhanh
2
-
3
- Dùng cho: lỗi IDE, test fail, hành vi lạ, hoặc "tại sao code này làm X?"
4
- Khác `/fix-bug`: chỉ phân tích, không full workflow, không cần ticket.
5
-
6
- ## Gate
7
-
8
- *Checkpoint: **không chặn** — read-only. Gate Bước 3 bỏ qua CHECKPOINT (Bước 3a).*
9
-
10
- {{include:steps/gate.md}}
11
-
12
- *Lưu ý: Với lệnh này, target ở Bước 1 là input người dùng cung cấp (stack trace, output test fail, file path + mô tả, hoặc câu hỏi code). Không cần tìm file — đi thẳng sang context loading.*
13
-
14
- ## Context
15
- {{include:steps/context-loader.md}}
16
-
17
- ---
18
-
19
- ## Step 1 — Phân loại loại debug
20
-
21
- Sau khi nạp context, hiện prompt này và chờ user chọn:
22
-
23
- ```
24
- DEBUG SESSION
25
- ──────────────────────────────────────────────────────────────
26
- Tình huống của bạn?
27
-
28
- 1 Tôi đã có stack trace / error log → dán nó
29
- 2 Tôi cần reproduce lỗi trước → chỉ tôi lệnh run
30
- 3 Một test đang fail → tôi sẽ chạy test, rồi dán output
31
- 4 Câu hỏi về code (không cần runtime) → hỏi luôn
32
- ──────────────────────────────────────────────────────────────
33
- Nhập 1 / 2 / 3 / 4:
34
- ```
35
-
36
- Chờ user chọn, rồi theo path tương ứng bên dưới.
37
-
38
- ---
39
-
40
- ### Path 1 — Đã có error output
41
-
42
- Hỏi:
43
- ```
44
- Dán stack trace / error log của bạn bên dưới:
45
- ```
46
-
47
- Chờ input, rồi sang [Stack Trace Analysis](#stack-trace-analysis).
48
-
49
- ---
50
-
51
- ### Path 2 — Cần reproduce trước
52
-
53
- Hiện lệnh run từ `conventions.service_run` trong `project-context.yaml`:
54
-
55
- ```
56
- Khởi động service trước:
57
-
58
- {conventions.service_run}
59
-
60
- (Nếu dùng Docker: `docker compose up -d`, rồi verify với `docker compose ps`)
61
-
62
- Khi service đang chạy:
63
- 1. Trigger hành vi gây lỗi
64
- 2. Copy full stack trace hoặc error log
65
- 3. Dán vào đây
66
-
67
- Đang chờ error output của bạn...
68
- ```
69
-
70
- Chờ user dán lỗi, rồi sang [Stack Trace Analysis](#stack-trace-analysis).
71
-
72
- Nếu `conventions.service_run` chưa set → hiện:
73
- ```
74
- ⚠️ service_run chưa được cấu hình trong .agent/project-context.yaml.
75
- Thêm nó để lệnh này hiện đúng lệnh khởi động:
76
-
77
- conventions:
78
- service_run: "mvn spring-boot:run" # or: npm run dev / go run . / etc.
79
- ```
80
- Rồi nhờ user khởi động service thủ công và dán lỗi khi sẵn sàng.
81
-
82
- ---
83
-
84
- ### Path 3 — Test đang fail
85
-
86
- Hiện lệnh test từ `conventions.test_command` trong `project-context.yaml`:
87
-
88
- ```
89
- Chạy test của bạn trước:
90
-
91
- {conventions.test_command}
92
-
93
- Khi chạy xong, dán full output test fail vào đây.
94
-
95
- Đang chờ...
96
- ```
97
-
98
- Chờ user dán output fail, rồi sang [Test Failure Analysis](#test-failure-analysis).
99
-
100
- Nếu `conventions.test_command` chưa set → hiện:
101
- ```
102
- ⚠️ test_command chưa được cấu hình trong .agent/project-context.yaml.
103
- Thêm nó để lệnh này hiện đúng lệnh test:
104
-
105
- conventions:
106
- test_command: "mvn test" # or: npm test / go test ./... / etc.
107
- ```
108
- Rồi nhờ user chạy test thủ công và dán output khi sẵn sàng.
109
-
110
- ---
111
-
112
- ### Path 4 — Câu hỏi code
113
-
114
- Hỏi:
115
- ```
116
- Mô tả câu hỏi của bạn hoặc dán code snippet bạn đang hỏi:
117
- ```
118
-
119
- Chờ input, rồi trả lời trực tiếp dùng project context đã nạp (quy tắc kiến trúc, thứ tự layer, coding standards từ CLAUDE.md).
120
-
121
- ---
122
-
123
- ## Stack Trace Analysis
124
-
125
- Đọc từ **dưới lên** — `Caused by:` là root cause thật:
126
- ```
127
- Caused by: {RealException} ← bắt đầu ở đây
128
- at {class}.{method}({file}:{line})
129
- ```
130
-
131
- ## Common Error Patterns
132
-
133
- Dùng `active_module` từ context để chọn bảng liên quan.
134
-
135
- ### Nếu `platform_type = backend`
136
-
137
- #### java-spring / golang / dotnet / php-laravel
138
-
139
- | Error | Nguyên nhân khả nghi | Hướng fix |
140
- |-------|-------------|---------------|
141
- | NullPointerException | Truy cập object null; Optional chưa xử lý | Kiểm tra Optional.orElseThrow, null guard |
142
- | ClassCastException | Giả định sai kiểu | Kiểm tra type ở assignment/return |
143
- | OutOfMemoryError | Load quá nhiều data | Thêm pagination |
144
- | StackOverflowError | Đệ quy vô hạn | Tìm recursive call không có base case |
145
- | Connection refused | Dependency chưa chạy | Kiểm tra config URL / khởi động service |
146
- | 401 Unauthorized | Token hết hạn, sai config | Verify token, kiểm tra auth config |
147
- | 403 Forbidden | Sai role | Kiểm tra auth annotation |
148
- | DB constraint violation | Trùng key, null trong NOT NULL | Kiểm tra data và constraint |
149
- | Serialization error | Circular reference | Kiểm tra config DTO/mapper |
150
- | Test assertion mismatch | Sai mock hoặc sai expected | Đọc lại setup mock |
151
-
152
- #### context-engineering (AI/LLM pipelines)
153
-
154
- | Error | Nguyên nhân khả nghi | Hướng fix |
155
- |-------|-------------|---------------|
156
- | `APIError` / `RateLimitError` | Vượt quota LLM hoặc service down | Kiểm tra API key, rate limit; thêm exponential backoff |
157
- | `TokenLimitError` / `context_length_exceeded` | Prompt input quá dài | Truncate/chunk input; review kích thước prompt template |
158
- | `AuthenticationError` | API key không hợp lệ hoặc hết hạn | Kiểm tra env var; rotate key |
159
- | Response validation / schema mismatch | Output LLM không khớp format kỳ vọng | Thêm output parser; retry với prompt chặt hơn |
160
- | `JSONDecodeError` trên output LLM | Model trả về text non-JSON | Thêm post-processing trích JSON hoặc system prompt chặt hơn |
161
- | Test treo / chậm | LLM thật bị gọi trong test thay vì mock | Verify `patch('...')` được áp; thêm timeout guard |
162
- | Kết quả flaky giữa các lần chạy | Response LLM non-deterministic | Dùng mock cố định trong test; check temperature = 0 cho determinism |
163
-
164
- ### Nếu `platform_type = web-frontend`
165
-
166
- | Error | Nguyên nhân khả nghi | Hướng fix |
167
- |-------|-------------|---------------|
168
- | `Cannot read properties of undefined` | Data chưa load | Thêm loading guard / optional chaining `?.` |
169
- | `useEffect` infinite loop | Dependency array sai | Review deps, dùng stable ref / `useCallback` |
170
- | `Cannot update state on unmounted component` | Async resolve sau unmount | Cancel trong cleanup / dùng AbortController |
171
- | CORS error | API chưa cấu hình | Kiểm tra CORS config backend hoặc dev proxy |
172
- | 401 Unauthorized | Token hết hạn hoặc thiếu | Refresh token / kiểm tra header Authorization |
173
- | White screen / no output | Render error chưa xử lý | Kiểm tra console browser, thêm ErrorBoundary |
174
- | Type error (Zod / TypeScript) | Shape response API mismatch | So response thực tế vs type definition |
175
- | `act(...)` warning trong test | Async state update | Bọc trong `act(async () => {...})` |
176
- | Module not found | Sai import path | Kiểm tra relative path / tsconfig alias |
177
-
178
- ### Nếu `platform_type = mobile`
179
-
180
- #### Flutter
181
- | Error | Nguyên nhân khả nghi | Hướng fix |
182
- |-------|-------------|---------------|
183
- | `Null check operator on null value` | Nullable chưa guard | Thêm `?` hoặc null check trước `!` |
184
- | `pumpAndSettle timed out` | Async chưa hoàn thành trong test | Dùng `pump(Duration(...))` |
185
- | `setState called after dispose` | Async tiếp tục sau khi widget bị bỏ | Cancel trong `dispose()` |
186
- | `RenderFlex overflow` | Widget quá rộng so với màn | Bọc `Flexible`, `Expanded`, hoặc `SingleChildScrollView` |
187
- | BLoC state không update | Event chưa dispatch | Verify `bloc.add(Event())` được gọi |
188
- | `MissingPluginException` | Native plugin chưa link | Chạy `flutter clean && flutter pub get` |
189
-
190
- #### React Native
191
- | Error | Nguyên nhân khả nghi | Hướng fix |
192
- |-------|-------------|---------------|
193
- | `undefined is not an object` | Truy cập prop null | Thêm null check / optional chaining |
194
- | Metro bundler error | Cache stale | `npx react-native start --reset-cache` |
195
- | `VirtualizedLists nested` | FlatList trong ScrollView | Dùng `nestedScrollEnabled` hoặc tái cấu trúc |
196
- | Navigation `undefined` | `useNavigation` ngoài navigator | Bọc component trong đúng navigator |
197
- | `act(...)` warning | Async state update trong test | Bọc trong `act(async () => {...})` |
198
-
199
- #### iOS / Android
200
- | Error | Nguyên nhân khả nghi | Hướng fix |
201
- |-------|-------------|---------------|
202
- | `SIGABRT` / `EXC_BAD_ACCESS` (iOS) | Nil dereference | Thêm optional binding `if let` / `guard let` |
203
- | `IllegalStateException` (Android) | Vi phạm lifecycle | Kiểm tra fragment/activity còn attached không |
204
- | `NetworkOnMainThreadException` | Network call trên UI thread | Chuyển sang coroutine / background thread |
205
- | Build fail sau pod install | Pod cache stale | `pod deintegrate && pod install` |
206
- | `Hilt injection failed` | Thiếu `@AndroidEntryPoint` | Thêm annotation vào Activity/Fragment |
207
-
208
- ## Test Failure Analysis
209
-
210
- ```
211
- Expected: {value}
212
- Actual : {value}
213
- at {test}.{method}(line {N})
214
- ```
215
- 1. Gap là gì? 2. Mock setup đúng chưa? 3. Assertion có đúng logic không?
216
-
217
- ---
218
-
219
- ## Output
220
-
221
- {{include:steps/report-footer.md}}
222
-
223
- ```
224
- /debug Analysis
225
-
226
- ## Error
227
- {description}
228
-
229
- ## Root Cause
230
- {giải thích kỹ thuật}
231
-
232
- ## Location
233
- File: {path} | Line: {N} | Layer: {Controller/Service/Repository/Test}
234
-
235
- ## Suggested Fix
236
- {thay đổi code cụ thể}
237
-
238
- ## Related Rule
239
- Xem CLAUDE.md §{section}
240
-
241
- ## Next Step
242
- - Để fix hoàn toàn → /fix-bug {TICKET_ID}
243
- - Chỉ cần phân tích → xong
244
- ```
245
-
246
- ---
247
-
248
- ## Đề xuất ghi Lesson (tuỳ chọn)
249
-
250
- Nếu root cause là một **lỗi AI gây ra khi sinh code và có thể lặp lại**
251
- (không phải vấn đề env/config hay nguyên nhân bên ngoài), hỏi:
252
-
253
- ```
254
- Cái này trông như một lỗi AI lặp lại. Ghi nó thành project lesson? (Y/N)
255
- ```
256
-
257
- Nếu `Y` → chạy quy trình capture bên dưới với `source=/debug`, một `category` phù hợp
258
- (thường `code-gen`), và `scope` = domain hoặc file glob bị ảnh hưởng.
259
-
260
- {{include:steps/capture-lesson.md}}