@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
@@ -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
  ```
@@ -1,30 +1,51 @@
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
  {{include:steps/gate.md}}
7
7
 
8
- *Note: For this command, the target in Step 1 is a UC-ID from `$ARGUMENTS`. Context loading provides `conventions.service_run` and port information.*
8
+ *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`.*
9
9
 
10
10
  ## Context
11
11
  {{include:steps/context-loader.md}}
12
12
 
13
13
  ---
14
14
 
15
- ## Phase 1 — Find Service URL
15
+ ## Service Detection
16
+
17
+ Read `active_module` from context. Use to select the correct smoke-test approach.
18
+
19
+ | Platform | Modules |
20
+ |---|---|
21
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
22
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
23
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
24
+
25
+ ---
26
+
27
+ ## If `platform_type = backend`
28
+
29
+ ### Phase 1 — Verify service is running
30
+
16
31
  Read `conventions.service_run` from project-context.yaml to determine port.
32
+
17
33
  ```bash
18
- curl -s http://localhost:{port}/health
34
+ # Try common health endpoints (use whichever applies):
35
+ curl -s http://localhost:{port}/health # generic / Go / Node
36
+ curl -s http://localhost:{port}/actuator/health # Spring Boot
37
+ curl -s http://localhost:{port}/ping # some frameworks
19
38
  ```
20
- If not running: "Start with `{conventions.service_run}` from project root."
21
39
 
22
- ## Phase 2 Identify Endpoints
23
- From UC-ID (or `$ARGUMENTS`) → find controller with `@trace.implements={UC-ID}`.
40
+ If not running "Start with `{conventions.service_run}` from project root."
41
+
42
+ ### Phase 2 — Identify endpoints
43
+
44
+ From UC-ID → find controller/handler with `@trace.implements={UC-ID}`.
24
45
  List: method, path, required auth/role.
25
46
 
26
- ## Phase 3 — Get Auth Token (if needed)
27
- Ask:
47
+ ### Phase 3 — Get auth token (if needed)
48
+
28
49
  ```
29
50
  Endpoint requires auth. Options:
30
51
  1. Paste Bearer token (from Postman/DevTools)
@@ -32,10 +53,11 @@ Endpoint requires auth. Options:
32
53
  3. Skip — test public endpoints only
33
54
  ```
34
55
 
35
- ## Phase 4 — Run Smoke Test
56
+ ### Phase 4 — Run
57
+
36
58
  ```bash
37
59
  # GET
38
- curl -s -X GET "http://localhost:{port}/v1/{resource}?page=0&size=5" \
60
+ curl -s -X GET "http://localhost:{port}/v1/{resource}" \
39
61
  -H "Authorization: Bearer {token}" | {JSON_FORMATTER}
40
62
 
41
63
  # POST
@@ -45,7 +67,6 @@ curl -s -X POST "http://localhost:{port}/v1/{resource}" \
45
67
  -d '{"field1": "test_value"}'
46
68
  ```
47
69
 
48
- ## Interpret Results
49
70
  | Result | Meaning |
50
71
  |--------|---------|
51
72
  | 200/201 + correct data | ✅ OK |
@@ -53,17 +74,144 @@ curl -s -X POST "http://localhost:{port}/v1/{resource}" \
53
74
  | 400 | Wrong request body → check required fields |
54
75
  | 401 | Token expired or wrong config |
55
76
  | 403 | Wrong role → check auth rules |
56
- | 500 | Server error → paste into /debug |
77
+ | 500 | Server error → /debug |
57
78
  | Connection refused | Service not running |
58
79
 
