@anhth2/spec-driven-dev-plugin 0.7.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 (69) hide show
  1. package/bin/index.js +105 -0
  2. package/commands/debug.md +37 -1
  3. package/commands/define-product.md +37 -1
  4. package/commands/fix-bug.md +37 -1
  5. package/commands/generate-bdd.md +37 -1
  6. package/commands/generate-code.md +37 -1
  7. package/commands/generate-design-spec.md +754 -0
  8. package/commands/generate-design-spec.tmpl +399 -0
  9. package/commands/generate-prd.md +58 -1
  10. package/commands/generate-prd.tmpl +21 -0
  11. package/commands/generate-spec-manifest.md +519 -0
  12. package/commands/generate-spec-manifest.tmpl +164 -0
  13. package/commands/generate-tech-docs.md +37 -1
  14. package/commands/generate-tests.md +37 -1
  15. package/commands/refine-prd.md +37 -1
  16. package/commands/review-code.md +37 -1
  17. package/commands/review-context.md +77 -1
  18. package/commands/review-context.tmpl +40 -0
  19. package/commands/review-tech-docs.md +37 -1
  20. package/commands/run-tests.md +37 -1
  21. package/commands/setup-ai-first.md +132 -4
  22. package/commands/setup-ai-first.tmpl +130 -3
  23. package/commands/smoke-test.md +37 -1
  24. package/commands/validate-traces.md +37 -1
  25. package/core/FRAMEWORK_VERSION +1 -1
  26. package/core/commands/debug.md +37 -1
  27. package/core/commands/define-product.md +37 -1
  28. package/core/commands/fix-bug.md +37 -1
  29. package/core/commands/generate-bdd.md +37 -1
  30. package/core/commands/generate-code.md +37 -1
  31. package/core/commands/generate-design-spec.md +754 -0
  32. package/core/commands/generate-prd.md +58 -1
  33. package/core/commands/generate-spec-manifest.md +519 -0
  34. package/core/commands/generate-tech-docs.md +37 -1
  35. package/core/commands/generate-tests.md +37 -1
  36. package/core/commands/refine-prd.md +37 -1
  37. package/core/commands/review-code.md +37 -1
  38. package/core/commands/review-context.md +77 -1
  39. package/core/commands/review-tech-docs.md +37 -1
  40. package/core/commands/run-tests.md +37 -1
  41. package/core/commands/setup-ai-first.md +132 -4
  42. package/core/commands/smoke-test.md +37 -1
  43. package/core/commands/validate-traces.md +37 -1
  44. package/core/skills/code/SKILL.md +39 -2
  45. package/core/skills/debug/SKILL.md +41 -3
  46. package/core/skills/design-spec/SKILL.md +450 -0
  47. package/core/skills/discovery/SKILL.md +37 -1
  48. package/core/skills/prd/SKILL.md +4 -2
  49. package/core/skills/setup-ai-first/SKILL.md +2 -1
  50. package/core/skills/spec/SKILL.md +4 -2
  51. package/core/skills/test/SKILL.md +76 -3
  52. package/core/steps/context-loader.md +35 -0
  53. package/core/steps/report-footer.md +2 -1
  54. package/core/templates/design-spec.template.md +209 -0
  55. package/core/templates/project-context.yaml +29 -0
  56. package/package.json +1 -1
  57. package/skills/code/SKILL.md +39 -2
  58. package/skills/debug/SKILL.md +41 -3
  59. package/skills/design-spec/SKILL.md +450 -0
  60. package/skills/design-spec/SKILL.tmpl +95 -0
  61. package/skills/discovery/SKILL.md +37 -1
  62. package/skills/prd/SKILL.md +4 -2
  63. package/skills/setup-ai-first/SKILL.md +2 -1
  64. package/skills/spec/SKILL.md +4 -2
  65. package/skills/test/SKILL.md +76 -3
  66. package/steps/context-loader.md +35 -0
  67. package/steps/report-footer.md +2 -1
  68. package/templates/design-spec.template.md +209 -0
  69. package/templates/project-context.yaml +29 -0
@@ -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,6 +153,7 @@ 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)
111
157
  │ ├── tech-docs/ ← technical design documents
112
158
  │ └── domain-knowledge/ ← business dictionary & domain context
113
159
  ├── .trace/
@@ -115,8 +161,19 @@ Create these directories (skip if they exist):
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
@@ -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,8 +336,12 @@ 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
276
343
  - [ ] `specs/bdd/` exists
