@edupia-tutor/spec-driven-docs 0.14.6 → 0.14.8

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 (130) hide show
  1. package/bin/index.js +1 -1
  2. package/commands/debug.md +1 -1
  3. package/commands/define-product.md +1 -1
  4. package/commands/dev-gen-test.md +1 -1
  5. package/commands/dev-run-test.md +1 -1
  6. package/commands/dev-smoke-test.md +1 -1
  7. package/commands/fix-bug.md +1 -1
  8. package/commands/generate-bdd.md +74 -5
  9. package/commands/generate-bdd.tmpl +73 -4
  10. package/commands/generate-code.md +19 -2
  11. package/commands/generate-code.tmpl +18 -1
  12. package/commands/generate-design-spec.md +50 -6
  13. package/commands/generate-design-spec.tmpl +49 -5
  14. package/commands/generate-prd.md +9 -5
  15. package/commands/generate-prd.tmpl +1 -0
  16. package/commands/generate-spec-manifest.md +1 -1
  17. package/commands/generate-tech-docs.md +2 -1
  18. package/commands/generate-tech-docs.tmpl +1 -0
  19. package/commands/learn.md +1 -1
  20. package/commands/map-testids.md +1 -1
  21. package/commands/propose-scenario.md +7 -3
  22. package/commands/propose-scenario.tmpl +6 -2
  23. package/commands/qc-analyze.md +15 -1
  24. package/commands/qc-analyze.tmpl +14 -0
  25. package/commands/qc-design-test.md +1 -1
  26. package/commands/qc-plan.md +1 -1
  27. package/commands/qc-report.md +1 -1
  28. package/commands/qc-review.md +1 -1
  29. package/commands/qc-run-test.md +1 -1
  30. package/commands/refine-prd.md +33 -13
  31. package/commands/refine-prd.tmpl +32 -12
  32. package/commands/report-bug.md +1 -1
  33. package/commands/review-code.md +1 -1
  34. package/commands/review-context.md +49 -27
  35. package/commands/review-context.tmpl +48 -26
  36. package/commands/review-tech-docs.md +1 -1
  37. package/commands/setup-ai-first.md +10 -10
  38. package/commands/setup-ai-first.tmpl +9 -9
  39. package/commands/sync.md +1 -1
  40. package/commands/update-framework.md +1 -1
  41. package/commands/validate-traces.md +2 -1
  42. package/commands/validate-traces.tmpl +1 -0
  43. package/core/FRAMEWORK_VERSION +1 -1
  44. package/core/commands/debug.md +1 -1
  45. package/core/commands/define-product.md +1 -1
  46. package/core/commands/dev-gen-test.md +1 -1
  47. package/core/commands/dev-run-test.md +1 -1
  48. package/core/commands/dev-smoke-test.md +1 -1
  49. package/core/commands/fix-bug.md +1 -1
  50. package/core/commands/generate-bdd.md +74 -5
  51. package/core/commands/generate-code.md +19 -2
  52. package/core/commands/generate-design-spec.md +50 -6
  53. package/core/commands/generate-prd.md +9 -5
  54. package/core/commands/generate-spec-manifest.md +1 -1
  55. package/core/commands/generate-tech-docs.md +2 -1
  56. package/core/commands/learn.md +1 -1
  57. package/core/commands/map-testids.md +1 -1
  58. package/core/commands/propose-scenario.md +7 -3
  59. package/core/commands/qc-analyze.md +15 -1
  60. package/core/commands/qc-design-test.md +1 -1
  61. package/core/commands/qc-plan.md +1 -1
  62. package/core/commands/qc-report.md +1 -1
  63. package/core/commands/qc-review.md +1 -1
  64. package/core/commands/qc-run-test.md +1 -1
  65. package/core/commands/refine-prd.md +33 -13
  66. package/core/commands/report-bug.md +1 -1
  67. package/core/commands/review-code.md +1 -1
  68. package/core/commands/review-context.md +49 -27
  69. package/core/commands/review-tech-docs.md +1 -1
  70. package/core/commands/setup-ai-first.md +10 -10
  71. package/core/commands/sync.md +1 -1
  72. package/core/commands/update-framework.md +1 -1
  73. package/core/commands/validate-traces.md +2 -1
  74. package/core/skills/code/SKILL.md +7 -759
  75. package/core/skills/debug/SKILL.md +9 -859
  76. package/core/skills/design-spec/SKILL.md +3 -582
  77. package/core/skills/prd/SKILL.md +5 -464
  78. package/core/skills/setup-ai-first/SKILL.md +3 -208
  79. package/core/skills/spec/SKILL.md +7 -450
  80. package/core/skills/test/SKILL.md +10 -1290
  81. package/core/steps/report-footer.md +1 -1
  82. package/core/steps/spawn-agent.md +12 -7
  83. package/core/templates/prd.template.md +7 -4
  84. package/core/templates/project-context.yaml +2 -2
  85. package/docs/01-getting-started/core-concepts.md +3 -3
  86. package/docs/01-getting-started/quickstart.md +4 -3
  87. package/docs/02-guides/bdd-input-checklist.md +68 -0
  88. package/docs/02-guides/developer/README.md +3 -0
  89. package/docs/02-guides/developer/bdd-and-trace.md +4 -3
  90. package/docs/02-guides/developer/commands.md +3 -3
  91. package/docs/02-guides/developer/pr-checklist.md +1 -0
  92. package/docs/02-guides/developer/scenarios.md +2 -2
  93. package/docs/02-guides/developer/workflow.md +3 -3
  94. package/docs/02-guides/prd-input-checklist.md +94 -0
  95. package/docs/02-guides/product-owner/README.md +5 -3
  96. package/docs/02-guides/product-owner/commands.md +1 -1
  97. package/docs/02-guides/product-owner/handoff-checklist.md +5 -5
  98. package/docs/02-guides/product-owner/scenarios.md +19 -17
  99. package/docs/02-guides/tech-docs-input-checklist.md +82 -0
  100. package/docs/02-guides/tester/README.md +1 -1
  101. package/docs/02-guides/tester/bug-reporting.md +1 -1
  102. package/docs/02-guides/tester/qc-automation.md +1 -1
  103. package/docs/03-concepts/README.md +1 -0
  104. package/docs/03-concepts/mechanisms-explained.md +34 -0
  105. package/docs/03-concepts/pipeline.md +12 -9
  106. package/docs/03-concepts/traceability.md +7 -4
  107. package/docs/04-operations/bug-flow.md +2 -0
  108. package/docs/04-operations/sync-and-update.md +3 -3
  109. package/docs/05-reference/command-cheatsheet.md +9 -9
  110. package/docs/05-reference/commands.md +12 -10
  111. package/docs/05-reference/trace-schema.md +2 -1
  112. package/package.json +1 -1
  113. package/skills/code/SKILL.md +7 -759
  114. package/skills/code/SKILL.tmpl +7 -164
  115. package/skills/debug/SKILL.md +9 -859
  116. package/skills/debug/SKILL.tmpl +9 -252
  117. package/skills/design-spec/SKILL.md +3 -582
  118. package/skills/design-spec/SKILL.tmpl +3 -87
  119. package/skills/prd/SKILL.md +5 -464
  120. package/skills/prd/SKILL.tmpl +5 -63
  121. package/skills/setup-ai-first/SKILL.md +3 -208
  122. package/skills/setup-ai-first/SKILL.tmpl +3 -108
  123. package/skills/spec/SKILL.md +7 -450
  124. package/skills/spec/SKILL.tmpl +7 -162
  125. package/skills/test/SKILL.md +10 -1290
  126. package/skills/test/SKILL.tmpl +10 -288
  127. package/steps/report-footer.md +1 -1
  128. package/steps/spawn-agent.md +12 -7
  129. package/templates/prd.template.md +7 -4
  130. package/templates/project-context.yaml +2 -2
@@ -4,259 +4,16 @@ description: Fix bug với full workflow (branch, test, commit), phân tích deb
4
4
 
5
5
  # Debug & Quality Skills — Fix Bug, Debug, Validate Traces
6
6
 
7
- Skill này xử lý: `/fix-bug` (full bug fix workflow), `/debug` (phân tích nhanh), `/validate-traces` (check độ phủ traceability).
8
-
9
- ---
7
+ Skill này xử `/fix-bug`, `/debug`, `/validate-traces`. Để **không lệch schema/flow**, skill KHÔNG nhân bản mỗi lệnh thực thi **y hệt** command.
10
8
 
11
9
  ## /fix-bug — Full Bug Fix Workflow
10
+ → **Đọc và tuân theo `commands/fix-bug.md`** với cùng `$ARGUMENTS`.
11
+ (Command lo: bug-type table theo platform · đọc `{BUG-ID}` report · regression test · build + push 2 tầng (umbrella) · BUG State `Open→Fixed`→`Closed` · đề xuất Lesson.)
12
12
 
13
- ### Input
14
-
15
- Nhận: ticket ID (vd `PROJ-123`) hoặc một tả bug trực tiếp.
16
-
17
- ### Phase 1 — Gather Information
18
-
19
- Nếu cho ticket ID:
20
- - Fetch chi tiết ticket nếu Jira/issue tracker được kết nối
21
- - Ngược lại nhờ user dán: title, các bước tái hiện, expected vs actual
22
-
23
- Nếu không có ticket:
24
- **CHECKPOINT** — Hỏi:
25
- 1. Bug xảy ra ở đâu? (service, endpoint, flow)
26
- 2. Các bước tái hiện?
27
- 3. Expected vs Actual behavior?
28
- 4. Error log / stack trace (nếu có)?
29
-
30
- ### Phase 2 — Root Cause Analysis
31
-
32
- {{include:steps/context-loader.md}}
33
-
34
- Trace qua các layer (từ kiến trúc CLAUDE.md):
35
- 1. Xác định service/module từ endpoint/feature đang lỗi
36
- 2. Đọc các file code liên quan, từng layer
37
- 3. Đối chiếu với các bug pattern thường gặp:
38
-
39
- | Bug Type | Vị trí thường gặp | Cách kiểm tra |
40
- |----------|----------------|--------------|
41
- | Wrong response data | Data mapping layer | Kiểm tra field mapping, DTO conversion |
42
- | 400 Bad Request | Input validation | Kiểm tra DTO constraint, field bắt buộc |
43
- | 403 Forbidden | Auth configuration | Kiểm tra rule role-based access |
44
- | 404 Not Found | Repository query | Kiểm tra find method, kiểu ID |
45
- | Slow query / N+1 | Data access layer | Kiểm tra thiếu JOIN FETCH hoặc batch loading |
46
- | Null Pointer | Thiếu null check, Optional chưa xử lý | Kiểm tra dùng Optional.orElseThrow |
47
- | Transaction rollback | Thiếu/sai transaction scope | Kiểm tra @Transactional trên service method |
48
- | Stale cache | Thiếu cache eviction sau write | Kiểm tra cache invalidation khi write |
49
- | Type mismatch in query | Code filter/specification | Kiểm tra kiểu field trong query predicate |
50
- | Cross-service timeout | Lời gọi external service | Kiểm tra URL config, hành vi fallback |
51
-
52
- **CHECKPOINT — Root Cause Report:**
53
-
54
- ```
55
- Root Cause Analysis — {TICKET_ID}:
56
-
57
- Bug: {description}
58
- Affected module: {module/service}
59
- Root cause: {specific technical analysis}
60
- Affected files:
61
- - {file}: {what's wrong}
62
-
63
- Proposed fix:
64
- - {file}: {what to change}
65
-
66
- Regression risk: Low / Medium / High
67
- → Reason: {explanation}
68
-
69
- Proceed with fix? (Y/N)
70
- ```
71
-
72
- Chờ user xác nhận.
73
-
74
- ### Phase 3 — Implement Fix
75
-
76
- ```bash
77
- git checkout -b fix/{TICKET_ID}-{short-description}
78
- ```
79
-
80
- Áp dụng fix đúng như đã phân tích. Theo coding standards CLAUDE.md — đừng đưa thêm vi phạm mới.
81
-
82
- Thêm annotation traceability nếu file có `@trace.implements`:
83
- ```
84
- // @trace.implements={UC-ID}-SC{N}
85
- // @trace.fixes={TICKET_ID}
86
- // @trace.root_cause={brief description}
87
- ```
88
-
89
- ### Phase 4 — Regression Test
90
-
91
- Sinh một regression test nếu chưa có:
92
- ```
93
- // @trace.verifies={UC-ID}
94
- // @trace.regression={TICKET_ID}
95
- Test: "Regression {TICKET_ID}: {bug description}"
96
- → Reproduce the exact bug scenario
97
- → Assert the fix works correctly
98
- ```
99
-
100
- Chạy test: `{TEST_COMMAND_FOR_CLASS}`
101
-
102
- Nếu test fail → debug và fix (tối đa 3 vòng).
103
-
104
- ### Phase 5 — Build Verify
105
-
106
- ```bash
107
- {BUILD_COMMAND} # max 3 retries
108
- ```
109
-
110
- ### Phase 6 — Commit & Push
111
-
112
- ```bash
113
- git add {changed files}
114
- git commit -m "fix({TICKET_ID}): {brief description}"
115
- git push -u origin fix/{TICKET_ID}-{slug}
116
- ```
117
-
118
- ### Output
119
-
120
- ```
121
- /fix-bug Complete — {TICKET_ID}
122
-
123
- ## Root Cause
124
- {analysis}
125
-
126
- ## Changes
127
- - {file}: {what changed and why}
128
-
129
- ## Regression Test
130
- ✅ Added: {TestClass}.{method}
131
- ✅ Build: SUCCESS
132
-
133
- ## Branch
134
- fix/{TICKET_ID}-{slug}
135
- ```
136
-
137
- {{include:steps/report-footer.md}}
138
-
139
- ---
140
-
141
- ## /debug — Quick Debug Analysis
142
-
143
- Dùng khi: IDE hiện lỗi, test fail bất ngờ, hành vi lạ, hoặc bạn cần hiểu vì sao code làm gì đó.
144
-
145
- **Khác `/fix-bug`**: Đây chỉ là phân tích, không full workflow, không cần ticket.
146
-
147
- ### Input
148
-
149
- Dán một trong:
150
- 1. Stack trace / error log
151
- 2. Output test fail
152
- 3. File path + mô tả hành vi bất ngờ
153
- 4. Một câu hỏi cụ thể về code snippet
154
-
155
- ### Stack Trace Analysis
156
-
157
- Đọc stack trace từ **dưới lên** — dòng `Caused by:` là root cause thật.
158
-
159
- ```
160
- Caused by: {RealException} ← start here
161
- at {class}.{method}({file}:{line}) ← trace from here
162
- ...
163
- at {entrypoint} ← where it was called from
164
- ```
165
-
166
- ### Common Error Patterns
167
-
168
- | Error | Nguyên nhân khả nghi | Hướng fix |
169
- |-------|-------------|---------------|
170
- | NullPointerException | Truy cập field trên object null; Optional chưa xử lý | Kiểm tra Optional.orElseThrow, null guard |
171
- | ClassCastException | Giả định sai kiểu; dùng generic không đúng | Kiểm tra type ở điểm assignment/return |
172
- | OutOfMemoryError | Load quá nhiều data; memory leak | Thêm pagination, kiểm tra kích thước collection |
173
- | StackOverflowError | Đệ quy vô hạn | Tìm recursive call không có base case |
174
- | Connection refused | Dependency service chưa chạy | Kiểm tra config URL, khởi động service phụ thuộc |
175
- | Authentication/401 | Token hết hạn, sai config, thiếu header | Verify token, kiểm tra auth config |
176
- | Permission denied/403 | Sai role trong request hoặc access rule cấu hình sai | Kiểm tra auth annotation và role config |
177
- | Database constraint violation | Trùng key, thiếu FK, null trong cột NOT NULL | Kiểm tra data và định nghĩa constraint |
178
- | Serialization error | Circular reference, field chưa map | Kiểm tra config DTO/mapper |
179
- | Test assertion mismatch | Sai mock setup hoặc sai giá trị expected | Đọc lại mock setup và logic assertion |
180
-
181
- ### Test Failure Analysis
182
-
183
- ```
184
- Expected: {expected value}
185
- Actual : {actual value}
186
- at {test class}.{method}(line {N})
187
- ```
188
-
189
- 1. Gap giữa Expected và Actual là gì?
190
- 2. Trace tới đúng dòng test
191
- 3. Mock setup đúng chưa? (`given(...).willReturn(...)`)
192
- 4. Assertion có đúng logic không?
193
-
194
- ### Output
195
-
196
- ```
197
- /debug Analysis
198
-
199
- ## Error Encountered
200
- {description}
201
-
202
- ## Root Cause
203
- {technical explanation}
204
-
205
- ## Location in Code
206
- File: {path}
207
- Line: {line number if available}
208
- Layer: {Controller/Service/Repository/Test}
209
-
210
- ## Suggested Fix
211
- {specific code change}
212
-
213
- ## Related Rule
214
- See CLAUDE.md §{section} — {section name}
215
-
216
- ## Next Step
217
- - To fully fix → run /fix-bug {TICKET_ID}
218
- - Just needed analysis → done here
219
- ```
220
-
221
- {{include:steps/report-footer.md}}
222
-
223
- ---
224
-
225
- ## /validate-traces — Traceability Coverage Matrix
226
-
227
- Check read-only độ phủ giữa spec, code, và test.
228
-
229
- ### Input
230
-
231
- Nhận: tên domain hoặc UC-ID cụ thể.
232
-
233
- ### Process
234
-
235
- 1. **Đọc file .feature** → gom tất cả SC-ID cho domain/UC
236
- 2. **Quét file controller** → tìm tag `@trace.implements`
237
- 3. **Quét file test** → tìm tag `@trace.verifies`
238
- 4. **Đọc `.trace/{domain}/{prd-slug}/{UC-ID}.tsv`** → check drift (text scenario đổi từ lần gen code trước)
239
-
240
- ### Output
241
-
242
- ```
243
- /validate-traces — {domain}
244
-
245
- | UC-ID | SC | Spec | Code | Test | Status |
246
- |-------|----|------|------|------|--------|
247
- | {UC}-UC1 | SC1 | ✅ | ✅ {ControllerClass} | ✅ {TestClass} | synced |
248
- | {UC}-UC1 | SC2 | ✅ | ✅ {ControllerClass} | ❌ MISSING | gap |
249
- | {UC}-UC2 | SC1 | ✅ | ❌ MISSING | ❌ MISSING | gap |
250
-
251
- Gaps:
252
- Missing code: [{UC-ID}-SC2, {UC-ID2}-SC1]
253
- Missing tests: [{UC-ID}-SC1]
254
- Drifted (spec changed, code not updated): [{list}]
255
-
256
- Recommendations:
257
- - /generate-code {UC-ID} SC2
258
- - /dev-gen-test {UC-ID}
259
- - Re-run /generate-code {UC-ID} for drifted scenarios
260
- ```
13
+ ## /debug — Phân tích nhanh
14
+ → **Đọc và tuân theo `commands/debug.md`** với cùng `$ARGUMENTS`.
15
+ (Command lo: 4 path (stack trace / reproduce / test fail / câu hỏi code) · bảng lỗi theo từng platform/module · stack-trace đọc dưới-lên.)
261
16
 
262
- {{include:steps/report-footer.md}}
17
+ ## /validate-traces — Traceability Coverage
18
+ → **Đọc và tuân theo `commands/validate-traces.md`** với cùng `$ARGUMENTS`.
19
+ (Command lo: đọc trace TSV 22 cột authoritative · tính OK/DRIFT/GAP/UNTRACKED + PRD/TECHDOC drift · sync `uc_status` ← `@trace.status` · aggregate dashboard.)