@edupia-tutor/spec-driven-docs 0.14.7 → 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.
- package/commands/generate-bdd.md +59 -4
- package/commands/generate-bdd.tmpl +59 -4
- package/commands/generate-code.md +18 -1
- package/commands/generate-code.tmpl +18 -1
- package/commands/generate-design-spec.md +35 -5
- package/commands/generate-design-spec.tmpl +35 -5
- package/commands/generate-prd.md +7 -4
- package/commands/generate-tech-docs.md +1 -0
- package/commands/generate-tech-docs.tmpl +1 -0
- package/commands/propose-scenario.md +6 -2
- package/commands/propose-scenario.tmpl +6 -2
- package/commands/qc-analyze.md +14 -0
- package/commands/qc-analyze.tmpl +14 -0
- package/commands/refine-prd.md +15 -4
- package/commands/refine-prd.tmpl +15 -4
- package/commands/review-context.md +15 -11
- package/commands/review-context.tmpl +15 -11
- package/commands/validate-traces.md +1 -0
- package/commands/validate-traces.tmpl +1 -0
- package/core/FRAMEWORK_VERSION +1 -1
- package/core/commands/generate-bdd.md +59 -4
- package/core/commands/generate-code.md +18 -1
- package/core/commands/generate-design-spec.md +35 -5
- package/core/commands/generate-prd.md +7 -4
- package/core/commands/generate-tech-docs.md +1 -0
- package/core/commands/propose-scenario.md +6 -2
- package/core/commands/qc-analyze.md +14 -0
- package/core/commands/refine-prd.md +15 -4
- package/core/commands/review-context.md +15 -11
- package/core/commands/validate-traces.md +1 -0
- package/core/skills/code/SKILL.md +7 -759
- package/core/skills/debug/SKILL.md +9 -859
- package/core/skills/design-spec/SKILL.md +3 -582
- package/core/skills/prd/SKILL.md +5 -464
- package/core/skills/setup-ai-first/SKILL.md +3 -208
- package/core/skills/spec/SKILL.md +7 -450
- package/core/skills/test/SKILL.md +10 -1290
- package/core/steps/spawn-agent.md +12 -7
- package/core/templates/prd.template.md +7 -4
- package/docs/01-getting-started/core-concepts.md +2 -2
- package/docs/01-getting-started/quickstart.md +4 -3
- package/docs/02-guides/bdd-input-checklist.md +68 -0
- package/docs/02-guides/developer/README.md +3 -0
- package/docs/02-guides/developer/bdd-and-trace.md +1 -0
- package/docs/02-guides/developer/commands.md +3 -3
- package/docs/02-guides/developer/pr-checklist.md +1 -0
- package/docs/02-guides/developer/workflow.md +2 -2
- package/docs/02-guides/prd-input-checklist.md +94 -0
- package/docs/02-guides/product-owner/README.md +3 -1
- package/docs/02-guides/product-owner/commands.md +1 -1
- package/docs/02-guides/tech-docs-input-checklist.md +82 -0
- package/docs/02-guides/tester/README.md +1 -1
- package/docs/02-guides/tester/bug-reporting.md +1 -1
- package/docs/02-guides/tester/qc-automation.md +1 -1
- package/docs/03-concepts/README.md +1 -0
- package/docs/03-concepts/mechanisms-explained.md +34 -0
- package/docs/03-concepts/pipeline.md +12 -9
- package/docs/03-concepts/traceability.md +4 -1
- package/docs/04-operations/bug-flow.md +2 -0
- package/docs/05-reference/command-cheatsheet.md +8 -8
- package/docs/05-reference/commands.md +12 -10
- package/docs/05-reference/trace-schema.md +2 -1
- package/package.json +1 -1
- package/skills/code/SKILL.md +7 -759
- package/skills/code/SKILL.tmpl +7 -164
- package/skills/debug/SKILL.md +9 -859
- package/skills/debug/SKILL.tmpl +9 -252
- package/skills/design-spec/SKILL.md +3 -582
- package/skills/design-spec/SKILL.tmpl +3 -87
- package/skills/prd/SKILL.md +5 -464
- package/skills/prd/SKILL.tmpl +5 -63
- package/skills/setup-ai-first/SKILL.md +3 -208
- package/skills/setup-ai-first/SKILL.tmpl +3 -108
- package/skills/spec/SKILL.md +7 -450
- package/skills/spec/SKILL.tmpl +7 -162
- package/skills/test/SKILL.md +10 -1290
- package/skills/test/SKILL.tmpl +10 -288
- package/steps/spawn-agent.md +12 -7
- package/templates/prd.template.md +7 -4
package/skills/debug/SKILL.tmpl
CHANGED
|
@@ -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ử
|
|
8
|
-
|
|
9
|
-
---
|
|
7
|
+
Skill này xử lý `/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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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.)
|