@anhth2/spec-driven-dev-plugin 0.6.0 → 0.8.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 (86) hide show
  1. package/bin/index.js +285 -11
  2. package/commands/debug.md +233 -11
  3. package/commands/debug.tmpl +170 -6
  4. package/commands/define-product.md +68 -6
  5. package/commands/define-product.tmpl +5 -1
  6. package/commands/fix-bug.md +111 -11
  7. package/commands/fix-bug.tmpl +48 -6
  8. package/commands/generate-bdd.md +86 -9
  9. package/commands/generate-bdd.tmpl +23 -4
  10. package/commands/generate-code.md +146 -19
  11. package/commands/generate-code.tmpl +83 -14
  12. package/commands/generate-design-spec.md +754 -0
  13. package/commands/generate-design-spec.tmpl +399 -0
  14. package/commands/generate-prd.md +91 -7
  15. package/commands/generate-prd.tmpl +28 -2
  16. package/commands/generate-spec-manifest.md +519 -0
  17. package/commands/generate-spec-manifest.tmpl +164 -0
  18. package/commands/generate-tech-docs.md +122 -9
  19. package/commands/generate-tech-docs.tmpl +59 -4
  20. package/commands/generate-tests.md +491 -37
  21. package/commands/generate-tests.tmpl +428 -32
  22. package/commands/refine-prd.md +76 -8
  23. package/commands/refine-prd.tmpl +13 -3
  24. package/commands/review-code.md +94 -6
  25. package/commands/review-code.tmpl +31 -1
  26. package/commands/review-context.md +118 -12
  27. package/commands/review-context.tmpl +55 -7
  28. package/commands/review-tech-docs.md +76 -9
  29. package/commands/review-tech-docs.tmpl +13 -4
  30. package/commands/run-tests.md +196 -18
  31. package/commands/run-tests.tmpl +133 -13
  32. package/commands/setup-ai-first.md +192 -6
  33. package/commands/setup-ai-first.tmpl +136 -5
  34. package/commands/smoke-test.md +228 -22
  35. package/commands/smoke-test.tmpl +165 -17
  36. package/commands/validate-traces.md +77 -8
  37. package/commands/validate-traces.tmpl +14 -3
  38. package/core/FRAMEWORK_VERSION +1 -1
  39. package/core/commands/debug.md +233 -11
  40. package/core/commands/define-product.md +68 -6
  41. package/core/commands/fix-bug.md +111 -11
  42. package/core/commands/generate-bdd.md +86 -9
  43. package/core/commands/generate-code.md +146 -19
  44. package/core/commands/generate-design-spec.md +754 -0
  45. package/core/commands/generate-prd.md +91 -7
  46. package/core/commands/generate-spec-manifest.md +519 -0
  47. package/core/commands/generate-tech-docs.md +122 -9
  48. package/core/commands/generate-tests.md +491 -37
  49. package/core/commands/refine-prd.md +76 -8
  50. package/core/commands/review-code.md +94 -6
  51. package/core/commands/review-context.md +118 -12
  52. package/core/commands/review-tech-docs.md +76 -9
  53. package/core/commands/run-tests.md +196 -18
  54. package/core/commands/setup-ai-first.md +192 -6
  55. package/core/commands/smoke-test.md +228 -22
  56. package/core/commands/validate-traces.md +77 -8
  57. package/core/skills/code/SKILL.md +68 -8
  58. package/core/skills/debug/SKILL.md +72 -10
  59. package/core/skills/design-spec/SKILL.md +450 -0
  60. package/core/skills/discovery/SKILL.md +62 -4
  61. package/core/skills/prd/SKILL.md +12 -8
  62. package/core/skills/setup-ai-first/SKILL.md +5 -3
  63. package/core/skills/spec/SKILL.md +11 -7
  64. package/core/skills/test/SKILL.md +130 -12
  65. package/core/steps/context-loader.md +57 -1
  66. package/core/steps/gate.md +1 -1
  67. package/core/steps/report-footer.md +5 -3
  68. package/core/steps/spawn-agent.md +3 -1
  69. package/core/templates/design-spec.template.md +209 -0
  70. package/core/templates/project-context.yaml +29 -0
  71. package/package.json +1 -1
  72. package/skills/code/SKILL.md +68 -8
  73. package/skills/debug/SKILL.md +72 -10
  74. package/skills/design-spec/SKILL.md +450 -0
  75. package/skills/design-spec/SKILL.tmpl +95 -0
  76. package/skills/discovery/SKILL.md +62 -4
  77. package/skills/prd/SKILL.md +12 -8
  78. package/skills/setup-ai-first/SKILL.md +5 -3
  79. package/skills/spec/SKILL.md +11 -7
  80. package/skills/test/SKILL.md +130 -12
  81. package/steps/context-loader.md +57 -1
  82. package/steps/gate.md +1 -1
  83. package/steps/report-footer.md +5 -3
  84. package/steps/spawn-agent.md +3 -1
  85. package/templates/design-spec.template.md +209 -0
  86. package/templates/project-context.yaml +29 -0
@@ -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
 
@@ -98,6 +98,51 @@ Check if already set up:
98
98
  - Y → continue (existing files will be preserved — each step will offer merge/skip)
99
99
  - If only `specs/` exists or only partial setup detected → continue normally (safe to re-run)
100
100
 
101
+ ## Step 0.5 — Project Type
102
+
103
+ Ask the user:
104
+
105
+ ```
106
+ What type of project is this?
107
+ 1. Single-service — one codebase, one platform (standard setup)
108
+ 2. Umbrella repo — this repo contains multiple service submodules (microservices / multi-app)
109
+ 3. PO Spec repo — docs only, no runnable code (PRD + design-spec only)
110
+ ```
111
+
112
+ Store the answer as `project_type`. Default to `1` if user does not answer.
113
+
114
+ Based on answer:
115
+
116
+ **project_type = 1 (Single-service):** Continue standard setup below.
117
+
118
+ **project_type = 2 (Umbrella):** Ask two follow-up questions:
119
+ - "Path to spec submodule (e.g. `free-trial-specs`)? Press Enter to skip."
120
+ - "List services as `domain:module` pairs, comma-separated
121
+ (e.g. `user:java-spring,order:java-spring`). Press Enter to skip."
122
+
123
+ Then:
124
+ - Skip creating `specs/prd/`, `specs/design-spec/`, `specs/domain-knowledge/` (those live in spec submodule)
125
+ - Create only: `specs/bdd/`, `specs/tech-docs/`, `.trace/`, `.agent/review/` at umbrella level
126
+ *(Unless user explicitly asks to create the full structure)*
127
+ - Generate `.agent/project-context.yaml` in umbrella mode with the services and spec_source provided
128
+ - Skip creating `CLAUDE.md` (umbrella has no single tech stack)
129
+ - After setup, remind: "Open each service submodule separately in Claude Code to install the framework there if needed."
130
+
131
+ **project_type = 3 (PO Spec repo):**
132
+ - Create: `specs/prd/`, `specs/design-spec/`, `specs/product-definition/`, `specs/domain-knowledge/`, `.agent/review/`
133
+ - Skip: `specs/bdd/`, `specs/tech-docs/`, `.trace/`
134
+ - Generate minimal `CLAUDE.md` with only §1 (project overview) and §7 (git conventions)
135
+ - Ask the user: **"List your business domains (e.g. auth, payment, loyalty):"** — store as domain list for `project-context.yaml` and remind PO these names must be used consistently as `@trace.domain` in every PRD
136
+ - Inform:
137
+ - Commands for PO repo: `/define-product`, `/generate-prd`, `/review-context`, `/generate-design-spec`
138
+ - **Critical for dev team handoff:** Every PRD must have `@trace.domain: {domain}` in its frontmatter. Dev team uses this to route generated BDD/code to the correct service submodule. Inconsistent domain names will break routing.
139
+ - Recommended PRD frontmatter:
140
+ ```
141
+ @trace.domain: {domain} ← must match a key in dev team's services config
142
+ @trace.id: {TICKET-ID}
143
+ @trace.status: draft | approved
144
+ ```
145
+
101
146
  ## Step 1 — Create Directory Structure
