@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
@@ -0,0 +1,450 @@
1
+ ---
2
+ description: Generates a Design Specification document for FE or App platforms from a Business PRD. Trigger when: "/generate-design-spec", "tạo design spec", "generate design spec", "viết design spec", "tạo tài liệu thiết kế UI", "generate UI spec", "cần design spec cho", "tôi muốn spec UI", "tài liệu cho FE", "tài liệu cho app".
3
+ ---
4
+
5
+ # /generate-design-spec — Generate Design Specification (FE / App)
6
+
7
+ This skill generates a platform-specific Design Spec from a Business PRD.
8
+ Design Spec captures screen-level UI requirements, component inventory, platform interactions,
9
+ and design-level AC-UI for PO + Designer sign-off — separate from the business-level PRD.
10
+
11
+ **Supported platforms:** web (react / nextjs / vue / angular), app (flutter / react-native / ios-swiftui / android-compose)
12
+ **Not supported:** backend services — API contracts belong in the Business PRD.
13
+
14
+ ---
15
+
16
+ ## Gate
17
+
18
+ <!-- Directory: specs/prd/**/*.md -->
19
+ # Gate — Universal Entry Procedure
20
+
21
+ Every command must execute this gate before proceeding with its specific logic.
22
+
23
+ ## Step 0 — Sub-Agent Mode Check
24
+
25
+ Before anything else, check if `$ARGUMENTS` is a JSON payload from an orchestrator:
26
+
27
+ 1. Attempt to parse `$ARGUMENTS` as JSON.
28
+ 2. If it parses successfully **and** contains `"_agent_mode": true`:
29
+ - **Skip Steps 1, 2, and 3 of this Gate entirely.**
30
+ - Set target file = `payload.target_file`
31
+ - Set loaded context = `payload.context` (do NOT run context-loader.md)
32
+ - Set UC scope = `payload.uc_id` (process only this UC)
33
+ - Set line range = `payload.uc_section` (read only that PRD section)
34
+ - Proceed directly to the command-specific logic.
35
+ 3. If `$ARGUMENTS` is not JSON or `_agent_mode` is absent → continue to Step 1 (normal mode).
36
+
37
+ ## Step 0-B — Model Check
38
+
39
+ *Skip this step if `_agent_mode: true` (sub-agent — orchestrator already validated).*
40
+
41
+ Complex generation and review commands require strong reasoning.
42
+ Using a smaller model risks missed edge cases, incomplete spec analysis, and architecture violations.
43
+
44
+ Display and wait for response:
45
+
46
+ ```
47
+ ⚙️ MODEL CHECK
48
+ ──────────────────────────────────────────────────────────────────
49
+ Recommended : claude-opus-4 (or latest Opus model)
50
+ Why needed : Spec analysis, architecture review, code generation
51
+ require deep reasoning. Smaller models miss edge cases.
52
+
53
+ To switch in Claude Code:
54
+ • Settings → Model → select "claude-opus"
55
+ • or: /model → choose claude-opus
56
+
57
+ Running on claude-opus?
58
+ Y — yes, on claude-opus → proceed
59
+ S — skip check (I accept lower quality risk with current model)
60
+ ──────────────────────────────────────────────────────────────────
61
+ ```
62
+
63
+ - "Y" → proceed to Step 1.
64
+ - "S" → proceed to Step 1 (user accepts risk, add ⚠️ to final report).
65
+ - "N" or anything else → **STOP.** Output: "Please switch to claude-opus, then re-run this command."
66
+
67
+ ## Step 1 — Resolve Target File
68
+
69
+ 1. If `$ARGUMENTS` is provided and points to an existing file → use it directly as the target.
70
+ 2. If `$ARGUMENTS` is a UC-ID, ticket ID, or partial name → search for matching files in the relevant directory.
71
+ 3. If `$ARGUMENTS` is empty or no match found:
72
+ - List files in the relevant directory for this command (e.g., `specs/prd/**/*.md` for PRD commands, `specs/bdd/**/*.feature` for BDD commands).
73
+ - Present the list to the user and ask: "Which file do you want to work with? (Enter number or filename)"
74
+ - Wait for user selection before continuing.
75
+
76
+ ## Step 2 — Execute Context Loader
77
+
78
+ Load all project context by following the procedure in `steps/context-loader.md`.
79
+ Store all loaded context in memory for use throughout this command session.
80
+
81
+ ## Step 3 — CHECKPOINT
82
+
83
+ After completing Steps 1 and 2, display a summary and wait for confirmation:
84
+
85
+ ```
86
+ CHECKPOINT
87
+ -----------
88
+ Target : {resolved file path}
89
+ Project : {project.name from project-context.yaml}
90
+ Tech stack : {language} / {framework}
91
+ Module : {module if set, else "not configured"}
92
+ Domains : {comma-separated domain list}
93
+
94
+ Proceed? (Y/N)
95
+ ```
96
+
97
+ Wait for explicit "Y" or "N" from the user before continuing.
98
+ - "Y" → proceed to the command-specific steps below.
99
+ - "N" → stop and ask what the user wants to change.
100
+
101
+
102
+ ---
103
+
104
+ ## Context
105
+
106
+ # Context Loader — Load All Project Context
107
+
108
+ Execute these steps in order. Store everything in memory for the duration of the command session.
109
+
110
+ **Priority guide (anti-lost-in-middle):**
111
+ - Steps 1–2 are PROJECT-CONFIG — loaded first, resolve all paths and metadata.
112
+ - Step 3 is CRITICAL — architecture + coding standards, the highest-priority facts for generation.
113
+ - Step 4 is SAFETY — data protection rules, enforced silently for the entire session.
114
+ - Steps 5–6 are DOMAIN KNOWLEDGE — terminology and entity definitions.
115
+ - Step 7 is the WORKING MEMORY RECAP — locks critical facts into the top of working memory.
116
+
117
+ ---
118
+
119
+ ## Step 1 — [PROJECT-CONFIG] Load project-context.yaml
120
+
121
+ Read `.agent/project-context.yaml`. Extract and store:
122
+
123
+ **Tech Stack:**
124
+ - `tech_stack.language` → active language (e.g., Java 17, TypeScript, C#, Go)
125
+ - `tech_stack.framework` → active framework (e.g., Spring Boot 3.2, Angular 17, .NET 8)
126
+ - `tech_stack.build_tool` → build tool (e.g., Maven, npm, dotnet, go)
127
+ - `tech_stack.test_framework` → test framework (e.g., JUnit 5 + Mockito, Jest, xUnit)
128
+ - `tech_stack.database` → database (e.g., PostgreSQL, MySQL, MongoDB)
129
+ - `tech_stack.module` → active module profile (e.g., java-spring, angular, dotnet, golang, context-engineering)
130
+
131
+ **Conventions:**
132
+ - `conventions.build_command` → how to compile/build
133
+ - `conventions.test_command` → how to run tests
134
+ - `conventions.service_run` → how to start the service
135
+ - `conventions.ticket_prefix` → ticket ID prefix (e.g., PROJ, FEAT, UC)
136
+
137
+ **Domains:**
138
+ - `domains` → list of active business domains
139
+
140
+ **Paths (if present):**
141
+ - `paths.specs_dir` → BDD specs root
142
+ - `paths.prd_dir` → PRD documents root
143
+ - `paths.refinement_dir` → findings/review output dir
144
+ - `paths.product_definitions_dir` → product definitions root
145
+ - `paths.domain_knowledge_dir` → domain knowledge root
146
+ - `paths.business_dictionary` → path to business-dictionary.md
147
+ - `paths.core_entities` → path to core-entities.md
148
+ - `paths.tech_docs_dir` → technical documentation root
149
+ - `paths.trace_dir` → trace state directory
150
+ - `paths.design_spec_dir` → Design Spec documents root (FE/App only)
151
+
152
+ If `paths` section is absent, use these defaults:
153
+ - `specs_dir` = `specs/bdd`
154
+ - `prd_dir` = `specs/prd`
155
+ - `refinement_dir` = `.agent/review`
156
+ - `product_definitions_dir` = `specs/product-definition`
157
+ - `domain_knowledge_dir` = `specs/domain-knowledge`
158
+ - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
159
+ - `core_entities` = `specs/domain-knowledge/core-entities.md`
160
+ - `tech_docs_dir` = `specs/tech-docs`
161
+ - `trace_dir` = `.trace`
162
+ - `design_spec_dir` = `specs/design-spec`
163
+
164
+ If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
165
+
166
+ ---
167
+
168
+ ## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
169
+
170
+ *Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
171
+
172
+ If `services` section is present:
173
+
174
+ **1. Detect active domain** (in priority order):
175
+ - Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
176
+ - Extract from target file path: segment immediately after `prd_dir` base path
177
+ *(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
178
+ - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
179
+
180
+ **2. Route to service** — if active domain matches a key in `services`:
181
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir`
182
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
183
+ - Store `active_service` = `services.{domain}.path`
184
+ - Store `active_service_module` = `services.{domain}.module`
185
+ - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
186
+
187
+ **3. Fallback** — if domain not detected or no matching service key:
188
+ - Keep default paths from Step 1
189
+ - Set `active_service = unresolved`
190
+
191
+ **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
192
+ - Override `paths.prd_dir` → `{spec_source}/specs/prd`
193
+ - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
194
+ - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
195
+ - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
196
+ - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
197
+
198
+ ---
199
+
200
+ ## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
201
+
202
+ If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
203
+ Merge framework-specific conventions (layer patterns, test patterns, naming rules) into the loaded context.
204
+ If the file does not exist → skip silently.
205
+
206
+ ---
207
+
208
+ ## Step 3 — [CRITICAL] Load CLAUDE.md
209
+
210
+ *This is the highest-priority context — it defines HOW to write code and documents for this project.*
211
+
212
+ Read `CLAUDE.md`. Extract and store:
213
+
214
+ - **§1 Project Overview** → project name, language, framework, build/test commands, domains
215
+ - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules
216
+ - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns
217
+ - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name
218
+ - **§7 Git Conventions** → branch naming pattern, commit message format
219
+
220
+ If `CLAUDE.md` does not exist → note it as missing and continue with project-context.yaml data only.
221
+
222
+ ---
223
+
224
+ ## Step 4 — [SAFETY] Load Data Protection Rules
225
+
226
+ Read `.agent/rules/data-protection.md` (or `rules/data-protection.md` from the framework installation).
227
+
228
+ Store the sensitive file patterns — you must **never** read, write, display, or reference content from files matching those patterns for the entire session.
229
+
230
+ If neither file exists → apply built-in defaults: never access `.env*`, `*.key`, `*.pem`, `*secret*`, `*password*`, `*credential*`.
231
+
232
+ ---
233
+
234
+ ## Step 5 — [DOMAIN] Load Business Dictionary (conditional)
235
+
236
+ Check if the business dictionary file exists (use `paths.business_dictionary` resolved in Step 1).
237
+
238
+ If it exists, read it and extract:
239
+ - **Canonical Terms** → complete list of approved terms and their definitions
240
+ - **Banned Terms** → complete list of banned terms and their canonical replacements
241
+ - **Status / Enum Registry** → allowed enum values per entity
242
+
243
+ Store the banned terms list for **active enforcement** throughout the command session:
244
+ - When generating any text (PRD, BDD, code comments, tech docs), verify no banned terms appear
245
+ - Replace banned terms with their canonical equivalents automatically
246
+
247
+ If the file does not exist → skip silently. Do not warn or block.
248
+
249
+ ---
250
+
251
+ ## Step 6 — [DOMAIN] Load Core Entities (conditional)
252
+
253
+ Check if the core entities file exists at `paths.core_entities` (resolved in Step 1).
254
+ Default path: `specs/domain-knowledge/core-entities.md`.
255
+
256
+ If it exists, read it and store:
257
+ - **Entity catalog** → for each entity: its name, purpose, owner service, key fields (name + type), business invariants, and relationships
258
+ - **Field name registry** → canonical field names to use in generated code and documents
259
+ - **Relationship map** → how entities relate to each other (1:N, N:N, embedded, etc.)
260
+
261
+ **How to use this catalog:**
262
+ - When generating code: use the field names, types, and relationships defined here — do NOT infer from existing code
263
+ - When generating PRD/BDD: reference entity names from this catalog for consistency
264
+ - When generating tech-docs: use this catalog as the source-of-truth for entity definitions
265
+
266
+ If the file does not exist → skip silently.
267
+
268
+ ---
269
+
270
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
271
+
272
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
273
+
274
+ ```
275
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
276
+ ```
277
+
278
+ | `platform_type` | Modules |
279
+ |---|---|
280
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
281
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
282
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
283
+
284
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
285
+
286
+ 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).
287
+
288
+ ---
289
+
290
+ ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
291
+
292
+ After loading all context, synthesize and output a compact summary block.
293
+ This recap ensures the most critical facts are stated at the END of context loading
294
+ (recency effect — freshest in working memory when the task begins).
295
+
296
+ Output exactly this block:
297
+ ```
298
+ [CTX LOADED]
299
+ Stack : {language} / {framework} / {database}
300
+ Platform : {active_module} ({platform_type})
301
+ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
302
+ Ticket : {ticket_prefix}-
303
+ Dict : {loaded — N canonical terms, M banned terms | missing}
304
+ Entities : {loaded — EntityA, EntityB, EntityC | missing}
305
+ Service : {active_service} ({active_service_module}) | single-service
306
+ Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
307
+ ```
308
+
309
+ If any CRITICAL file is missing (CLAUDE.md), flag it clearly so the user can decide whether to proceed.
310
+
311
+ ---
312
+
313
+ ## Context Load Complete
314
+
315
+ After completing all steps, you have loaded:
316
+ - Project identity, tech stack, module conventions
317
+ - Architecture rules and layer order ← **[CRITICAL — hold in working memory]**
318
+ - Coding standards and naming conventions ← **[CRITICAL — hold in working memory]**
319
+ - Data protection rules (sensitive file patterns to never access)
320
+ - Terminology rules with banned-term list ← **[DOMAIN — apply to every generated word]**
321
+ - Entity catalog (field names, types, invariants) ← **[DOMAIN — use for code generation]**
322
+ - All configured paths
323
+
324
+ Proceed to the next step of the calling command.
325
+
326
+
327
+ *Read the target PRD. Extract: TICKET-ID, domain, feature name, Service, Module from metadata, User Flow (Section 4a), Wireframe screen names (Section 4b).*
328
+
329
+ ---
330
+
331
+ ## Platform Check
332
+
333
+ - `platform_type = "backend"` → **STOP**: "Design Spec is only for FE/App. BE API contracts go in the Business PRD."
334
+ - `platform_type = "web-frontend"` → `active_platform = "web"`
335
+ - `platform_type = "mobile"` → `active_platform = "app"` (or `"app-ios"` / `"app-android"` for native)
336
+ - `platform_type = "unknown"` → ask user to select platform
337
+
338
+ ---
339
+
340
+ ## Figma Check
341
+
342
+ Ask: "Do you have a Figma link? (paste URL or Enter to skip)"
343
+
344
+ Store as `figma_url` or set to `"TBD"` with AI Assumption noted.
345
+
346
+ ---
347
+
348
+ ## Screen Discovery
349
+
350
+ Extract screen names from PRD Section 4. Present list for PO to confirm/add before generating.
351
+
352
+ ---
353
+
354
+ ## Generate
355
+
356
+ Write `{paths.design_spec_dir}/{domain}/{TICKET-ID}-design-spec-{active_platform}-{slug}.md`.
357
+
358
+ Structure:
359
+ 1. **Metadata** — Spec ID, platform, module, service, Business PRD link, Figma link
360
+ 2. **Screen Inventory** — table of all screens with entry points and Figma frame links
361
+ 3. **Screen Specs** (per screen):
362
+ - Layout (grid, spacing, design tokens)
363
+ - Component Inventory (Figma → code component, import path, states)
364
+ - Screen States (default / loading / error / empty / success)
365
+ - Actions & Navigation (triggers → results)
366
+ 4. **Interaction Patterns** (platform-adaptive):
367
+ - Web: responsive breakpoints table, hover/focus/keyboard table
368
+ - App: gesture table, navigation stack diagram, iOS vs Android conventions table
369
+ 5. **Platform Considerations** (platform-adaptive):
370
+ - Web: accessibility checklist (WCAG, keyboard, ARIA)
371
+ - App: safe area, touch targets, deep links, permissions, offline, dark mode
372
+ 6. **AC-UI** — design acceptance criteria table (Verified by: Designer / PO / QA)
373
+ 7. **Appendix** — Figma summary, design tokens, references, AI assumptions, changelog
374
+
375
+ Component mapping rules:
376
+ - Check `figma-components/{active_module}.md` (loaded in context) for every component
377
+ - ✅ Found → use exact Code Component + Import Path
378
+ - ⚠️ TODO → mark `[TODO — implementation pending]`
379
+ - ❌ Not found → mark `[NEW — confirm with designer]`
380
+
381
+ ---
382
+
383
+ ## Output
384
+
385
+ # Report Footer — Standard Command Output Format
386
+
387
+ Every command report must end with this standard footer section.
388
+
389
+ ## Status Badge
390
+
391
+ Choose one based on outcome:
392
+ - `✅ Complete` — all steps succeeded, no issues found
393
+ - `❌ Failed` — command could not complete due to a blocking error
394
+ - `⚠️ Warnings` — completed with non-blocking issues that should be reviewed
395
+
396
+ ## Output Artifacts
397
+
398
+ List every file created or modified by this command:
399
+ ```
400
+ Output Artifacts:
401
+ {created|updated} {file-path} ({brief description})
402
+ {created|updated} {file-path} ({brief description})
403
+ ```
404
+
405
+ If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
406
+
407
+ ## Next Command Suggestion
408
+
409
+ Suggest the logical next command based on workflow phase:
410
+
411
+ | Current command | Suggest next |
412
+ |-------------------------|-----------------------------------------------|
413
+ | /setup-ai-first | `/define-product` to start your first feature |
414
+ | /define-product | `/generate-prd {product-definition-file}` |
415
+ | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
416
+ | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
417
+ | /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 |
418
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
419
+ | /generate-bdd | `/review-context {feature-file}` to verify coverage |
420
+ | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
421
+ | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
422
+ | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
423
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
424
+ | /generate-tests | `/run-tests {UC-ID}` |
425
+ | /run-tests (passing) | `/review-code {UC-ID}` |
426
+ | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
427
+ | /review-code | `/smoke-test {UC-ID}` or create PR |
428
+ | /smoke-test | Create PR and link to ticket |
429
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
430
+ | /fix-bug | Create PR and link to ticket |
431
+ | /debug | `/fix-bug {ticket-id}` if fix needed |
432
+
433
+ Format the footer as:
434
+ ```
435
+ ---
436
+ Status : {badge}
437
+ {Output Artifacts block}
438
+ Next : {suggested command with example arguments}
439
+ ```
440
+
441
+
442
+ ```
443
+ /generate-design-spec Complete — {TICKET-ID} [{active_platform}]
444
+ ---
445
+ Status : ✅ Complete
446
+ Output Artifacts:
447
+ created specs/design-spec/{domain}/{TICKET-ID}-design-spec-{active_platform}-{slug}.md (v1.0)
448
+ Next : Share with Designer → add Figma links → PO + Designer sign-off
449
+ → /generate-bdd {prd-file}
450
+ ```
@@ -52,6 +52,7 @@ Read `.agent/project-context.yaml`. Extract and store:
52
52
  - `paths.core_entities` → path to core-entities.md
53
53
  - `paths.tech_docs_dir` → technical documentation root
54
54
  - `paths.trace_dir` → trace state directory
55
+ - `paths.design_spec_dir` → Design Spec documents root (FE/App only)
55
56
 
56
57
  If `paths` section is absent, use these defaults:
57
58
  - `specs_dir` = `specs/bdd`
@@ -63,11 +64,44 @@ If `paths` section is absent, use these defaults:
63
64
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
64
65
  - `tech_docs_dir` = `specs/tech-docs`
65
66
  - `trace_dir` = `.trace`
67
+ - `design_spec_dir` = `specs/design-spec`
66
68
 
67
69
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
68
70
 
69
71
  ---
70
72
 
73
+ ## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
74
+
75
+ *Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
76
+
77
+ If `services` section is present:
78
+
79
+ **1. Detect active domain** (in priority order):
80
+ - Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
81
+ - Extract from target file path: segment immediately after `prd_dir` base path
82
+ *(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
83
+ - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
84
+
85
+ **2. Route to service** — if active domain matches a key in `services`:
86
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir`
87
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
88
+ - Store `active_service` = `services.{domain}.path`
89
+ - Store `active_service_module` = `services.{domain}.module`
90
+ - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
91
+
92
+ **3. Fallback** — if domain not detected or no matching service key:
93
+ - Keep default paths from Step 1
94
+ - Set `active_service = unresolved`
95
+
96
+ **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
97
+ - Override `paths.prd_dir` → `{spec_source}/specs/prd`
98
+ - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
99
+ - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
100
+ - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
101
+ - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
102
+
103
+ ---
104
+
71
105
  ## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
72
106
 
73
107
  If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
@@ -173,6 +207,7 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
173
207
  Ticket : {ticket_prefix}-
174
208
  Dict : {loaded — N canonical terms, M banned terms | missing}
175
209
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
210
+ Service : {active_service} ({active_service_module}) | single-service
176
211
  Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
177
212
  ```
178
213
 
@@ -360,7 +395,8 @@ Suggest the logical next command based on workflow phase:
360
395
  | /define-product | `/generate-prd {product-definition-file}` |
361
396
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
362
397
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
363
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
398
+ | /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 |
399
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
364
400
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
365
401
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
366
402
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -190,7 +190,8 @@ Suggest the logical next command based on workflow phase:
190
190
  | /define-product | `/generate-prd {product-definition-file}` |
191
191
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
192
192
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
193
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
193
+ | /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 |
194
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
194
195
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
195
196
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
196
197
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -433,7 +434,8 @@ Suggest the logical next command based on workflow phase:
433
434
  | /define-product | `/generate-prd {product-definition-file}` |
434
435
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
435
436
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
436
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
437
+ | /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 |
438
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
437
439
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
438
440
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
439
441
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -136,7 +136,8 @@ Suggest the logical next command based on workflow phase:
136
136
  | /define-product | `/generate-prd {product-definition-file}` |
137
137
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
138
138
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
139
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
139
+ | /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 |
140
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
140
141
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
141
142
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
142
143
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -207,7 +207,8 @@ Suggest the logical next command based on workflow phase:
207
207
  | /define-product | `/generate-prd {product-definition-file}` |
208
208
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
209
209
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
210
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
210
+ | /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 |
211
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
211
212
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
212
213
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
213
214
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -338,7 +339,8 @@ Suggest the logical next command based on workflow phase:
338
339
  | /define-product | `/generate-prd {product-definition-file}` |
339
340
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
340
341
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
341
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
342
+ | /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 |
343
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
342
344
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
343
345
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
344
346
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |