@anhth2/spec-driven-dev-plugin 0.5.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 (76) hide show
  1. package/ARCHITECTURE.md +1 -1
  2. package/bin/index.js +184 -15
  3. package/commands/debug.md +196 -10
  4. package/commands/debug.tmpl +170 -6
  5. package/commands/define-product.md +31 -5
  6. package/commands/define-product.tmpl +5 -1
  7. package/commands/fix-bug.md +74 -10
  8. package/commands/fix-bug.tmpl +48 -6
  9. package/commands/generate-bdd.md +49 -8
  10. package/commands/generate-bdd.tmpl +23 -4
  11. package/commands/generate-code.md +109 -18
  12. package/commands/generate-code.tmpl +83 -14
  13. package/commands/generate-prd.md +33 -6
  14. package/commands/generate-prd.tmpl +7 -2
  15. package/commands/generate-tech-docs.md +85 -8
  16. package/commands/generate-tech-docs.tmpl +59 -4
  17. package/commands/generate-tests.md +454 -36
  18. package/commands/generate-tests.tmpl +428 -32
  19. package/commands/refine-prd.md +39 -7
  20. package/commands/refine-prd.tmpl +13 -3
  21. package/commands/review-code.md +57 -5
  22. package/commands/review-code.tmpl +31 -1
  23. package/commands/review-context.md +41 -11
  24. package/commands/review-context.tmpl +15 -7
  25. package/commands/review-tech-docs.md +39 -8
  26. package/commands/review-tech-docs.tmpl +13 -4
  27. package/commands/run-tests.md +159 -17
  28. package/commands/run-tests.tmpl +133 -13
  29. package/commands/setup-ai-first.md +85 -9
  30. package/commands/setup-ai-first.tmpl +30 -8
  31. package/commands/smoke-test.md +191 -21
  32. package/commands/smoke-test.tmpl +165 -17
  33. package/commands/validate-traces.md +40 -7
  34. package/commands/validate-traces.tmpl +14 -3
  35. package/core/FRAMEWORK_VERSION +1 -1
  36. package/core/commands/debug.md +196 -10
  37. package/core/commands/define-product.md +31 -5
  38. package/core/commands/fix-bug.md +74 -10
  39. package/core/commands/generate-bdd.md +49 -8
  40. package/core/commands/generate-code.md +109 -18
  41. package/core/commands/generate-prd.md +33 -6
  42. package/core/commands/generate-tech-docs.md +85 -8
  43. package/core/commands/generate-tests.md +454 -36
  44. package/core/commands/refine-prd.md +39 -7
  45. package/core/commands/review-code.md +57 -5
  46. package/core/commands/review-context.md +41 -11
  47. package/core/commands/review-tech-docs.md +39 -8
  48. package/core/commands/run-tests.md +159 -17
  49. package/core/commands/setup-ai-first.md +85 -9
  50. package/core/commands/smoke-test.md +191 -21
  51. package/core/commands/validate-traces.md +40 -7
  52. package/core/skills/code/SKILL.md +29 -6
  53. package/core/skills/debug/SKILL.md +31 -7
  54. package/core/skills/discovery/SKILL.md +25 -3
  55. package/core/skills/prd/SKILL.md +8 -6
  56. package/core/skills/setup-ai-first/SKILL.md +3 -2
  57. package/core/skills/spec/SKILL.md +7 -5
  58. package/core/skills/test/SKILL.md +54 -9
  59. package/core/steps/context-loader.md +22 -1
  60. package/core/steps/gate.md +1 -1
  61. package/core/steps/report-footer.md +3 -2
  62. package/core/steps/spawn-agent.md +3 -1
  63. package/package.json +1 -1
  64. package/scripts/init.sh +2 -2
  65. package/scripts/upgrade.sh +4 -4
  66. package/skills/code/SKILL.md +29 -6
  67. package/skills/debug/SKILL.md +31 -7
  68. package/skills/discovery/SKILL.md +25 -3
  69. package/skills/prd/SKILL.md +8 -6
  70. package/skills/setup-ai-first/SKILL.md +3 -2
  71. package/skills/spec/SKILL.md +7 -5
  72. package/skills/test/SKILL.md +54 -9
  73. package/steps/context-loader.md +22 -1
  74. package/steps/gate.md +1 -1
  75. package/steps/report-footer.md +3 -2
  76. package/steps/spawn-agent.md +3 -1
@@ -1,6 +1,6 @@
1
- # /smoke-test — Test Live API Endpoints
1
+ # /smoke-test — Smoke Test Live Service or App
2
2
 
3
- Use when service is **already running**. Different from `/run-tests` (no live server needed).
3
+ Use when service/app is **already running**. Different from `/run-tests` (no live server needed).
4
4
 
5
5
  ## Gate
6
6
  # Gate — Universal Entry Procedure
@@ -33,7 +33,7 @@ Display and wait for response:
33
33
  ```
34
34
  ⚙️ MODEL CHECK
35
35
  ──────────────────────────────────────────────────────────────────
36
- Recommended : claude-opus-4-5 (or claude-opus-4)
36
+ Recommended : claude-opus-4 (or latest Opus model)
37
37
  Why needed : Spec analysis, architecture review, code generation
38
38
  require deep reasoning. Smaller models miss edge cases.
39
39
 
@@ -86,7 +86,7 @@ Wait for explicit "Y" or "N" from the user before continuing.
86
86
  - "N" → stop and ask what the user wants to change.
87
87
 
88
88
 
89
- *Note: For this command, the target in Step 1 is a UC-ID from `$ARGUMENTS`. Context loading provides `conventions.service_run` and port information.*
89
+ *Note: For this command, the target in Step 1 is a UC-ID from `$ARGUMENTS`. Context loading provides `conventions.service_run`, port information, and `tech_stack.module`.*
90
90
 
91
91
  ## Context
92
92
  # Context Loader — Load All Project Context
@@ -142,7 +142,7 @@ If `paths` section is absent, use these defaults:
142
142
  - `domain_knowledge_dir` = `specs/domain-knowledge`
143
143
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
144
144
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
145
- - `tech_docs_dir` = `tech-docs`
145
+ - `tech_docs_dir` = `specs/tech-docs`
146
146
  - `trace_dir` = `.trace`
147
147
 
148
148
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
@@ -219,6 +219,26 @@ If the file does not exist → skip silently.
219
219
 
220
220
  ---
221
221
 
222
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
223
+
224
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
225
+
226
+ ```
227
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
228
+ ```
229
+
230
+ | `platform_type` | Modules |
231
+ |---|---|
232
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
233
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
234
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
235
+
236
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
237
+
238
+ 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).
239
+
240
+ ---
241
+
222
242
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
223
243
 
224
244
  After loading all context, synthesize and output a compact summary block.
@@ -229,6 +249,7 @@ Output exactly this block:
229
249
  ```
230
250
  [CTX LOADED]
231
251
  Stack : {language} / {framework} / {database}
252
+ Platform : {active_module} ({platform_type})
232
253
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
233
254
  Ticket : {ticket_prefix}-
234
255
  Dict : {loaded — N canonical terms, M banned terms | missing}
@@ -256,19 +277,40 @@ Proceed to the next step of the calling command.
256
277
 
257
278
  ---
258
279
 
259
- ## Phase 1 — Find Service URL
280
+ ## Service Detection
281
+
282
+ Read `active_module` from context. Use to select the correct smoke-test approach.
283
+
284
+ | Platform | Modules |
285
+ |---|---|
286
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
287
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
288
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
289
+
290
+ ---
291
+
292
+ ## If `platform_type = backend`
293
+
294
+ ### Phase 1 — Verify service is running
295
+
260
296
  Read `conventions.service_run` from project-context.yaml to determine port.
297
+
261
298
  ```bash
262
- curl -s http://localhost:{port}/health
299
+ # Try common health endpoints (use whichever applies):
300
+ curl -s http://localhost:{port}/health # generic / Go / Node
301
+ curl -s http://localhost:{port}/actuator/health # Spring Boot
302
+ curl -s http://localhost:{port}/ping # some frameworks
263
303
  ```