102
147
 
103
148
  Create these directories (skip if they exist):
@@ -108,15 +153,27 @@ Create these directories (skip if they exist):
108
153
  │ ├── product-definition/
109
154
  │ ├── prd/
110
155
  │ ├── bdd/
156
+ │ ├── design-spec/ ← Design Spec documents (FE/App platforms only)
157
+ │ ├── tech-docs/ ← technical design documents
111
158
  │ └── domain-knowledge/ ← business dictionary & domain context
112
- ├── tech-docs/
113
159
  ├── .trace/
114
160
  └── .agent/
115
161
  └── review/
116
162
  ```
117
163
 
164
+ *Directory structure varies by `project_type` set in Step 0.5:*
165
+
166
+ | project_type | Create | Skip |
167
+ |---|---|---|
168
+ | **1 — Single-service** | Full structure above | — |
169
+ | **2 — Umbrella** | `.agent/review/` only (at umbrella root) | Everything else — `specs/` dirs live inside service submodules |
170
+ | **3 — PO Spec repo** | `specs/prd/`, `specs/design-spec/`, `specs/product-definition/`, `specs/domain-knowledge/`, `.agent/review/` | `specs/bdd/`, `specs/tech-docs/`, `.trace/` |
171
+
118
172
  ## Step 2 — Create CLAUDE.md
119
173
 
174
+ *Skip this step entirely if `project_type = 2` (Umbrella) — umbrella has no single tech stack.*
175
+ *For `project_type = 3` (PO Spec repo) — create a minimal CLAUDE.md with only §1 (project overview) and §7 (git conventions). Skip §2–§6.*
176
+
120
177
  Check if `CLAUDE.md` exists:
121
178
  - Yes → ask "Merge template or skip?"
122
179
  - No → create from the template below
@@ -153,7 +210,7 @@ forbidden:
153
210
  # §4. Traceability
154
211
  # Every controller method must be tagged:
155
212
  # @trace.implements={UC-ID}-{SC-ID}
156
- # @trace.source=specs/bdd/{domain}/{UC-ID}.feature
213
+ # @trace.source=specs/bdd/{domain}/{UC-ID}.feature ← adjust if specs_dir differs in .agent/project-context.yaml
157
214
  # Tests must be tagged:
158
215
  # @trace.verifies={UC-ID}
159
216
 
@@ -173,12 +230,19 @@ commit_feature: "feat({{TICKET_PREFIX}}-{N}): {description}"
173
230
 
174
231
  ## Step 3 — Create project-context.yaml
175
232
 
233
+ *For `project_type = 2` (Umbrella):*
234
+ - *If `.agent/project-context.yaml` was already generated by `--init --umbrella` → open it and verify/edit the `services` section (domain keys, paths, modules). Skip template copy below.*
235
+ - *If not yet generated → ask: "Spec submodule path?" and "Services (domain:module pairs)?" then generate umbrella config (see Step 0.5 for format).*
236
+
176
237
  Create `.agent/project-context.yaml` using `.agent/templates/project-context.yaml` as the source template.
177
238
 
178
239
  Copy the template and instruct: "Open `.agent/project-context.yaml` and fill in all `{{PLACEHOLDER}}` values. The `paths` section is pre-configured with sensible defaults — adjust if your project uses different directory names."
179
240
 
180
241
  ## Step 4 — Create business-dictionary.md
181
242
 
243
+ *Skip Steps 4 and 5 if `project_type = 2` (Umbrella) — business dictionary and core entities live in the spec submodule and are managed by the PO team. Dev team reads them from `{spec_source}/specs/domain-knowledge/`.*
244
+
245
+
182
246
  Create `specs/domain-knowledge/business-dictionary.md` if it does not exist:
183
247
 
184
248
  ```markdown