80
+ ### If `active_module = context-engineering`
81
+
82
+ #### Phase 1 — Verify pipeline entry point is reachable
83
+
84
+ Run the prompt function directly with a minimal valid input:
85
+
86
+ ```bash
87
+ # Python (pytest / script):
88
+ python -c "from {module}.{function} import {function}; print({function}(input='{test_input}'))"
89
+
90
+ # Or using the project test command with a smoke marker:
91
+ {conventions.test_command} -m smoke -v
92
+ ```
93
+
94
+ #### Phase 2 — Verify output structure
95
+
96
+ Check the output conforms to the expected schema:
97
+
98
+ ```
99
+ Expected output schema: {output fields from @trace or tech-doc}
100
+ Actual output: {paste output here}
101
+ ```
102
+
103
+ #### Phase 3 — Interpret results
104
+
105
+ | Result | Meaning |
106
+ |--------|---------|
107
+ | Output matches schema | ✅ OK |
108
+ | Output present but wrong format | ⚠️ Logic bug → /debug |
109
+ | `APIError` / `AuthenticationError` | API key invalid or service unavailable |
110
+ | `TokenLimitError` | Input too long — check prompt template size |
111
+ | Exception / traceback | Code error → /debug |
112
+
113
+ ---
114
+
115
+ ## If `platform_type = web-frontend`
116
+
117
+ ### Phase 1 — Verify dev server is running
118
+
119
+ ```bash
120
+ # Linux / macOS:
121
+ curl -s -o /dev/null -w "%{http_code}" http://localhost:{port}
122
+
123
+ # Windows (cmd / PowerShell):
124
+ curl -s -o NUL -w "%{http_code}" http://localhost:{port}
125
+
126
+ # Should return 200. If not: start with {conventions.service_run} (e.g., npm run dev)
127
+ ```
128
+
129
+ ### Phase 2 — Run E2E smoke test
130
+
131
+ Identify E2E tool in the project (Playwright or Cypress):
132
+
133
+ ```bash
134
+ # Playwright — run scenarios tagged with this UC:
135
+ npx playwright test --grep "{UC-ID}"
136
+
137
+ # Cypress:
138
+ npx cypress run --spec "cypress/e2e/{UC-ID}*"
139
+ ```
140
+
141
+ If no E2E tests exist yet → open browser and manually verify:
142
+ 1. Navigate to the route for this UC
143
+ 2. Perform the main user action
144
+ 3. Confirm the expected outcome is visible
145
+
146
+ ### Phase 3 — Interpret results
147
+
148
+ | Result | Meaning |
149
+ |--------|---------|
150
+ | All E2E tests pass | ✅ OK |
151
+ | Assertion failed | ⚠️ Logic bug → /debug |
152
+ | `ERR_CONNECTION_REFUSED` | Dev server not running |
153
+ | API returns 4xx/5xx | Backend issue → check backend service |
154
+
155
+ ---
156
+
157
+ ## If `platform_type = mobile`
158
+
159
+ ### Phase 1 — Verify device/emulator is ready
160
+
161
+ ```bash
162
+ # Flutter:
163
+ flutter devices # list connected devices/emulators
164
+ flutter install # install current build on device
165
+
166
+ # React Native:
167
+ npx react-native run-android # build + install on connected Android
168
+ npx react-native run-ios # build + install on iOS simulator
169
+
170
+ # Android (Compose):
171
+ ./gradlew installDebug # install APK on connected device/emulator
172
+
173
+ # iOS (SwiftUI):
174
+ # Open Xcode → select simulator → Product → Run
175
+ ```
176
+
177
+ ### Phase 2 — Manual smoke-test checklist
178
+
179
+ For the UC under test, verify on device:
180
+ 1. Navigate to the screen for this UC
181
+ 2. Perform the main action from the `.feature` Scenario (`When` step)
182
+ 3. Confirm the expected outcome is visible (`Then` step)
183
+ 4. Check for any crash or unexpected error dialog
184
+
185
+ ### Phase 3 — Capture issues if found
186
+
187
+ ```bash
188
+ # Flutter:
189
+ flutter logs
190
+
191
+ # Android:
192
+ adb logcat -d | grep -i "error\|exception\|crash"
193
+
194
+ # iOS:
195
+ # Copy crash log from Xcode → Devices and Simulators → View Device Logs
196
+ ```
197
+
198
+ Paste output into `/debug`.
199
+
200
+ ---
201
+
59
202
  ## Output
60
203
 
61
204
  {{include:steps/report-footer.md}}
62
205
 
63
206
  ```
64
207
  /smoke-test Report — {UC-ID}
65
- | Method | Path | Status | Result |
66
- |--------|------|--------|--------|
208
+ Platform: {backend | web-frontend | mobile}
209
+ | Endpoint / Flow | Status | Result |
210
+ |-----------------------|-------------|---------|
211
+ | {method} {path/screen}| ✅/⚠️/❌ | {notes} |
212
+
213
+ Status legend: ✅ = OK | ⚠️ = Responded but wrong data / logic bug | ❌ = Error / not running
214
+
67
215
  Issues: {describe any failures}
68
- Next: /debug {stacktrace} OR /fix-bug {TICKET_ID} OR ready to PR
216
+ Next: /debug (paste error interactively) OR /fix-bug {TICKET_ID} OR ready to PR
69
217
  ```
@@ -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 │