264
- If not running: "Start with `{conventions.service_run}` from project root."
265
304
 
266
- ## Phase 2 Identify Endpoints
267
- From UC-ID (or `$ARGUMENTS`) → find controller with `@trace.implements={UC-ID}`.
305
+ If not running "Start with `{conventions.service_run}` from project root."
306
+
307
+ ### Phase 2 — Identify endpoints
308
+
309
+ From UC-ID → find controller/handler with `@trace.implements={UC-ID}`.
268
310
  List: method, path, required auth/role.
269
311
 
270
- ## Phase 3 — Get Auth Token (if needed)
271
- Ask:
312
+ ### Phase 3 — Get auth token (if needed)
313
+
272
314
  ```
273
315
  Endpoint requires auth. Options:
274
316
  1. Paste Bearer token (from Postman/DevTools)
@@ -276,10 +318,11 @@ Endpoint requires auth. Options:
276
318
  3. Skip — test public endpoints only
277
319
  ```
278
320
 
279
- ## Phase 4 — Run Smoke Test
321
+ ### Phase 4 — Run
322
+
280
323
  ```bash
281
324
  # GET
282
- curl -s -X GET "http://localhost:{port}/v1/{resource}?page=0&size=5" \
325
+ curl -s -X GET "http://localhost:{port}/v1/{resource}" \
283
326
  -H "Authorization: Bearer {token}" | {JSON_FORMATTER}
284
327
 
285
328
  # POST
@@ -289,7 +332,6 @@ curl -s -X POST "http://localhost:{port}/v1/{resource}" \
289
332
  -d '{"field1": "test_value"}'
290
333
  ```
291
334
 
292
- ## Interpret Results
293
335
  | Result | Meaning |
294
336
  |--------|---------|
295
337
  | 200/201 + correct data | ✅ OK |
@@ -297,9 +339,131 @@ curl -s -X POST "http://localhost:{port}/v1/{resource}" \
297
339
  | 400 | Wrong request body → check required fields |
298
340
  | 401 | Token expired or wrong config |
299
341
  | 403 | Wrong role → check auth rules |
300
- | 500 | Server error → paste into /debug |
342
+ | 500 | Server error → /debug |
301
343
  | Connection refused | Service not running |
302
344
 