@@ -272,7 +336,13 @@ Or: VS Code → `Ctrl+Shift+P` → **"Extensions: Install from Marketplace"**
272
336
 
273
337
  ## Step 7 — Verify
274
338
 
339
+ Checklist varies by `project_type`:
340
+
341
+ **project_type = 1 (Single-service):**
275
342
  - [ ] `specs/` exists
343
+ - [ ] `specs/bdd/` exists
344
+ - [ ] `specs/design-spec/` exists *(skip if backend-only project)*
345
+ - [ ] `specs/tech-docs/` exists
276
346
  - [ ] `specs/domain-knowledge/` exists
277
347
  - [ ] `.trace/` exists
278
348
  - [ ] `.agent/project-context.yaml` exists
@@ -280,17 +350,133 @@ Or: VS Code → `Ctrl+Shift+P` → **"Extensions: Install from Marketplace"**
280
350
  - [ ] `specs/domain-knowledge/business-dictionary.md` exists
281
351
  - [ ] `specs/domain-knowledge/core-entities.md` exists
282
352
 
353
+ **project_type = 2 (Umbrella):**
354
+ - [ ] `.agent/project-context.yaml` exists with `setup.mode: umbrella`
355
+ - [ ] `services` section has at least one entry with correct domain keys
356
+ - [ ] `spec_source` path exists (e.g., `my-project-specs/` directory is present)
357
+ - [ ] `.agent/review/` exists
358
+ - [ ] Spec submodule initialized: `git submodule status` shows no `-` prefix
359
+
360
+ **project_type = 3 (PO Spec repo):**
361
+ - [ ] `specs/prd/` exists
362
+ - [ ] `specs/design-spec/` exists
363
+ - [ ] `specs/product-definition/` exists
364
+ - [ ] `specs/domain-knowledge/` exists
365
+ - [ ] `.agent/review/` exists
366
+ - [ ] `.agent/project-context.yaml` exists
367
+ - [ ] `CLAUDE.md` exists (minimal)
368
+ - [ ] `specs/domain-knowledge/business-dictionary.md` exists
369
+ - [ ] `specs/domain-knowledge/core-entities.md` exists
370
+
283
371
  ## Output
284
372
 
373
+ # Report Footer — Standard Command Output Format
374
+
375
+ Every command report must end with this standard footer section.
376
+
377
+ ## Status Badge
378
+
379
+ Choose one based on outcome:
380
+ - `✅ Complete` — all steps succeeded, no issues found
381
+ - `❌ Failed` — command could not complete due to a blocking error
382
+ - `⚠️ Warnings` — completed with non-blocking issues that should be reviewed
383
+
384
+ ## Output Artifacts
385
+
386
+ List every file created or modified by this command:
387
+ ```
388
+ Output Artifacts:
389
+ {created|updated} {file-path} ({brief description})
390
+ {created|updated} {file-path} ({brief description})
391
+ ```
392
+
393
+ If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
394
+
395
+ ## Next Command Suggestion
396
+
397
+ Suggest the logical next command based on workflow phase:
398
+
399
+ | Current command | Suggest next |
400
+ |-------------------------|-----------------------------------------------|
401
+ | /setup-ai-first | `/define-product` to start your first feature |
402
+ | /define-product | `/generate-prd {product-definition-file}` |
403
+ | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
404
+ | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
405
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
406
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
407
+ | /generate-bdd | `/review-context {feature-file}` to verify coverage |
408
+ | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
409
+ | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
410
+ | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
411
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
412
+ | /generate-tests | `/run-tests {UC-ID}` |
413
+ | /run-tests (passing) | `/review-code {UC-ID}` |
414
+ | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
415
+ | /review-code | `/smoke-test {UC-ID}` or create PR |
416
+ | /smoke-test | Create PR and link to ticket |
417
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
418
+ | /fix-bug | Create PR and link to ticket |
419
+ | /debug | `/fix-bug {ticket-id}` if fix needed |
420
+
421
+ Format the footer as:
422
+ ```
423
+ ---
424
+ Status : {badge}
425
+ {Output Artifacts block}
426
+ Next : {suggested command with example arguments}
427
+ ```
428
+
429
+
285
430
  ```
286
431
  /setup-ai-first Complete ✅
432
+ ```
433
+
434
+ Output varies by `project_type`:
435
+
436
+ **Single-service:**
437
+ ```
287
438
  Next:
288
439
  1. Fill CLAUDE.md (replace {{PLACEHOLDER}} values)
289
440
  2. Fill .agent/project-context.yaml
290
- 3. Fill specs/domain-knowledge/business-dictionary.md ← terminology rules
291
- 4. Fill specs/domain-knowledge/core-entities.md ← entity glossary for code gen
441
+ 3. Fill specs/domain-knowledge/business-dictionary.md
442
+ 4. Fill specs/domain-knowledge/core-entities.md
292
443
  5. git add and commit those 4 files
293
- 6. Install VS Code extension (if not yet installed):
444
+ 6. Install VS Code extension:
294
445
  code --install-extension edupia-team.spec-driven-dev-team
295
446
  7. /define-product to start your first feature
296
447
  ```
448
+
449
+ **Umbrella:**
450
+ ```
451
+ Next:
452
+ 1. Review .agent/project-context.yaml:
453
+ - Update services[].path to match actual submodule directory names
454
+ - Update services domain keys to match @trace.domain in your PRD files
455
+ - Confirm spec_source path is correct
456
+ 2. Ensure spec submodule is initialized:
457
+ git submodule update --init --recursive
458
+ 3. Pull latest specs from PO before generating:
459
+ git submodule update --remote {spec_source}
460
+ 4. Start generating:
461
+ /generate-bdd {spec_source}/specs/prd/{domain}/TICKET-ID-prd.md
462
+ ```
463
+
464
+ **PO Spec repo:**
465
+ ```
466
+ Next:
467
+ 1. Fill .agent/project-context.yaml:
468
+ - domains: [list all business domains — these become @trace.domain values in PRDs]
469
+ - project.name, project.description
470
+ 2. Fill specs/domain-knowledge/business-dictionary.md ← canonical terms
471
+ 3. Fill specs/domain-knowledge/core-entities.md ← entity glossary
472
+ 4. git add and commit those files
473
+ 5. Install VS Code extension:
474
+ code --install-extension edupia-team.spec-driven-dev-team
475
+ 6. /define-product to start your first feature
476
+
477
+ ⚠️ Dev team handoff reminder:
478
+ - Each PRD must have @trace.domain matching one of your domains list
479
+ - When dev team sets up their umbrella repo, they map these domain names
480
+ to service submodule paths in their project-context.yaml services section
481
+ - Share domain names with dev team before they configure their umbrellas
482
+ ```
@@ -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
@@ -133,6 +133,7 @@ Read `.agent/project-context.yaml`. Extract and store:
133
133
  - `paths.core_entities` → path to core-entities.md
134
134
  - `paths.tech_docs_dir` → technical documentation root
135
135
  - `paths.trace_dir` → trace state directory
136
+ - `paths.design_spec_dir` → Design Spec documents root (FE/App only)
136
137
 
137
138
  If `paths` section is absent, use these defaults:
138
139
  - `specs_dir` = `specs/bdd`
@@ -142,13 +143,46 @@ If `paths` section is absent, use these defaults:
142
143
  - `domain_knowledge_dir` = `specs/domain-knowledge`
143
144
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
144
145
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
145
- - `tech_docs_dir` = `tech-docs`
146
+ - `tech_docs_dir` = `specs/tech-docs`
146
147
  - `trace_dir` = `.trace`