344
+ - [ ] `specs/design-spec/` exists *(skip if backend-only project)*
277
345
  - [ ] `specs/tech-docs/` exists
278
346
  - [ ] `specs/domain-knowledge/` exists
279
347
  - [ ] `.trace/` exists
@@ -282,6 +350,24 @@ Or: VS Code → `Ctrl+Shift+P` → **"Extensions: Install from Marketplace"**
282
350
  - [ ] `specs/domain-knowledge/business-dictionary.md` exists
283
351
  - [ ] `specs/domain-knowledge/core-entities.md` exists
284
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
+
285
371
  ## Output
286
372
 
287
373
  # Report Footer — Standard Command Output Format
@@ -316,7 +402,8 @@ Suggest the logical next command based on workflow phase:
316
402
  | /define-product | `/generate-prd {product-definition-file}` |
317
403
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
318
404
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
319
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
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}` |
320
407
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
321
408
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
322
409
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -342,13 +429,54 @@ Next : {suggested command with example arguments}
342
429
 
343
430
  ```
344
431
  /setup-ai-first Complete ✅
432
+ ```
433
+
434
+ Output varies by `project_type`:
435
+
436
+ **Single-service:**
437
+ ```
345
438
  Next:
346
439
  1. Fill CLAUDE.md (replace {{PLACEHOLDER}} values)
347
440
  2. Fill .agent/project-context.yaml
348
- 3. Fill specs/domain-knowledge/business-dictionary.md ← terminology rules
349
- 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
350
443
  5. git add and commit those 4 files
351
- 6. Install VS Code extension (if not yet installed):
444
+ 6. Install VS Code extension:
352
445
  code --install-extension edupia-team.spec-driven-dev-team
353
446
  7. /define-product to start your first feature
354
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
+ ```
@@ -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`
@@ -144,11 +145,44 @@ If `paths` section is absent, use these defaults:
144
145
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
145
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`.
@@ -254,6 +288,7 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
254
288
  Ticket : {ticket_prefix}-
255
289
  Dict : {loaded — N canonical terms, M banned terms | missing}
256
290
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
291
+ Service : {active_service} ({active_service_module}) | single-service
257
292
  Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
258
293
  ```
259
294
 
@@ -498,7 +533,8 @@ Suggest the logical next command based on workflow phase:
498
533
  | /define-product | `/generate-prd {product-definition-file}` |
499
534
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
500
535
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
501
- | /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}` |
502
538
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
503
539
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
504
540
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -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`
@@ -144,11 +145,44 @@ If `paths` section is absent, use these defaults:
144
145
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
145
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`.
@@ -254,6 +288,7 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
254
288
  Ticket : {ticket_prefix}-
255
289
  Dict : {loaded — N canonical terms, M banned terms | missing}
256
290
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
291
+ Service : {active_service} ({active_service_module}) | single-service
257
292
  Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
258
293
  ```
259
294
 
@@ -498,7 +533,8 @@ Suggest the logical next command based on workflow phase:
498
533
  | /define-product | `/generate-prd {product-definition-file}` |
499
534
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
500
535
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
501
- | /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}` |
502
538
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
503
539
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
504
540
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -158,6 +158,7 @@ Read `.agent/project-context.yaml`. Extract and store:
158
158
  - `paths.core_entities` → path to core-entities.md
159
159
  - `paths.tech_docs_dir` → technical documentation root
160
160
  - `paths.trace_dir` → trace state directory
161
+ - `paths.design_spec_dir` → Design Spec documents root (FE/App only)
161
162
 
162
163
  If `paths` section is absent, use these defaults:
163
164
  - `specs_dir` = `specs/bdd`
@@ -169,11 +170,44 @@ If `paths` section is absent, use these defaults:
169
170
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
170
171
  - `tech_docs_dir` = `specs/tech-docs`
171
172
  - `trace_dir` = `.trace`
173
+ - `design_spec_dir` = `specs/design-spec`
172
174
 
173
175
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
174
176
 
175
177
  ---
176
178
 
179
+ ## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
180
+
181
+ *Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
182
+
183
+ If `services` section is present:
184
+
185
+ **1. Detect active domain** (in priority order):
186
+ - Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
187
+ - Extract from target file path: segment immediately after `prd_dir` base path
188
+ *(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
189
+ - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
190
+
191
+ **2. Route to service** — if active domain matches a key in `services`:
192
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir`
193
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
194
+ - Store `active_service` = `services.{domain}.path`
195
+ - Store `active_service_module` = `services.{domain}.module`
196
+ - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
197
+
198
+ **3. Fallback** — if domain not detected or no matching service key:
199
+ - Keep default paths from Step 1
200
+ - Set `active_service = unresolved`
201
+
202
+ **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
203
+ - Override `paths.prd_dir` → `{spec_source}/specs/prd`
204
+ - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
205
+ - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
206
+ - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
207
+ - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
208
+
209
+ ---
210
+
177
211
  ## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