345
+ ### If `active_module = context-engineering`
346
+
347
+ #### Phase 1 — Verify pipeline entry point is reachable
348
+
349
+ Run the prompt function directly with a minimal valid input:
350
+
351
+ ```bash
352
+ # Python (pytest / script):
353
+ python -c "from {module}.{function} import {function}; print({function}(input='{test_input}'))"
354
+
355
+ # Or using the project test command with a smoke marker:
356
+ {conventions.test_command} -m smoke -v
357
+ ```
358
+
359
+ #### Phase 2 — Verify output structure
360
+
361
+ Check the output conforms to the expected schema:
362
+
363
+ ```
364
+ Expected output schema: {output fields from @trace or tech-doc}
365
+ Actual output: {paste output here}
366
+ ```
367
+
368
+ #### Phase 3 — Interpret results
369
+
370
+ | Result | Meaning |
371
+ |--------|---------|
372
+ | Output matches schema | ✅ OK |
373
+ | Output present but wrong format | ⚠️ Logic bug → /debug |
374
+ | `APIError` / `AuthenticationError` | API key invalid or service unavailable |
375
+ | `TokenLimitError` | Input too long — check prompt template size |
376
+ | Exception / traceback | Code error → /debug |
377
+
378
+ ---
379
+
380
+ ## If `platform_type = web-frontend`
381
+
382
+ ### Phase 1 — Verify dev server is running
383
+
384
+ ```bash
385
+ # Linux / macOS:
386
+ curl -s -o /dev/null -w "%{http_code}" http://localhost:{port}
387
+
388
+ # Windows (cmd / PowerShell):
389
+ curl -s -o NUL -w "%{http_code}" http://localhost:{port}
390
+
391
+ # Should return 200. If not: start with {conventions.service_run} (e.g., npm run dev)
392
+ ```
393
+
394
+ ### Phase 2 — Run E2E smoke test
395
+
396
+ Identify E2E tool in the project (Playwright or Cypress):
397
+
398
+ ```bash
399
+ # Playwright — run scenarios tagged with this UC:
400
+ npx playwright test --grep "{UC-ID}"
401
+
402
+ # Cypress:
403
+ npx cypress run --spec "cypress/e2e/{UC-ID}*"
404
+ ```
405
+
406
+ If no E2E tests exist yet → open browser and manually verify:
407
+ 1. Navigate to the route for this UC
408
+ 2. Perform the main user action
409
+ 3. Confirm the expected outcome is visible
410
+
411
+ ### Phase 3 — Interpret results
412
+
413
+ | Result | Meaning |
414
+ |--------|---------|
415
+ | All E2E tests pass | ✅ OK |
416
+ | Assertion failed | ⚠️ Logic bug → /debug |
417
+ | `ERR_CONNECTION_REFUSED` | Dev server not running |
418
+ | API returns 4xx/5xx | Backend issue → check backend service |
419
+
420
+ ---
421
+
422
+ ## If `platform_type = mobile`
423
+
424
+ ### Phase 1 — Verify device/emulator is ready
425
+
426
+ ```bash
427
+ # Flutter:
428
+ flutter devices # list connected devices/emulators
429
+ flutter install # install current build on device
430
+
431
+ # React Native:
432
+ npx react-native run-android # build + install on connected Android
433
+ npx react-native run-ios # build + install on iOS simulator
434
+
435
+ # Android (Compose):
436
+ ./gradlew installDebug # install APK on connected device/emulator
437
+
438
+ # iOS (SwiftUI):
439
+ # Open Xcode → select simulator → Product → Run
440
+ ```
441
+
442
+ ### Phase 2 — Manual smoke-test checklist
443
+
444
+ For the UC under test, verify on device:
445
+ 1. Navigate to the screen for this UC
446
+ 2. Perform the main action from the `.feature` Scenario (`When` step)
447
+ 3. Confirm the expected outcome is visible (`Then` step)
448
+ 4. Check for any crash or unexpected error dialog
449
+
450
+ ### Phase 3 — Capture issues if found
451
+
452
+ ```bash
453
+ # Flutter:
454
+ flutter logs
455
+
456
+ # Android:
457
+ adb logcat -d | grep -i "error\|exception\|crash"
458
+
459
+ # iOS:
460
+ # Copy crash log from Xcode → Devices and Simulators → View Device Logs
461
+ ```
462
+
463
+ Paste output into `/debug`.
464
+
465
+ ---
466
+
303
467
  ## Output
304
468
 
305
469
  # Report Footer — Standard Command Output Format
@@ -330,6 +494,7 @@ Suggest the logical next command based on workflow phase:
330
494
 
331
495
  | Current command | Suggest next |
332
496
  |-------------------------|-----------------------------------------------|
497
+ | /setup-ai-first | `/define-product` to start your first feature |
333
498
  | /define-product | `/generate-prd {product-definition-file}` |
334
499
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
335
500
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -338,13 +503,13 @@ Suggest the logical next command based on workflow phase:
338
503
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
339
504
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
340
505
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
341
- | /generate-code | `/generate-tests {UC-ID}` |
506
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
342
507
  | /generate-tests | `/run-tests {UC-ID}` |
343
508
  | /run-tests (passing) | `/review-code {UC-ID}` |
344
509
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
345
510
  | /review-code | `/smoke-test {UC-ID}` or create PR |
346
511
  | /smoke-test | Create PR and link to ticket |
347
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
512
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
348
513
  | /fix-bug | Create PR and link to ticket |
349
514
  | /debug | `/fix-bug {ticket-id}` if fix needed |
350
515
 
@@ -359,8 +524,13 @@ Next : {suggested command with example arguments}
359
524
 