148
+ - `design_spec_dir` = `specs/design-spec`
147
149
 
148
150
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
149
151
 
150
152
  ---
151
153
 
154
+ ## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
155
+
156
+ *Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
157
+
158
+ If `services` section is present:
159
+
160
+ **1. Detect active domain** (in priority order):
161
+ - Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
162
+ - Extract from target file path: segment immediately after `prd_dir` base path
163
+ *(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
164
+ - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
165
+
166
+ **2. Route to service** — if active domain matches a key in `services`:
167
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir`
168
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
169
+ - Store `active_service` = `services.{domain}.path`
170
+ - Store `active_service_module` = `services.{domain}.module`
171
+ - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
172
+
173
+ **3. Fallback** — if domain not detected or no matching service key:
174
+ - Keep default paths from Step 1
175
+ - Set `active_service = unresolved`
176
+
177
+ **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
178
+ - Override `paths.prd_dir` → `{spec_source}/specs/prd`
179
+ - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
180
+ - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
181
+ - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
182
+ - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
183
+
184
+ ---
185
+
152
186
  ## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
153
187
 
154
188
  If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
@@ -219,6 +253,26 @@ If the file does not exist → skip silently.
219
253
 
220
254
  ---
221
255
 
256
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
257
+
258
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
259
+
260
+ ```
261
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
262
+ ```
263
+
264
+ | `platform_type` | Modules |
265
+ |---|---|
266
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
267
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
268
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
269
+
270
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
271
+
272
+ 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).
273
+
274
+ ---
275
+
222
276
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
223
277
 
224
278
  After loading all context, synthesize and output a compact summary block.
@@ -229,10 +283,12 @@ Output exactly this block:
229
283
  ```
230
284
  [CTX LOADED]
231
285
  Stack : {language} / {framework} / {database}
286
+ Platform : {active_module} ({platform_type})
232
287
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
233
288
  Ticket : {ticket_prefix}-
234
289
  Dict : {loaded — N canonical terms, M banned terms | missing}
235
290
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
291
+ Service : {active_service} ({active_service_module}) | single-service
236
292
  Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
237
293
  ```
238
294
 
@@ -256,19 +312,40 @@ Proceed to the next step of the calling command.
256
312
 
257
313
  ---
258
314
 
259
- ## Phase 1 — Find Service URL
315
+ ## Service Detection
316
+
317
+ Read `active_module` from context. Use to select the correct smoke-test approach.
318
+
319
+ | Platform | Modules |
320
+ |---|---|
321
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
322
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
323
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
324
+
325
+ ---
326
+
327
+ ## If `platform_type = backend`
328
+
329
+ ### Phase 1 — Verify service is running
330
+
260
331
  Read `conventions.service_run` from project-context.yaml to determine port.
332
+
261
333
  ```bash
262
- curl -s http://localhost:{port}/health
334
+ # Try common health endpoints (use whichever applies):
335
+ curl -s http://localhost:{port}/health # generic / Go / Node
336
+ curl -s http://localhost:{port}/actuator/health # Spring Boot
337
+ curl -s http://localhost:{port}/ping # some frameworks
263
338
  ```
264
- If not running: "Start with `{conventions.service_run}` from project root."
265
339
 
266
- ## Phase 2 Identify Endpoints
267
- From UC-ID (or `$ARGUMENTS`) → find controller with `@trace.implements={UC-ID}`.
340
+ If not running "Start with `{conventions.service_run}` from project root."
341
+
342
+ ### Phase 2 — Identify endpoints
343
+
344
+ From UC-ID → find controller/handler with `@trace.implements={UC-ID}`.
268
345
  List: method, path, required auth/role.
269
346
 
270
- ## Phase 3 — Get Auth Token (if needed)
271
- Ask:
347
+ ### Phase 3 — Get auth token (if needed)
348
+
272
349
  ```
273
350
  Endpoint requires auth. Options:
274
351
  1. Paste Bearer token (from Postman/DevTools)
@@ -276,10 +353,11 @@ Endpoint requires auth. Options:
276
353
  3. Skip — test public endpoints only
277
354
  ```
278
355
 
279
- ## Phase 4 — Run Smoke Test
356
+ ### Phase 4 — Run
357
+
280
358
  ```bash
281
359
  # GET
282
- curl -s -X GET "http://localhost:{port}/v1/{resource}?page=0&size=5" \
360
+ curl -s -X GET "http://localhost:{port}/v1/{resource}" \
283
361
  -H "Authorization: Bearer {token}" | {JSON_FORMATTER}
284
362
 
285
363
  # POST
@@ -289,7 +367,6 @@ curl -s -X POST "http://localhost:{port}/v1/{resource}" \
289
367
  -d '{"field1": "test_value"}'
290
368
  ```
291
369
 
292
- ## Interpret Results
293
370
  | Result | Meaning |
294
371
  |--------|---------|
295
372
  | 200/201 + correct data | ✅ OK |
@@ -297,9 +374,131 @@ curl -s -X POST "http://localhost:{port}/v1/{resource}" \
297
374
  | 400 | Wrong request body → check required fields |
298
375
  | 401 | Token expired or wrong config |
299
376
  | 403 | Wrong role → check auth rules |
300
- | 500 | Server error → paste into /debug |
377
+ | 500 | Server error → /debug |
301
378
  | Connection refused | Service not running |
302
379
 
380
+ ### If `active_module = context-engineering`
381
+
382
+ #### Phase 1 — Verify pipeline entry point is reachable
383
+
384
+ Run the prompt function directly with a minimal valid input:
385
+
386
+ ```bash
387
+ # Python (pytest / script):
388
+ python -c "from {module}.{function} import {function}; print({function}(input='{test_input}'))"
389
+
390
+ # Or using the project test command with a smoke marker:
391
+ {conventions.test_command} -m smoke -v
392
+ ```
393
+
394
+ #### Phase 2 — Verify output structure
395
+
396
+ Check the output conforms to the expected schema:
397
+
398
+ ```
399
+ Expected output schema: {output fields from @trace or tech-doc}
400
+ Actual output: {paste output here}
401
+ ```
402
+
403
+ #### Phase 3 — Interpret results
404
+
405
+ | Result | Meaning |
406
+ |--------|---------|
407
+ | Output matches schema | ✅ OK |
408
+ | Output present but wrong format | ⚠️ Logic bug → /debug |
409
+ | `APIError` / `AuthenticationError` | API key invalid or service unavailable |
410
+ | `TokenLimitError` | Input too long — check prompt template size |
411
+ | Exception / traceback | Code error → /debug |
412
+
413
+ ---
414
+
415
+ ## If `platform_type = web-frontend`
416
+
417
+ ### Phase 1 — Verify dev server is running
418
+
419
+ ```bash
420
+ # Linux / macOS:
421
+ curl -s -o /dev/null -w "%{http_code}" http://localhost:{port}
422
+
423
+ # Windows (cmd / PowerShell):
424
+ curl -s -o NUL -w "%{http_code}" http://localhost:{port}
425
+
426
+ # Should return 200. If not: start with {conventions.service_run} (e.g., npm run dev)
427
+ ```
428
+
429
+ ### Phase 2 — Run E2E smoke test
430
+
431
+ Identify E2E tool in the project (Playwright or Cypress):
432
+
433
+ ```bash
434
+ # Playwright — run scenarios tagged with this UC:
435
+ npx playwright test --grep "{UC-ID}"
436
+
437
+ # Cypress:
438
+ npx cypress run --spec "cypress/e2e/{UC-ID}*"
439
+ ```
440
+
441
+ If no E2E tests exist yet → open browser and manually verify:
442
+ 1. Navigate to the route for this UC
443
+ 2. Perform the main user action
444
+ 3. Confirm the expected outcome is visible
445
+
446
+ ### Phase 3 — Interpret results
447
+
448
+ | Result | Meaning |
449
+ |--------|---------|
450
+ | All E2E tests pass | ✅ OK |
451
+ | Assertion failed | ⚠️ Logic bug → /debug |
452
+ | `ERR_CONNECTION_REFUSED` | Dev server not running |
453
+ | API returns 4xx/5xx | Backend issue → check backend service |
454
+
455
+ ---
456
+
457
+ ## If `platform_type = mobile`
458
+
459
+ ### Phase 1 — Verify device/emulator is ready
460
+
461
+ ```bash
462
+ # Flutter:
463
+ flutter devices # list connected devices/emulators
464
+ flutter install # install current build on device
465
+
466
+ # React Native:
467
+ npx react-native run-android # build + install on connected Android
468
+ npx react-native run-ios # build + install on iOS simulator
469
+
470
+ # Android (Compose):
471
+ ./gradlew installDebug # install APK on connected device/emulator
472
+
473
+ # iOS (SwiftUI):
474
+ # Open Xcode → select simulator → Product → Run
475
+ ```
476
+
477
+ ### Phase 2 — Manual smoke-test checklist
478
+
479
+ For the UC under test, verify on device:
480
+ 1. Navigate to the screen for this UC
481
+ 2. Perform the main action from the `.feature` Scenario (`When` step)
482
+ 3. Confirm the expected outcome is visible (`Then` step)
483
+ 4. Check for any crash or unexpected error dialog
484
+
485
+ ### Phase 3 — Capture issues if found
486
+
487
+ ```bash
488
+ # Flutter:
489
+ flutter logs
490
+
491
+ # Android:
492
+ adb logcat -d | grep -i "error\|exception\|crash"
493
+
494
+ # iOS:
495
+ # Copy crash log from Xcode → Devices and Simulators → View Device Logs
496
+ ```
497
+
498
+ Paste output into `/debug`.
499
+
500
+ ---
501
+
303
502
  ## Output
304
503
 
305
504
  # Report Footer — Standard Command Output Format
@@ -330,21 +529,23 @@ Suggest the logical next command based on workflow phase:
330
529
 
331
530
  | Current command | Suggest next |
332
531
  |-------------------------|-----------------------------------------------|
532
+ | /setup-ai-first | `/define-product` to start your first feature |
333
533
  | /define-product | `/generate-prd {product-definition-file}` |
334
534
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
335
535
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
336
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
536
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
537
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
337
538
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
338
539
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
339
540
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
340
541
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
341
- | /generate-code | `/generate-tests {UC-ID}` |
542
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
342
543
  | /generate-tests | `/run-tests {UC-ID}` |
343
544
  | /run-tests (passing) | `/review-code {UC-ID}` |
344
545
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
345
546
  | /review-code | `/smoke-test {UC-ID}` or create PR |
346
547
  | /smoke-test | Create PR and link to ticket |
347
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
548
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
348
549
  | /fix-bug | Create PR and link to ticket |
349
550
  | /debug | `/fix-bug {ticket-id}` if fix needed |
350
551
 
@@ -359,8 +560,13 @@ Next : {suggested command with example arguments}
359
560
 
360
561
  ```
361
562
  /smoke-test Report — {UC-ID}
362
- | Method | Path | Status | Result |
363
- |--------|------|--------|--------|
563
+ Platform: {backend | web-frontend | mobile}
564
+ | Endpoint / Flow | Status | Result |
565
+ |-----------------------|-------------|---------|
566
+ | {method} {path/screen}| ✅/⚠️/❌ | {notes} |
567
+
568
+ Status legend: ✅ = OK | ⚠️ = Responded but wrong data / logic bug | ❌ = Error / not running
569
+
364
570
  Issues: {describe any failures}
365
- Next: /debug {stacktrace} OR /fix-bug {TICKET_ID} OR ready to PR
571
+ Next: /debug (paste error interactively) OR /fix-bug {TICKET_ID} OR ready to PR
366
572
  ```