178
212
 
179
213
  If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
@@ -279,6 +313,7 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
279
313
  Ticket : {ticket_prefix}-
280
314
  Dict : {loaded — N canonical terms, M banned terms | missing}
281
315
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
316
+ Service : {active_service} ({active_service_module}) | single-service
282
317
  Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
283
318
  ```
284
319
 
@@ -412,7 +447,8 @@ Suggest the logical next command based on workflow phase:
412
447
  | /define-product | `/generate-prd {product-definition-file}` |
413
448
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
414
449
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
415
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
450
+ | /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 |
451
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
416
452
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
417
453
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
418
454
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -524,7 +560,8 @@ Suggest the logical next command based on workflow phase:
524
560
  | /define-product | `/generate-prd {product-definition-file}` |
525
561
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
526
562
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
527
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
563
+ | /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 |
564
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
528
565
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
529
566
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
530
567
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -73,6 +73,7 @@ Read `.agent/project-context.yaml`. Extract and store:
73
73
  - `paths.core_entities` → path to core-entities.md
74
74
  - `paths.tech_docs_dir` → technical documentation root
75
75
  - `paths.trace_dir` → trace state directory
76
+ - `paths.design_spec_dir` → Design Spec documents root (FE/App only)
76
77
 
77
78
  If `paths` section is absent, use these defaults:
78
79
  - `specs_dir` = `specs/bdd`
@@ -84,11 +85,44 @@ If `paths` section is absent, use these defaults:
84
85
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
85
86
  - `tech_docs_dir` = `specs/tech-docs`
86
87
  - `trace_dir` = `.trace`
88
+ - `design_spec_dir` = `specs/design-spec`
87
89
 
88
90
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
89
91
 
90
92
  ---
91
93
 
94
+ ## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
95
+
96
+ *Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
97
+
98
+ If `services` section is present:
99
+
100
+ **1. Detect active domain** (in priority order):
101
+ - Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
102
+ - Extract from target file path: segment immediately after `prd_dir` base path
103
+ *(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
104
+ - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
105
+
106
+ **2. Route to service** — if active domain matches a key in `services`:
107
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir`
108
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
109
+ - Store `active_service` = `services.{domain}.path`
110
+ - Store `active_service_module` = `services.{domain}.module`
111
+ - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
112
+
113
+ **3. Fallback** — if domain not detected or no matching service key:
114
+ - Keep default paths from Step 1
115
+ - Set `active_service = unresolved`
116
+
117
+ **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
118
+ - Override `paths.prd_dir` → `{spec_source}/specs/prd`
119
+ - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
120
+ - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
121
+ - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
122
+ - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
123
+
124
+ ---
125
+
92
126
  ## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
93
127
 
94
128
  If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
@@ -194,6 +228,7 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
194
228
  Ticket : {ticket_prefix}-
195
229
  Dict : {loaded — N canonical terms, M banned terms | missing}
196
230
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
231
+ Service : {active_service} ({active_service_module}) | single-service
197
232
  Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
198
233
  ```
199
234
 
@@ -350,7 +385,8 @@ Suggest the logical next command based on workflow phase:
350
385
  | /define-product | `/generate-prd {product-definition-file}` |
351
386
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
352
387
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
353
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
388
+ | /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 |
389
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
354
390
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
355
391
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
356
392
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -488,7 +524,8 @@ Suggest the logical next command based on workflow phase:
488
524
  | /define-product | `/generate-prd {product-definition-file}` |
489
525
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
490
526
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
491
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
527
+ | /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 |
528
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
492
529
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
493
530
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
494
531
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -583,7 +620,8 @@ Suggest the logical next command based on workflow phase:
583
620
  | /define-product | `/generate-prd {product-definition-file}` |
584
621
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
585
622
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
586
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
623
+ | /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 |
624
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
587
625
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
588
626
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
589
627
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |