@anhth2/spec-driven-dev-plugin 0.6.0 → 0.7.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 (73) hide show
  1. package/bin/index.js +180 -11
  2. package/commands/debug.md +196 -10
  3. package/commands/debug.tmpl +170 -6
  4. package/commands/define-product.md +31 -5
  5. package/commands/define-product.tmpl +5 -1
  6. package/commands/fix-bug.md +74 -10
  7. package/commands/fix-bug.tmpl +48 -6
  8. package/commands/generate-bdd.md +49 -8
  9. package/commands/generate-bdd.tmpl +23 -4
  10. package/commands/generate-code.md +109 -18
  11. package/commands/generate-code.tmpl +83 -14
  12. package/commands/generate-prd.md +33 -6
  13. package/commands/generate-prd.tmpl +7 -2
  14. package/commands/generate-tech-docs.md +85 -8
  15. package/commands/generate-tech-docs.tmpl +59 -4
  16. package/commands/generate-tests.md +454 -36
  17. package/commands/generate-tests.tmpl +428 -32
  18. package/commands/refine-prd.md +39 -7
  19. package/commands/refine-prd.tmpl +13 -3
  20. package/commands/review-code.md +57 -5
  21. package/commands/review-code.tmpl +31 -1
  22. package/commands/review-context.md +41 -11
  23. package/commands/review-context.tmpl +15 -7
  24. package/commands/review-tech-docs.md +39 -8
  25. package/commands/review-tech-docs.tmpl +13 -4
  26. package/commands/run-tests.md +159 -17
  27. package/commands/run-tests.tmpl +133 -13
  28. package/commands/setup-ai-first.md +61 -3
  29. package/commands/setup-ai-first.tmpl +6 -2
  30. package/commands/smoke-test.md +191 -21
  31. package/commands/smoke-test.tmpl +165 -17
  32. package/commands/validate-traces.md +40 -7
  33. package/commands/validate-traces.tmpl +14 -3
  34. package/core/FRAMEWORK_VERSION +1 -1
  35. package/core/commands/debug.md +196 -10
  36. package/core/commands/define-product.md +31 -5
  37. package/core/commands/fix-bug.md +74 -10
  38. package/core/commands/generate-bdd.md +49 -8
  39. package/core/commands/generate-code.md +109 -18
  40. package/core/commands/generate-prd.md +33 -6
  41. package/core/commands/generate-tech-docs.md +85 -8
  42. package/core/commands/generate-tests.md +454 -36
  43. package/core/commands/refine-prd.md +39 -7
  44. package/core/commands/review-code.md +57 -5
  45. package/core/commands/review-context.md +41 -11
  46. package/core/commands/review-tech-docs.md +39 -8
  47. package/core/commands/run-tests.md +159 -17
  48. package/core/commands/setup-ai-first.md +61 -3
  49. package/core/commands/smoke-test.md +191 -21
  50. package/core/commands/validate-traces.md +40 -7
  51. package/core/skills/code/SKILL.md +29 -6
  52. package/core/skills/debug/SKILL.md +31 -7
  53. package/core/skills/discovery/SKILL.md +25 -3
  54. package/core/skills/prd/SKILL.md +8 -6
  55. package/core/skills/setup-ai-first/SKILL.md +3 -2
  56. package/core/skills/spec/SKILL.md +7 -5
  57. package/core/skills/test/SKILL.md +54 -9
  58. package/core/steps/context-loader.md +22 -1
  59. package/core/steps/gate.md +1 -1
  60. package/core/steps/report-footer.md +3 -2
  61. package/core/steps/spawn-agent.md +3 -1
  62. package/package.json +1 -1
  63. package/skills/code/SKILL.md +29 -6
  64. package/skills/debug/SKILL.md +31 -7
  65. package/skills/discovery/SKILL.md +25 -3
  66. package/skills/prd/SKILL.md +8 -6
  67. package/skills/setup-ai-first/SKILL.md +3 -2
  68. package/skills/spec/SKILL.md +7 -5
  69. package/skills/test/SKILL.md +54 -9
  70. package/steps/context-loader.md +22 -1
  71. package/steps/gate.md +1 -1
  72. package/steps/report-footer.md +3 -2
  73. package/steps/spawn-agent.md +3 -1