360
525
  ```
361
526
  /smoke-test Report — {UC-ID}
362
- | Method | Path | Status | Result |
363
- |--------|------|--------|--------|
527
+ Platform: {backend | web-frontend | mobile}
528
+ | Endpoint / Flow | Status | Result |
529
+ |-----------------------|-------------|---------|
530
+ | {method} {path/screen}| ✅/⚠️/❌ | {notes} |
531
+
532
+ Status legend: ✅ = OK | ⚠️ = Responded but wrong data / logic bug | ❌ = Error / not running
533
+
364
534
  Issues: {describe any failures}
365
- Next: /debug {stacktrace} OR /fix-bug {TICKET_ID} OR ready to PR
535
+ Next: /debug (paste error interactively) OR /fix-bug {TICKET_ID} OR ready to PR
366
536
  ```
@@ -33,7 +33,7 @@ Display and wait for response:
33
33
  ```
34
34
  ⚙️ MODEL CHECK
35
35
  ──────────────────────────────────────────────────────────────────
36
- Recommended : claude-opus-4-5 (or claude-opus-4)
36
+ Recommended : claude-opus-4 (or latest Opus model)
37
37
  Why needed : Spec analysis, architecture review, code generation
38
38
  require deep reasoning. Smaller models miss edge cases.
39
39
 
@@ -142,7 +142,7 @@ If `paths` section is absent, use these defaults:
142
142
  - `domain_knowledge_dir` = `specs/domain-knowledge`
143
143
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
144
144
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
145
- - `tech_docs_dir` = `tech-docs`
145
+ - `tech_docs_dir` = `specs/tech-docs`
146
146
  - `trace_dir` = `.trace`
147
147
 
148
148
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
@@ -219,6 +219,26 @@ If the file does not exist → skip silently.
219
219
 
220
220
  ---
221
221
 
222
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
223
+
224
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
225
+
226
+ ```
227
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
228
+ ```
229
+
230
+ | `platform_type` | Modules |
231
+ |---|---|
232
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
233
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
234
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
235
+
236
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
237
+
238
+ 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).
239
+
240
+ ---
241
+
222
242
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
223
243
 
224
244
  After loading all context, synthesize and output a compact summary block.
@@ -229,6 +249,7 @@ Output exactly this block:
229
249
  ```
230
250
  [CTX LOADED]
231
251
  Stack : {language} / {framework} / {database}
252
+ Platform : {active_module} ({platform_type})
232
253
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
233
254
  Ticket : {ticket_prefix}-
234
255
  Dict : {loaded — N canonical terms, M banned terms | missing}
@@ -263,6 +284,13 @@ Proceed to the next step of the calling command.
263
284
  Read all `{paths.trace_dir}/{UC-ID}.tsv` files matching the target domain (or all domains if no domain filter).
264
285
  Each file gives the persisted trace state for that UC.
265
286
 
287
+ **If no `.tsv` files found** in `{paths.trace_dir}`:
288
+ - Scan all `{paths.specs_dir}/**/*.feature` files in the target domain to build an in-memory list of all scenarios.
289
+ - Treat all scenarios as `UNTRACKED` (no code generated yet).
290
+ - Print: "⚠️ No trace files found. All {N} scenarios across {M} UCs are UNTRACKED."
291
+ - Suggest: "Run `/generate-bdd {prd-file}` to initialize trace state, or `/generate-code {feature-file}` to generate code."
292
+ - **Skip Steps 2–6 entirely.** Proceed directly to Step 7 using this in-memory state — do NOT abort.
293
+
266
294
  ### Step 2 — Reconcile with current `.feature` files
267
295
 
268
296
  For each `.tsv` row, read the corresponding `.feature` file and get the **current** `@trace.sc_version` for that SC.
@@ -300,6 +328,8 @@ If code was generated from an older revision → flag `TECHDOC_DRIFT`.
300
328
 
301
329
  ### Step 6 — Write status back to TSV
302
330
 
331
+ *Skip this step if no TSV files existed (handled by Step 1 no-TSV path).*
332
+
303
333
  For each `.tsv` file processed: write updated `spec_ver`, `status`, `last_updated` back to disk.
304
334
 
305
335
  ### Step 7 — Compute dashboard aggregates
@@ -309,6 +339,7 @@ total_prds = count distinct PRD files in {paths.prd_dir}/{domain}/
309
339
  approved_prds = PRDs with | Status | approved
310
340
  total_ucs = count distinct UC-IDs across all .tsv files
311
341
  approved_ucs = UCs with uc_status == approved
342
+ draft_ucs = UCs with uc_status == draft
312
343
  total_scs = total rows across all .tsv files
313
344
  code_coverage = rows where implemented_by != — / total_scs
314
345
  test_coverage = rows where test_count > 0 / total_scs
@@ -320,7 +351,7 @@ tech_docs_count = count .md files in {paths.tech_docs_dir}/{domain}/
320
351
 
321
352
  ### Step 8 — Write JSON report
322
353
 
323
- Write `.trace/trace-report.json` (overwrite if exists). This file is the single source of truth for web dashboards — it contains the full snapshot at the time `/validate-traces` was last run.
354
+ Write `{paths.trace_dir}/trace-report.json` (overwrite if exists). This file is the single source of truth for web dashboards — it contains the full snapshot at the time `/validate-traces` was last run.
324
355
 
325
356
  Schema:
326
357
 
@@ -430,7 +461,8 @@ Schema:
430
461
  - `test_classes`: use `[]` (not `"—"`) when no test classes
431
462
  - `tech_doc_revision`: use integer; `0` if not yet generated
432
463
  - `code_coverage_pct` / `test_coverage_pct`: round to nearest integer (0–100)
433
- - Always write to `.trace/trace-report.json` regardless of domain filter — if a domain filter was applied, include only those PRDs in `prds[]` but note the domain in the `domain` field
464
+ - Always write to `{paths.trace_dir}/trace-report.json` regardless of domain filter — if a domain filter was applied, include only those PRDs in `prds[]` but note the domain in the `domain` field
465
+ - **TSV `"—"` mapping**: when reading TSV files, map dash values to JSON types: `implemented_by: "—"` → `null`; `test_count: "—"` → `0`; `test_classes: "—"` → `[]`; `tech_doc_revision: "—"` → `0`
434
466
 
435
467
  ## Output
436
468
 
@@ -462,6 +494,7 @@ Suggest the logical next command based on workflow phase:
462
494
 
463
495
  | Current command | Suggest next |
464
496
  |-------------------------|-----------------------------------------------|
497
+ | /setup-ai-first | `/define-product` to start your first feature |
465
498
  | /define-product | `/generate-prd {product-definition-file}` |
466
499
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
467
500
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -470,13 +503,13 @@ Suggest the logical next command based on workflow phase:
470
503
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
471
504
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
472
505
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
473
- | /generate-code | `/generate-tests {UC-ID}` |
506
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
474
507
  | /generate-tests | `/run-tests {UC-ID}` |
475
508
  | /run-tests (passing) | `/review-code {UC-ID}` |
476
509
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
477
510
  | /review-code | `/smoke-test {UC-ID}` or create PR |
478
511
  | /smoke-test | Create PR and link to ticket |
479
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
512
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
480
513
  | /fix-bug | Create PR and link to ticket |
481
514
  | /debug | `/fix-bug {ticket-id}` if fix needed |
482
515
 
@@ -492,7 +525,7 @@ Next : {suggested command with example arguments}
492
525
  ```
493
526
  /validate-traces — {domain}
494
527
 
495
- 📄 .trace/trace-report.json ← updated
528
+ 📄 {paths.trace_dir}/trace-report.json ← updated
496
529
 
497
530
  ┌─────────────────────────────────────────────────────────────────────────────────────┐
498
531
  │ PRDs Use Cases Scenarios Code Cov. Test Cov. Drift Untracked Gap │
@@ -43,7 +43,7 @@ Display and wait for response:
43
43
  ```
44
44
  ⚙️ MODEL CHECK
45
45
  ──────────────────────────────────────────────────────────────────
46
- Recommended : claude-opus-4-5 (or claude-opus-4)
46
+ Recommended : claude-opus-4 (or latest Opus model)
47
47
  Why needed : Spec analysis, architecture review, code generation
48
48
  require deep reasoning. Smaller models miss edge cases.
49
49
 
@@ -167,7 +167,7 @@ If `paths` section is absent, use these defaults:
167
167
  - `domain_knowledge_dir` = `specs/domain-knowledge`
168
168
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
169
169
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
170
- - `tech_docs_dir` = `tech-docs`
170
+ - `tech_docs_dir` = `specs/tech-docs`
171
171
  - `trace_dir` = `.trace`
172
172
 
173
173
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
@@ -244,6 +244,26 @@ If the file does not exist → skip silently.
244
244
 
245
245
  ---
246
246
 
247
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
248
+
249
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
250
+
251
+ ```
252
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
253
+ ```
254
+
255
+ | `platform_type` | Modules |
256
+ |---|---|
257
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
258
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
259
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
260
+
261
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
262
+
263
+ 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).
264
+
265
+ ---
266
+
247
267
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
248
268
 
249
269
  After loading all context, synthesize and output a compact summary block.
@@ -254,6 +274,7 @@ Output exactly this block:
254
274
  ```
255
275
  [CTX LOADED]
256
276
  Stack : {language} / {framework} / {database}
277
+ Platform : {active_module} ({platform_type})
257
278
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
258
279
  Ticket : {ticket_prefix}-
259
280
  Dict : {loaded — N canonical terms, M banned terms | missing}
@@ -387,6 +408,7 @@ Suggest the logical next command based on workflow phase:
387
408
 
388
409
  | Current command | Suggest next |
389
410
  |-------------------------|-----------------------------------------------|
411
+ | /setup-ai-first | `/define-product` to start your first feature |
390
412
  | /define-product | `/generate-prd {product-definition-file}` |
391
413
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
392
414
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -395,13 +417,13 @@ Suggest the logical next command based on workflow phase:
395
417
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
396
418
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
397
419
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
398
- | /generate-code | `/generate-tests {UC-ID}` |
420
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
399
421
  | /generate-tests | `/run-tests {UC-ID}` |
400
422
  | /run-tests (passing) | `/review-code {UC-ID}` |
401
423
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
402
424
  | /review-code | `/smoke-test {UC-ID}` or create PR |
403
425
  | /smoke-test | Create PR and link to ticket |
404
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
426
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
405
427
  | /fix-bug | Create PR and link to ticket |
406
428
  | /debug | `/fix-bug {ticket-id}` if fix needed |
407
429
 
@@ -498,6 +520,7 @@ Suggest the logical next command based on workflow phase:
498
520
 
499
521
  | Current command | Suggest next |
500
522
  |-------------------------|-----------------------------------------------|
523
+ | /setup-ai-first | `/define-product` to start your first feature |
501
524
  | /define-product | `/generate-prd {product-definition-file}` |
502
525
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
503
526
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -506,13 +529,13 @@ Suggest the logical next command based on workflow phase:
506
529
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
507
530
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
508
531
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
509
- | /generate-code | `/generate-tests {UC-ID}` |
532
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
510
533
  | /generate-tests | `/run-tests {UC-ID}` |
511
534
  | /run-tests (passing) | `/review-code {UC-ID}` |
512
535
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
513
536
  | /review-code | `/smoke-test {UC-ID}` or create PR |
514
537
  | /smoke-test | Create PR and link to ticket |
515
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
538
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
516
539
  | /fix-bug | Create PR and link to ticket |
517
540
  | /debug | `/fix-bug {ticket-id}` if fix needed |
518
541
 
@@ -82,7 +82,7 @@ If `paths` section is absent, use these defaults:
82
82
  - `domain_knowledge_dir` = `specs/domain-knowledge`
83
83
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
84
84
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
85
- - `tech_docs_dir` = `tech-docs`
85
+ - `tech_docs_dir` = `specs/tech-docs`
86
86
  - `trace_dir` = `.trace`
87
87
 
88
88
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
@@ -159,6 +159,26 @@ If the file does not exist → skip silently.
159
159
 
160
160
  ---
161
161
 
162
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
163
+
164
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
165
+
166
+ ```
167
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
168
+ ```
169
+
170
+ | `platform_type` | Modules |
171
+ |---|---|
172
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
173
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
174
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
175
+
176
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
177
+
178
+ 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).
179
+
180
+ ---
181
+
162
182
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
163
183
 
164
184
  After loading all context, synthesize and output a compact summary block.
@@ -169,6 +189,7 @@ Output exactly this block:
169
189
  ```