@@ -13,13 +13,112 @@ Different from `/fix-bug`: analysis only, no full workflow, no ticket needed.
13
13
 
14
14
  ---
15
15
 
16
- ## InputPaste one of:
17
- 1. Stack trace / error log
18
- 2. Test failure output
19
- 3. File path + description of unexpected behavior
20
- 4. A specific question about a code snippet
16
+ ## Step 1 Classify debug type
17
+
18
+ After loading context, display this prompt and wait for the user's choice:
19
+
20
+ ```
21
+ DEBUG SESSION
22
+ ──────────────────────────────────────────────────────────────
23
+ What's your situation?
24
+
25
+ 1 I already have a stack trace / error log → paste it
26
+ 2 I need to reproduce the error first → show me the run command
27
+ 3 A test is failing → I'll run tests, then paste output
28
+ 4 Code question (no runtime needed) → ask away
29
+ ──────────────────────────────────────────────────────────────
30
+ Enter 1 / 2 / 3 / 4:
31
+ ```
32
+
33
+ Wait for the user's choice, then follow the corresponding path below.
34
+
35
+ ---
36
+
37
+ ### Path 1 — Already have error output
38
+
39
+ Ask:
40
+ ```
41
+ Paste your stack trace / error log below:
42
+ ```
43
+
44
+ Wait for input, then proceed to [Stack Trace Analysis](#stack-trace-analysis).
45
+
46
+ ---
47
+
48
+ ### Path 2 — Need to reproduce first
49
+
50
+ Display the run command from `conventions.service_run` in `project-context.yaml`:
51
+
52
+ ```
53
+ Start your service first:
54
+
55
+ {conventions.service_run}
56
+
57
+ (If you use Docker: `docker compose up -d`, then verify with `docker compose ps`)
58
+
59
+ Once the service is running:
60
+ 1. Trigger the behavior that causes the error
61
+ 2. Copy the full stack trace or error log
62
+ 3. Paste it here
63
+
64
+ Waiting for your error output...
65
+ ```
66
+
67
+ Wait for the user to paste the error, then proceed to [Stack Trace Analysis](#stack-trace-analysis).
68
+
69
+ If `conventions.service_run` is not set → show:
70
+ ```
71
+ ⚠️ service_run is not configured in .agent/project-context.yaml.
72
+ Add it so this command can show the correct start command:
73
+
74
+ conventions:
75
+ service_run: "mvn spring-boot:run" # or: npm run dev / go run . / etc.
76
+ ```
77
+ Then ask the user to start the service manually and paste the error when ready.
78
+
79
+ ---
80
+
81
+ ### Path 3 — Test is failing
82
+
83
+ Display the test command from `conventions.test_command` in `project-context.yaml`:
84
+
85
+ ```
86
+ Run your tests first:
87
+
88
+ {conventions.test_command}
89
+
90
+ Once the run finishes, paste the full test failure output here.
91
+
92
+ Waiting...
93
+ ```
94
+
95
+ Wait for the user to paste the failure output, then proceed to [Test Failure Analysis](#test-failure-analysis).
96
+
97
+ If `conventions.test_command` is not set → show:
98
+ ```
99
+ ⚠️ test_command is not configured in .agent/project-context.yaml.
100
+ Add it so this command can show the correct test command:
101
+
102
+ conventions:
103
+ test_command: "mvn test" # or: npm test / go test ./... / etc.
104
+ ```
105
+ Then ask the user to run tests manually and paste the output when ready.
106
+
107
+ ---
108
+
109
+ ### Path 4 — Code question
110
+
111
+ Ask:
112
+ ```
113
+ Describe your question or paste the code snippet you're asking about:
114
+ ```
115
+
116
+ Wait for input, then answer directly using loaded project context (architecture rules, layer order, coding standards from CLAUDE.md).
117
+
118
+ ---
21
119
 
22
120
  ## Stack Trace Analysis
121
+
23
122
  Read from **bottom up** — `Caused by:` is the real root cause:
24
123
  ```
25
124
  Caused by: {RealException} ← start here
@@ -28,20 +127,83 @@ Caused by: {RealException} ← start here
28
127
 
29
128
  ## Common Error Patterns
30
129
 
130
+ Use `active_module` from context to select the relevant table.
131
+
132
+ ### If `platform_type = backend`
133
+
134
+ #### java-spring / golang / dotnet / php-laravel
135
+
31
136
  | Error | Likely Cause | Fix Direction |
32
137
  |-------|-------------|---------------|
33
138
  | NullPointerException | Null object access; Optional not handled | Check Optional.orElseThrow, null guards |
34
139
  | ClassCastException | Wrong type assumption | Check type at assignment/return |
35
140
  | OutOfMemoryError | Loading too much data | Add pagination |
36
141
  | StackOverflowError | Infinite recursion | Find recursive call with no base case |
37
- | Connection refused | Dependency not running | Check config URLs |
142
+ | Connection refused | Dependency not running | Check config URLs / start service |
38
143
  | 401 Unauthorized | Token expired, wrong config | Verify token, check auth config |
39
144
  | 403 Forbidden | Wrong role | Check auth annotations |
40
145
  | DB constraint violation | Duplicate key, null in NOT NULL | Check data and constraints |
41
146
  | Serialization error | Circular reference | Check DTO/mapper config |
42
147
  | Test assertion mismatch | Wrong mock or wrong expected | Re-read mock setup |
43
148
 
149
+ #### context-engineering (AI/LLM pipelines)
150
+
151
+ | Error | Likely Cause | Fix Direction |
152
+ |-------|-------------|---------------|
153
+ | `APIError` / `RateLimitError` | LLM quota exceeded or service down | Check API key, rate limits; add exponential backoff |
154
+ | `TokenLimitError` / `context_length_exceeded` | Input prompt too long | Truncate/chunk input; review prompt template size |
155
+ | `AuthenticationError` | API key invalid or expired | Check env var; rotate key |
156
+ | Response validation / schema mismatch | LLM output doesn't match expected format | Add output parser; retry with stricter prompt |
157
+ | `JSONDecodeError` on LLM output | Model returned non-JSON text | Add JSON extraction post-processing or stricter system prompt |
158
+ | Hanging / slow test | Real LLM called in test instead of mock | Verify `patch('...')` applied; add timeout guard |
159
+ | Flaky results across runs | Non-deterministic LLM response | Use fixed mock in tests; check temperature = 0 for determinism |
160
+
161
+ ### If `platform_type = web-frontend`
162
+
163
+ | Error | Likely Cause | Fix Direction |
164
+ |-------|-------------|---------------|
165
+ | `Cannot read properties of undefined` | Data not loaded yet | Add loading guard / optional chaining `?.` |
166
+ | `useEffect` infinite loop | Dependency array wrong | Review deps, use stable refs / `useCallback` |
167
+ | `Cannot update state on unmounted component` | Async resolves after unmount | Cancel in cleanup / use AbortController |
168
+ | CORS error | API not configured | Check backend CORS config or dev proxy setup |
169
+ | 401 Unauthorized | Token expired or missing | Refresh token / check Authorization header |
170
+ | White screen / no output | Unhandled render error | Check browser console, add ErrorBoundary |
171
+ | Type error (Zod / TypeScript) | API response shape mismatch | Compare actual response vs type definition |
172
+ | `act(...)` warning in test | Async state update | Wrap in `act(async () => {...})` |
173
+ | Module not found | Import path wrong | Check relative path / tsconfig alias |
174
+
175
+ ### If `platform_type = mobile`
176
+
177
+ #### Flutter
178
+ | Error | Likely Cause | Fix Direction |
179
+ |-------|-------------|---------------|
180
+ | `Null check operator on null value` | Nullable not guarded | Add `?` or null check before `!` |
181
+ | `pumpAndSettle timed out` | Async not completing in test | Use `pump(Duration(...))` |
182
+ | `setState called after dispose` | Async continues after widget removed | Cancel in `dispose()` |
183
+ | `RenderFlex overflow` | Widget too wide for screen | Wrap with `Flexible`, `Expanded`, or `SingleChildScrollView` |
184
+ | BLoC state not updating | Event not dispatched | Verify `bloc.add(Event())` is called |
185
+ | `MissingPluginException` | Native plugin not linked | Run `flutter clean && flutter pub get` |
186
+
187
+ #### React Native
188
+ | Error | Likely Cause | Fix Direction |
189
+ |-------|-------------|---------------|
190
+ | `undefined is not an object` | Null prop access | Add null check / optional chaining |
191
+ | Metro bundler error | Cache stale | `npx react-native start --reset-cache` |
192
+ | `VirtualizedLists nested` | FlatList inside ScrollView | Use `nestedScrollEnabled` or restructure |
193
+ | Navigation `undefined` | `useNavigation` outside navigator | Wrap component inside correct navigator |
194
+ | `act(...)` warning | Async state update in test | Wrap in `act(async () => {...})` |
195
+
196
+ #### iOS / Android
197
+ | Error | Likely Cause | Fix Direction |
198
+ |-------|-------------|---------------|
199
+ | `SIGABRT` / `EXC_BAD_ACCESS` (iOS) | Nil dereference | Add optional binding `if let` / `guard let` |
200
+ | `IllegalStateException` (Android) | Lifecycle violation | Check if fragment/activity still attached |
201
+ | `NetworkOnMainThreadException` | Network call on UI thread | Move to coroutine / background thread |
202
+ | Build fails after pod install | Pod cache stale | `pod deintegrate && pod install` |
203
+ | `Hilt injection failed` | Missing `@AndroidEntryPoint` | Add annotation to Activity/Fragment |
204
+
44
205
  ## Test Failure Analysis
206
+
45
207
  ```
46
208
  Expected: {value}
47
209
  Actual : {value}
@@ -49,6 +211,8 @@ Actual : {value}
49
211
  ```
50
212
  1. What is the gap? 2. Is mock setup correct? 3. Is assertion logically correct?
51
213
 
214
+ ---
215
+
52
216
  ## Output
53
217
 
54
218
  {{include:steps/report-footer.md}}
@@ -31,7 +31,7 @@ Display and wait for response:
31
31
  ```
32
32
  ⚙️ MODEL CHECK
33
33
  ──────────────────────────────────────────────────────────────────
34
- Recommended : claude-opus-4-5 (or claude-opus-4)
34
+ Recommended : claude-opus-4 (or latest Opus model)
35
35
  Why needed : Spec analysis, architecture review, code generation
36
36
  require deep reasoning. Smaller models miss edge cases.
37
37
 
@@ -140,7 +140,7 @@ If `paths` section is absent, use these defaults:
140
140
  - `domain_knowledge_dir` = `specs/domain-knowledge`
141
141
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
142
142
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
143
- - `tech_docs_dir` = `tech-docs`
143
+ - `tech_docs_dir` = `specs/tech-docs`
144
144
  - `trace_dir` = `.trace`
145
145
 
146
146
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
@@ -217,6 +217,26 @@ If the file does not exist → skip silently.
217
217
 
218
218
  ---
219
219
 
220
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
221
+
222
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
223
+
224
+ ```
225
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
226
+ ```
227
+
228
+ | `platform_type` | Modules |
229
+ |---|---|
230
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
231
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
232
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
233
+
234
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
235
+
236
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
237
+
238
+ ---
239
+
220
240
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
221
241
 
222
242
  After loading all context, synthesize and output a compact summary block.
@@ -227,6 +247,7 @@ Output exactly this block:
227
247
  ```
228
248
  [CTX LOADED]
229
249
  Stack : {language} / {framework} / {database}
250
+ Platform : {active_module} ({platform_type})
230
251
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
231
252
  Ticket : {ticket_prefix}-
232
253
  Dict : {loaded — N canonical terms, M banned terms | missing}
@@ -269,6 +290,8 @@ AI scans the project and writes:
269
290
  | {original} | {canonical} |
270
291
  ```
271
292
 
293
+ Store this terminology map in the output product-definition file under a `## Terminology Map` section — `/generate-prd` will reference it during its Terminology Rules step to ensure consistency.
294
+
272
295
  ---
273
296
 
274
297
  ## Phase 1 — Feature Definition *(CHECKPOINT 1)*
@@ -305,7 +328,7 @@ Confirm → write `✅ PO Confirmed: Yes` → proceed.
305
328
 
306
329
  ---
307
330
 
308
- ## Phase 3 — Clarification Log
331
+ ## Phase 3 — Clarification Log *(CHECKPOINT 3)*
309
332
 
310
333
  Based on Phases 1-2, AI identifies gaps and asks follow-up questions. Continue rounds until no Unresolved Items remain.
311
334
 
@@ -321,6 +344,8 @@ Based on Phases 1-2, AI identifies gaps and asks follow-up questions. Continue r
321
344
  ### Unresolved Items
322
345
  - {item — or "None"}
323
346
 
347
+ When all Unresolved Items are resolved → write `✅ CHECKPOINT 3: No Unresolved Items` → proceed to Phase 4.
348
+
324
349
  ---
325
350
 
326
351
  ## Phase 4 — Business Rules *(CHECKPOINT 4)*
@@ -417,6 +442,7 @@ Suggest the logical next command based on workflow phase:
417
442
 
418
443
  | Current command | Suggest next |
419
444
  |-------------------------|-----------------------------------------------|
445
+ | /setup-ai-first | `/define-product` to start your first feature |
420
446
  | /define-product | `/generate-prd {product-definition-file}` |
421
447
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
422
448
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -425,13 +451,13 @@ Suggest the logical next command based on workflow phase:
425
451
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
426
452
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
427
453
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
428
- | /generate-code | `/generate-tests {UC-ID}` |
454
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
429
455
  | /generate-tests | `/run-tests {UC-ID}` |
430
456
  | /run-tests (passing) | `/review-code {UC-ID}` |
431
457
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
432
458
  | /review-code | `/smoke-test {UC-ID}` or create PR |
433
459
  | /smoke-test | Create PR and link to ticket |
434
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
460
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
435
461
  | /fix-bug | Create PR and link to ticket |
436
462
  | /debug | `/fix-bug {ticket-id}` if fix needed |
437
463
 
@@ -25,6 +25,8 @@ AI scans the project and writes:
25
25
  | {original} | {canonical} |
26
26
  ```
27
27
 
28
+ Store this terminology map in the output product-definition file under a `## Terminology Map` section — `/generate-prd` will reference it during its Terminology Rules step to ensure consistency.
29
+
28
30
  ---
29
31
 
30
32
  ## Phase 1 — Feature Definition *(CHECKPOINT 1)*
@@ -61,7 +63,7 @@ Confirm → write `✅ PO Confirmed: Yes` → proceed.
61
63
 
62
64
  ---
63
65
 
64
- ## Phase 3 — Clarification Log
66
+ ## Phase 3 — Clarification Log *(CHECKPOINT 3)*
65
67
 
66
68
  Based on Phases 1-2, AI identifies gaps and asks follow-up questions. Continue rounds until no Unresolved Items remain.
67
69
 
@@ -77,6 +79,8 @@ Based on Phases 1-2, AI identifies gaps and asks follow-up questions. Continue r
77
79
  ### Unresolved Items
78
80
  - {item — or "None"}
79
81
 
82
+ When all Unresolved Items are resolved → write `✅ CHECKPOINT 3: No Unresolved Items` → proceed to Phase 4.
83
+
80
84
  ---
81
85
 
82
86
  ## Phase 4 — Business Rules *(CHECKPOINT 4)*
@@ -31,7 +31,7 @@ Display and wait for response:
31
31
  ```
32
32
  ⚙️ MODEL CHECK
33
33
  ──────────────────────────────────────────────────────────────────
34
- Recommended : claude-opus-4-5 (or claude-opus-4)
34
+ Recommended : claude-opus-4 (or latest Opus model)
35
35
  Why needed : Spec analysis, architecture review, code generation
36
36
  require deep reasoning. Smaller models miss edge cases.
37
37
 
@@ -140,7 +140,7 @@ If `paths` section is absent, use these defaults:
140
140
  - `domain_knowledge_dir` = `specs/domain-knowledge`
141
141
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
142
142
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
143
- - `tech_docs_dir` = `tech-docs`
143
+ - `tech_docs_dir` = `specs/tech-docs`
144
144
  - `trace_dir` = `.trace`
145
145
 
146
146
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
@@ -217,6 +217,26 @@ If the file does not exist → skip silently.
217
217
 
218
218
  ---
219
219
 
220
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
221
+
222
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
223
+
224
+ ```
225
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
226
+ ```
227
+
228
+ | `platform_type` | Modules |
229
+ |---|---|
230
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
231
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
232
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
233
+
234
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
235
+
236
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
237
+
238
+ ---
239
+
220
240
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
221
241
 
222
242
  After loading all context, synthesize and output a compact summary block.
@@ -227,6 +247,7 @@ Output exactly this block:
227
247
  ```
228
248
  [CTX LOADED]
229
249
  Stack : {language} / {framework} / {database}
250
+ Platform : {active_module} ({platform_type})
230
251
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
231
252
  Ticket : {ticket_prefix}-
232
253
  Dict : {loaded — N canonical terms, M banned terms | missing}
@@ -264,17 +285,59 @@ If no ticket — CHECKPOINT:
264
285
 
265
286
  ## Phase 2 — Root Cause Analysis
266
287
 
288
+ Use `active_module` from context to select the relevant table.
289
+
290
+ ### If `platform_type = backend`
291
+
292
+ #### java-spring / golang / dotnet / php-laravel
293
+
267
294
  | Bug Type | Common Location | How to Check |
268
295
  |----------|----------------|--------------|
269
296
  | Wrong response data | Mapping layer | Check field mapping, DTO conversions |
270
- | 400 Bad Request | Input validation | Check DTO constraints |
297
+ | 400 Bad Request | Input validation | Check DTO constraints / validators |
298
+ | 401 Unauthorized | Auth filter | Check token config, filter order |
271
299
  | 403 Forbidden | Auth config | Check role-based access rules |
272
300
  | 404 Not Found | Repository query | Check find method, ID types |
273
- | N+1 Query | Data access | Check for missing JOIN FETCH |
274
- | Null Pointer | Optional not handled | Check Optional.orElseThrow |
275
- | Transaction rollback | Missing @Transactional | Check transaction scope |
276
- | Stale cache | Missing cache eviction | Check cache invalidation |
277
- | Type mismatch in query | Filter/specification | Check field types in predicates |
301
+ | N+1 Query | Data access | Check for missing JOIN FETCH / eager load |
302
+ | Null Pointer | Optional not handled | Check Optional.orElseThrow, null guards |
303
+ | Transaction rollback | Missing @Transactional | Check transaction scope, propagation |
304
+ | Stale cache | Missing eviction | Check cache invalidation triggers |
305
+ | Type mismatch | Filter / specification | Check field types in predicates |
306
+
307
+ #### context-engineering (AI/LLM pipelines)
308
+
309
+ | Bug Type | Common Location | How to Check |
310
+ |----------|----------------|--------------|
311
+ | Wrong pipeline output | Prompt template | Check prompt content; verify variables are substituted correctly |
312
+ | Missing context in output | Context assembly | Verify all required context blocks are included and non-empty |
313
+ | Schema validation failure | Output parser | Compare raw LLM output vs expected schema; add stricter output instructions |
314
+ | Flaky / non-deterministic results | LLM temperature | Check temperature setting; use fixed seed/mock in tests |
315
+ | API rate limit errors | LLM client | Implement backoff; check quota usage in provider dashboard |
316
+ | Token limit exceeded | Prompt assembly | Reduce context size; add chunking strategy |
317
+
318
+ ### If `platform_type = web-frontend`
319
+
320
+ | Bug Type | Common Location | How to Check |
321
+ |----------|----------------|--------------|
322
+ | Wrong data displayed | State / store | Check state update logic, selector |
323
+ | UI not re-rendering | Missing reactive dep | Check deps array, state immutability |
324
+ | API data not loading | HTTP client / hook | Check network tab, error handler |
325
+ | 401 on API call | Auth token | Check token refresh, header injection |
326
+ | Form not submitting | Validation / handler | Check form state, required fields, errors |
327
+ | Route not found | Router config | Check route definition, lazy import |
328
+ | Build / type error | TypeScript types | Compare type definitions vs actual API shape |
329
+
330
+ ### If `platform_type = mobile`
331
+
332
+ | Bug Type | Common Location | How to Check |
333
+ |----------|----------------|--------------|
334
+ | Screen shows stale data | State / BLoC / ViewModel | Check event dispatched, state emitted correctly |
335
+ | Crash on navigation | Route param missing | Check params passed, null safety |
336
+ | API call not firing | Repository / service layer | Add log in repo method, check network |
337
+ | UI not reflecting state | Widget not observing stream | Check `BlocBuilder` / `StateObserver` setup |
338
+ | Crash on app resume | Lifecycle handler | Check `onResume` / `viewDidAppear` logic |
339
+ | Auth token expired | Token refresh logic | Check refresh flow, token storage |
340
+ | Permission denied | OS permission | Check runtime permission request code |
278
341
 
279
342
  CHECKPOINT — Root Cause Report:
280
343
  ```
@@ -342,6 +405,7 @@ Suggest the logical next command based on workflow phase:
342
405
 
343
406
  | Current command | Suggest next |
344
407
  |-------------------------|-----------------------------------------------|
408
+ | /setup-ai-first | `/define-product` to start your first feature |
345
409
  | /define-product | `/generate-prd {product-definition-file}` |
346
410
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
347
411
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -350,13 +414,13 @@ Suggest the logical next command based on workflow phase:
350
414
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
351
415
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
352
416
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
353
- | /generate-code | `/generate-tests {UC-ID}` |
417
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
354
418
  | /generate-tests | `/run-tests {UC-ID}` |
355
419
  | /run-tests (passing) | `/review-code {UC-ID}` |
356
420
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
357
421
  | /review-code | `/smoke-test {UC-ID}` or create PR |
358
422
  | /smoke-test | Create PR and link to ticket |
359
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
423
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
360
424
  | /fix-bug | Create PR and link to ticket |
361
425
  | /debug | `/fix-bug {ticket-id}` if fix needed |
362
426
 
@@ -20,17 +20,59 @@ If no ticket — CHECKPOINT:
20
20
 
21
21
  ## Phase 2 — Root Cause Analysis
22
22
 
23
+ Use `active_module` from context to select the relevant table.
24
+
25
+ ### If `platform_type = backend`
26
+
27
+ #### java-spring / golang / dotnet / php-laravel
28
+
23
29
  | Bug Type | Common Location | How to Check |
24
30
  |----------|----------------|--------------|
25
31
  | Wrong response data | Mapping layer | Check field mapping, DTO conversions |
26
- | 400 Bad Request | Input validation | Check DTO constraints |
32
+ | 400 Bad Request | Input validation | Check DTO constraints / validators |
33
+ | 401 Unauthorized | Auth filter | Check token config, filter order |
27
34
  | 403 Forbidden | Auth config | Check role-based access rules |
28
35
  | 404 Not Found | Repository query | Check find method, ID types |
29
- | N+1 Query | Data access | Check for missing JOIN FETCH |
30
- | Null Pointer | Optional not handled | Check Optional.orElseThrow |
31
- | Transaction rollback | Missing @Transactional | Check transaction scope |
32
- | Stale cache | Missing cache eviction | Check cache invalidation |
33
- | Type mismatch in query | Filter/specification | Check field types in predicates |
36
+ | N+1 Query | Data access | Check for missing JOIN FETCH / eager load |
37
+ | Null Pointer | Optional not handled | Check Optional.orElseThrow, null guards |
38
+ | Transaction rollback | Missing @Transactional | Check transaction scope, propagation |
39
+ | Stale cache | Missing eviction | Check cache invalidation triggers |
40
+ | Type mismatch | Filter / specification | Check field types in predicates |
41
+
42
+ #### context-engineering (AI/LLM pipelines)
43
+
44
+ | Bug Type | Common Location | How to Check |
45
+ |----------|----------------|--------------|
46
+ | Wrong pipeline output | Prompt template | Check prompt content; verify variables are substituted correctly |
47
+ | Missing context in output | Context assembly | Verify all required context blocks are included and non-empty |
48
+ | Schema validation failure | Output parser | Compare raw LLM output vs expected schema; add stricter output instructions |
49
+ | Flaky / non-deterministic results | LLM temperature | Check temperature setting; use fixed seed/mock in tests |
50
+ | API rate limit errors | LLM client | Implement backoff; check quota usage in provider dashboard |
51
+ | Token limit exceeded | Prompt assembly | Reduce context size; add chunking strategy |
52
+
53
+ ### If `platform_type = web-frontend`
54
+
55
+ | Bug Type | Common Location | How to Check |
56
+ |----------|----------------|--------------|
57
+ | Wrong data displayed | State / store | Check state update logic, selector |
58
+ | UI not re-rendering | Missing reactive dep | Check deps array, state immutability |
59
+ | API data not loading | HTTP client / hook | Check network tab, error handler |
60
+ | 401 on API call | Auth token | Check token refresh, header injection |
61
+ | Form not submitting | Validation / handler | Check form state, required fields, errors |
62
+ | Route not found | Router config | Check route definition, lazy import |
63
+ | Build / type error | TypeScript types | Compare type definitions vs actual API shape |
64
+
65
+ ### If `platform_type = mobile`
66
+
67
+ | Bug Type | Common Location | How to Check |
68
+ |----------|----------------|--------------|
69
+ | Screen shows stale data | State / BLoC / ViewModel | Check event dispatched, state emitted correctly |
70
+ | Crash on navigation | Route param missing | Check params passed, null safety |
71
+ | API call not firing | Repository / service layer | Add log in repo method, check network |
72
+ | UI not reflecting state | Widget not observing stream | Check `BlocBuilder` / `StateObserver` setup |
73
+ | Crash on app resume | Lifecycle handler | Check `onResume` / `viewDidAppear` logic |
74
+ | Auth token expired | Token refresh logic | Check refresh flow, token storage |
75
+ | Permission denied | OS permission | Check runtime permission request code |
34
76
 
35
77
  CHECKPOINT — Root Cause Report:
36
78
  ```