170
190
  [CTX LOADED]
171
191
  Stack : {language} / {framework} / {database}
192
+ Platform : {active_module} ({platform_type})
172
193
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
173
194
  Ticket : {ticket_prefix}-
174
195
  Dict : {loaded — N canonical terms, M banned terms | missing}
@@ -325,6 +346,7 @@ Suggest the logical next command based on workflow phase:
325
346
 
326
347
  | Current command | Suggest next |
327
348
  |-------------------------|-----------------------------------------------|
349
+ | /setup-ai-first | `/define-product` to start your first feature |
328
350
  | /define-product | `/generate-prd {product-definition-file}` |
329
351
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
330
352
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -333,13 +355,13 @@ Suggest the logical next command based on workflow phase:
333
355
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
334
356
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
335
357
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
336
- | /generate-code | `/generate-tests {UC-ID}` |
358
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
337
359
  | /generate-tests | `/run-tests {UC-ID}` |
338
360
  | /run-tests (passing) | `/review-code {UC-ID}` |
339
361
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
340
362
  | /review-code | `/smoke-test {UC-ID}` or create PR |
341
363
  | /smoke-test | Create PR and link to ticket |
342
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
364
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
343
365
  | /fix-bug | Create PR and link to ticket |
344
366
  | /debug | `/fix-bug {ticket-id}` if fix needed |
345
367
 
@@ -462,6 +484,7 @@ Suggest the logical next command based on workflow phase:
462
484
 
463
485
  | Current command | Suggest next |
464
486
  |-------------------------|-----------------------------------------------|
487
+ | /setup-ai-first | `/define-product` to start your first feature |
465
488
  | /define-product | `/generate-prd {product-definition-file}` |
466
489
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
467
490
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -470,13 +493,13 @@ Suggest the logical next command based on workflow phase:
470
493
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
471
494
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
472
495
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
473
- | /generate-code | `/generate-tests {UC-ID}` |
496
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
474
497
  | /generate-tests | `/run-tests {UC-ID}` |
475
498
  | /run-tests (passing) | `/review-code {UC-ID}` |
476
499
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
477
500
  | /review-code | `/smoke-test {UC-ID}` or create PR |
478
501
  | /smoke-test | Create PR and link to ticket |
479
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
502
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
480
503
  | /fix-bug | Create PR and link to ticket |
481
504
  | /debug | `/fix-bug {ticket-id}` if fix needed |
482
505
 
@@ -556,6 +579,7 @@ Suggest the logical next command based on workflow phase:
556
579
 
557
580
  | Current command | Suggest next |
558
581
  |-------------------------|-----------------------------------------------|
582
+ | /setup-ai-first | `/define-product` to start your first feature |
559
583
  | /define-product | `/generate-prd {product-definition-file}` |
560
584
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
561
585
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -564,13 +588,13 @@ Suggest the logical next command based on workflow phase:
564
588
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
565
589
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
566
590
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
567
- | /generate-code | `/generate-tests {UC-ID}` |
591
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
568
592
  | /generate-tests | `/run-tests {UC-ID}` |
569
593
  | /run-tests (passing) | `/review-code {UC-ID}` |
570
594
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
571
595
  | /review-code | `/smoke-test {UC-ID}` or create PR |
572
596
  | /smoke-test | Create PR and link to ticket |
573
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
597
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
574
598
  | /fix-bug | Create PR and link to ticket |
575
599
  | /debug | `/fix-bug {ticket-id}` if fix needed |
576
600