@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
@@ -3,44 +3,164 @@
3
3
  ## Gate
4
4
  {{include:steps/gate.md}}
5
5
 
6
- *Note: For this command, the target in Step 1 is a UC-ID or service name from `$ARGUMENTS`. Context loading provides `conventions.test_command`.*
6
+ *Note: For this command, the target in Step 1 is a UC-ID or service name. Context loading provides `conventions.test_command` and `tech_stack.module`.*
7
7
 
8
8
  ## Context
9
9
  {{include:steps/context-loader.md}}
10
10
 
11
11
  ---
12
12
 
13
+ ## Service Detection
14
+
15
+ Read `active_module` from context (resolved in context-loader Step 1).
16
+ Use it to select the correct run command and error analysis table below.
17
+
18
+ ---
19
+
13
20
  ## Run
21
+
22
+ ### If `platform_type = backend`
23
+
14
24
  ```bash
15
- {conventions.test_command} # all tests in module
16
- {conventions.test_command} --class {ClassName} # specific class (faster)
17
- {conventions.test_command} --pattern "*{Resource}*" # by pattern
25
+ # Run all tests for this UC
26
+ {conventions.test_command}
27
+
28
+ # Scoped to specific class (faster feedback)
29
+ # java-spring:
30
+ mvn test -Dtest={ClassName}
31
+ # golang:
32
+ go test ./... -run Test{FunctionName}
33
+ # dotnet:
34
+ dotnet test --filter "FullyQualifiedName~{ClassName}"
35
+ # php-laravel:
36
+ php artisan test --filter {ClassName}
37
+ # context-engineering (pytest):
38
+ pytest tests/{domain}/{test_file}.py -v
39
+ pytest tests/{domain}/{test_file}.py::{TestClass}::{test_method} -v
40
+ pytest tests/ --cov={source_dir} --cov-report=term-missing
18
41
  ```
19
42
 
43
+ ### If `platform_type = web-frontend`
44
+
45
+ ```bash
46
+ # Run all tests
47
+ {conventions.test_command}
48
+
49
+ # Scoped (Vitest / Jest):
50
+ npx vitest run src/features/{domain}/{Component}.test.tsx
51
+ npx jest src/features/{domain}/{Component}.test.tsx
52
+
53
+ # E2E (Playwright):
54
+ npx playwright test {UC-ID}
55
+ # E2E (Cypress):
56
+ npx cypress run --spec "cypress/e2e/{UC-ID}*"
57
+ ```
58
+
59
+ ### If `platform_type = mobile`
60
+
61
+ ```bash
62
+ # Flutter:
63
+ flutter test test/{domain}/{UC-ID}_test.dart
64
+ flutter test integration_test/{UC-ID}_test.dart # integration
65
+
66
+ # React Native:
67
+ npx jest {UC-ID}
68
+
69
+ # iOS (Xcode command line):
70
+ xcodebuild test -scheme {Scheme} -destination 'platform=iOS Simulator,name=iPhone 15'
71
+
72
+ # Android:
73
+ ./gradlew test # unit tests
74
+ ./gradlew connectedAndroidTest # instrumented (device/emulator required)
75
+ ```
76
+
77
+ > **Note for Android instrumented tests:** a running emulator or connected device is required before running `connectedAndroidTest`. Start one via Android Studio or: `emulator -avd {AVD_NAME} &`
78
+
79
+ ---
80
+
20
81
  ## Analyze Failures
21
82
 
83
+ ### Backend failure patterns
84
+
85
+ #### java-spring / golang / dotnet / php-laravel
86
+
87
+ | Error Pattern | Common Cause | Suggested Fix |
88
+ |---|---|---|
89
+ | `NullPointerException` | Missing mock setup | Check `given(...)`/`coEvery`/`mockk` for null dependency |
90
+ | `Bean not found` | Missing mock declaration | Add `@MockBean` / inject mock |
91
+ | `Expected 200, got 401` | Missing auth setup | Add auth token/user to test context |
92
+ | `Expected 200, got 400` | Request body fails validation | Check required fields in DTO |
93
+ | `Expected 200, got 403` | Wrong role | Add correct role to test user |
94
+ | `LazyInitializationException` | Lazy collection outside transaction | Add `@Transactional` or eager fetch |
95
+ | `Mapper not found` | Code not compiled | Run build step before tests |
96
+ | `DataIntegrityViolationException` | Duplicate key in DB setup | Use `@Transactional` + rollback, or clean DB between tests |
97
+ | Assertion mismatch | Wrong mock return value | Re-read `given(...).willReturn(...)` setup |
98
+
99
+ #### context-engineering (AI/LLM pipelines)
100
+
22
101
  | Error Pattern | Common Cause | Suggested Fix |
23
102
  |---|---|---|
24
- | NullPointerException | Missing mock setup | Check `given(...)` for null dependency |
25
- | Bean not found | Missing mock declaration | Add mock for missing dependency |
26
- | Expected 200, got 403 | Missing auth setup | Add auth user/role to test context |
27
- | Expected 200, got 400 | Request body fails validation | Check required fields in DTO |
28
- | LazyInitializationException | Lazy collection outside transaction | Add `@Transactional` or eager fetch |
29
- | Mapper not found | Code generator not run | Run compile step before tests |
103
+ | `AssertionError` on LLM mock output | Mock return value not matching schema | Re-check `mock_llm.return_value` / `mock_llm.complete.return_value` setup |
104
+ | `ValidationError` on response | LLM output structure doesn't match expected schema | Tighten schema check or add retry logic in test |
105
+ | `ConnectionError` / `APIError` | Real LLM API being called in test | Ensure `patch('...')` mock is applied never call real LLM in unit tests |
106
+ | `TimeoutError` | Test calling live LLM endpoint | Add mock; check test fixtures |
107
+ | Flaky / non-deterministic results | Real LLM response used in assertion | Replace with deterministic mock return value |
108
+
109
+ ### Web frontend failure patterns
110
+
111
+ | Error Pattern | Common Cause | Suggested Fix |
112
+ |---|---|---|
113
+ | `Unable to find role "..."` | Element not rendered yet | Wrap in `await waitFor(() => ...)` |
114
+ | `TestingLibraryElementError: Found multiple elements` | Selector too broad | Use `getByRole(..., { name: '...' })` to narrow |
115
+ | `Network request not intercepted` | Missing MSW handler / `cy.intercept` | Add handler for the endpoint |
116
+ | `act(...)` warning | State update after test ended | Await async events / `await userEvent.click(...)` |
117
+ | `Cannot read properties of undefined` | Component rendered before data loaded | Add loading state or mock resolved data |
118
+ | Playwright timeout | Page not navigated / element hidden | Check route, add `waitForSelector` |
119
+ | `expect(page.locator(...)).toBeVisible` fails | Wrong selector | Use Playwright Inspector to find correct locator |
120
+
121
+ ### Mobile failure patterns
122
+
123
+ #### Flutter
124
+ | Error Pattern | Common Cause | Suggested Fix |
125
+ |---|---|---|
126
+ | `pumpAndSettle timed out` | Async operation not completing | Use `pump(Duration(...))` for specific delay |
127
+ | `No widget found` | Widget not rendered / wrong finder | Check `find.byType`, `find.text`, `find.byKey` |
128
+ | `setState called after dispose` | Widget disposed before async completes | Cancel async in `dispose()` |
129
+ | BLoC state mismatch | Wrong event emitted | Verify `mockBloc` received correct event |
130
+
131
+ #### React Native
132
+ | Error Pattern | Common Cause | Suggested Fix |
133
+ |---|---|---|
134
+ | `Unable to find element` | Missing `testID` or wrong query | Add `accessibilityLabel` or `testID` to component |
135
+ | `act(...)` warning | Async state updates | Wrap in `act(async () => { ... })` |
136
+ | Navigation mock missing | `useNavigation` not mocked | Add jest mock for `@react-navigation/native` |
137
+
138
+ #### iOS / Android
139
+ | Error Pattern | Common Cause | Suggested Fix |
140
+ |---|---|---|
141
+ | `XCTAssertEqual failed` | Wrong expected value | Check ViewModel output for given mock |
142
+ | `Compose node not found` | Wrong `contentDescription` / `testTag` | Add `Modifier.testTag(...)` to composable |
143
+ | `Hilt injection failed` | Missing test module | Add `@UninstallModules` + `@BindValue` in test class |
144
+ | Emulator not available | `connectedAndroidTest` without device | Start emulator first, wait for it to boot |
145
+
146
+ ---
30
147
 
31
148
  ## Output
32
149
 
33
150
  {{include:steps/report-footer.md}}
34
151
 
35
152
  ```
36
- /run-tests Report — {service}
153
+ /run-tests Report — {UC-ID} ({active_module})
37
154
  ✅ Passed: {N} | ❌ Failed: {M} | ⏭️ Skipped: {K} | Duration: {X}s
38
155
 
39
156
  ## Failed Tests
40
157
  | Test | Error | Root Cause |
41
- |------|-------|-----------|
158
+ |------|-------|------------|
42
159
 
43
160
  ## Recommendations
44
161
  {specific fix per failure}
45
- Next: /fix-bug if real bug, or correct test if wrong expectation.
162
+
163
+ Next:
164
+ All tests pass → /review-code {UC-ID}
165
+ Tests fail → /fix-bug {TICKET_ID} (real bug) or fix test (wrong expectation)
46
166
  ```
@@ -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
+ ```
@@ -17,6 +17,51 @@ Check if already set up:
17
17
  - Y → continue (existing files will be preserved — each step will offer merge/skip)
18
18
  - If only `specs/` exists or only partial setup detected → continue normally (safe to re-run)
19
19
 
20
+ ## Step 0.5 — Project Type
21
+
22
+ Ask the user:
23
+
24
+ ```
25
+ What type of project is this?
26
+ 1. Single-service — one codebase, one platform (standard setup)
27
+ 2. Umbrella repo — this repo contains multiple service submodules (microservices / multi-app)
28
+ 3. PO Spec repo — docs only, no runnable code (PRD + design-spec only)
29
+ ```
30
+
31
+ Store the answer as `project_type`. Default to `1` if user does not answer.
32
+
33
+ Based on answer:
34
+
35
+ **project_type = 1 (Single-service):** Continue standard setup below.
36
+
37
+ **project_type = 2 (Umbrella):** Ask two follow-up questions:
38
+ - "Path to spec submodule (e.g. `free-trial-specs`)? Press Enter to skip."
39
+ - "List services as `domain:module` pairs, comma-separated
40
+ (e.g. `user:java-spring,order:java-spring`). Press Enter to skip."
41
+
42
+ Then:
43
+ - Skip creating `specs/prd/`, `specs/design-spec/`, `specs/domain-knowledge/` (those live in spec submodule)
44
+ - Create only: `specs/bdd/`, `specs/tech-docs/`, `.trace/`, `.agent/review/` at umbrella level
45
+ *(Unless user explicitly asks to create the full structure)*
46
+ - Generate `.agent/project-context.yaml` in umbrella mode with the services and spec_source provided
47
+ - Skip creating `CLAUDE.md` (umbrella has no single tech stack)
48
+ - After setup, remind: "Open each service submodule separately in Claude Code to install the framework there if needed."
49
+
50
+ **project_type = 3 (PO Spec repo):**
51
+ - Create: `specs/prd/`, `specs/design-spec/`, `specs/product-definition/`, `specs/domain-knowledge/`, `.agent/review/`
52
+ - Skip: `specs/bdd/`, `specs/tech-docs/`, `.trace/`
53
+ - Generate minimal `CLAUDE.md` with only §1 (project overview) and §7 (git conventions)
54
+ - 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
55
+ - Inform:
56
+ - Commands for PO repo: `/define-product`, `/generate-prd`, `/review-context`, `/generate-design-spec`
57
+ - **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.
58
+ - Recommended PRD frontmatter:
59
+ ```
60
+ @trace.domain: {domain} ← must match a key in dev team's services config
61
+ @trace.id: {TICKET-ID}
62
+ @trace.status: draft | approved
63
+ ```
64
+
20
65
  ## Step 1 — Create Directory Structure
21
66
 
22
67
  Create these directories (skip if they exist):
@@ -27,15 +72,27 @@ Create these directories (skip if they exist):
27
72
  │ ├── product-definition/
28
73
  │ ├── prd/
29
74
  │ ├── bdd/
75
+ │ ├── design-spec/ ← Design Spec documents (FE/App platforms only)
76
+ │ ├── tech-docs/ ← technical design documents
30
77
  │ └── domain-knowledge/ ← business dictionary & domain context
31
- ├── tech-docs/
32
78
  ├── .trace/
33
79
  └── .agent/
34
80
  └── review/
35
81
  ```
36
82
 
83
+ *Directory structure varies by `project_type` set in Step 0.5:*
84
+
85
+ | project_type | Create | Skip |
86
+ |---|---|---|
87
+ | **1 — Single-service** | Full structure above | — |
88
+ | **2 — Umbrella** | `.agent/review/` only (at umbrella root) | Everything else — `specs/` dirs live inside service submodules |
89
+ | **3 — PO Spec repo** | `specs/prd/`, `specs/design-spec/`, `specs/product-definition/`, `specs/domain-knowledge/`, `.agent/review/` | `specs/bdd/`, `specs/tech-docs/`, `.trace/` |
90
+
37
91
  ## Step 2 — Create CLAUDE.md
38
92
 
93
+ *Skip this step entirely if `project_type = 2` (Umbrella) — umbrella has no single tech stack.*
94
+ *For `project_type = 3` (PO Spec repo) — create a minimal CLAUDE.md with only §1 (project overview) and §7 (git conventions). Skip §2–§6.*
95
+
39
96
  Check if `CLAUDE.md` exists:
40
97
  - Yes → ask "Merge template or skip?"
41
98
  - No → create from the template below
@@ -72,7 +129,7 @@ forbidden:
72
129
  # §4. Traceability
73
130
  # Every controller method must be tagged:
74
131
  # @trace.implements={UC-ID}-{SC-ID}
75
- # @trace.source=specs/bdd/{domain}/{UC-ID}.feature
132
+ # @trace.source=specs/bdd/{domain}/{UC-ID}.feature ← adjust if specs_dir differs in .agent/project-context.yaml
76
133
  # Tests must be tagged:
77
134
  # @trace.verifies={UC-ID}
78
135
 
@@ -92,12 +149,19 @@ commit_feature: "feat({{TICKET_PREFIX}}-{N}): {description}"
92
149
 
93
150
  ## Step 3 — Create project-context.yaml
94
151
 
152
+ *For `project_type = 2` (Umbrella):*
153
+ - *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.*
154
+ - *If not yet generated → ask: "Spec submodule path?" and "Services (domain:module pairs)?" then generate umbrella config (see Step 0.5 for format).*
155
+
95
156
  Create `.agent/project-context.yaml` using `.agent/templates/project-context.yaml` as the source template.
96
157
 
97
158
  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."
98
159
 
99
160
  ## Step 4 — Create business-dictionary.md
100
161
 
162
+ *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/`.*
163
+
164
+
101
165
  Create `specs/domain-knowledge/business-dictionary.md` if it does not exist:
102
166
 
103
167
  ```markdown
@@ -191,7 +255,13 @@ Or: VS Code → `Ctrl+Shift+P` → **"Extensions: Install from Marketplace"**
191
255
 
192
256
  ## Step 7 — Verify
193
257
 
258
+ Checklist varies by `project_type`:
259
+
260
+ **project_type = 1 (Single-service):**
194
261
  - [ ] `specs/` exists
262
+ - [ ] `specs/bdd/` exists
263
+ - [ ] `specs/design-spec/` exists *(skip if backend-only project)*
264
+ - [ ] `specs/tech-docs/` exists
195
265
  - [ ] `specs/domain-knowledge/` exists
196
266
  - [ ] `.trace/` exists
197
267
  - [ ] `.agent/project-context.yaml` exists
@@ -199,17 +269,78 @@ Or: VS Code → `Ctrl+Shift+P` → **"Extensions: Install from Marketplace"**
199
269
  - [ ] `specs/domain-knowledge/business-dictionary.md` exists
200
270
  - [ ] `specs/domain-knowledge/core-entities.md` exists
201
271
 
272
+ **project_type = 2 (Umbrella):**
273
+ - [ ] `.agent/project-context.yaml` exists with `setup.mode: umbrella`
274
+ - [ ] `services` section has at least one entry with correct domain keys
275
+ - [ ] `spec_source` path exists (e.g., `my-project-specs/` directory is present)
276
+ - [ ] `.agent/review/` exists
277
+ - [ ] Spec submodule initialized: `git submodule status` shows no `-` prefix
278
+
279
+ **project_type = 3 (PO Spec repo):**
280
+ - [ ] `specs/prd/` exists
281
+ - [ ] `specs/design-spec/` exists
282
+ - [ ] `specs/product-definition/` exists
283
+ - [ ] `specs/domain-knowledge/` exists
284
+ - [ ] `.agent/review/` exists
285
+ - [ ] `.agent/project-context.yaml` exists
286
+ - [ ] `CLAUDE.md` exists (minimal)
287
+ - [ ] `specs/domain-knowledge/business-dictionary.md` exists
288
+ - [ ] `specs/domain-knowledge/core-entities.md` exists
289
+
202
290
  ## Output
203
291
 
292
+ {{include:steps/report-footer.md}}
293
+
204
294
  ```
205
295
  /setup-ai-first Complete ✅
296
+ ```
297
+
298
+ Output varies by `project_type`:
299
+
300
+ **Single-service:**
301
+ ```
206
302
  Next:
207
303
  1. Fill CLAUDE.md (replace {{PLACEHOLDER}} values)
208
304
  2. Fill .agent/project-context.yaml
209
- 3. Fill specs/domain-knowledge/business-dictionary.md ← terminology rules
210
- 4. Fill specs/domain-knowledge/core-entities.md ← entity glossary for code gen
305
+ 3. Fill specs/domain-knowledge/business-dictionary.md
306
+ 4. Fill specs/domain-knowledge/core-entities.md
211
307
  5. git add and commit those 4 files
212
- 6. Install VS Code extension (if not yet installed):
308
+ 6. Install VS Code extension:
213
309
  code --install-extension edupia-team.spec-driven-dev-team
214
310
  7. /define-product to start your first feature
215
311
  ```
312
+
313
+ **Umbrella:**
314
+ ```
315
+ Next:
316
+ 1. Review .agent/project-context.yaml:
317
+ - Update services[].path to match actual submodule directory names
318
+ - Update services domain keys to match @trace.domain in your PRD files
319
+ - Confirm spec_source path is correct
320
+ 2. Ensure spec submodule is initialized:
321
+ git submodule update --init --recursive
322
+ 3. Pull latest specs from PO before generating:
323
+ git submodule update --remote {spec_source}
324
+ 4. Start generating:
325
+ /generate-bdd {spec_source}/specs/prd/{domain}/TICKET-ID-prd.md
326
+ ```
327
+
328
+ **PO Spec repo:**
329
+ ```
330
+ Next:
331
+ 1. Fill .agent/project-context.yaml:
332
+ - domains: [list all business domains — these become @trace.domain values in PRDs]
333
+ - project.name, project.description
334
+ 2. Fill specs/domain-knowledge/business-dictionary.md ← canonical terms
335
+ 3. Fill specs/domain-knowledge/core-entities.md ← entity glossary
336
+ 4. git add and commit those files
337
+ 5. Install VS Code extension:
338
+ code --install-extension edupia-team.spec-driven-dev-team
339
+ 6. /define-product to start your first feature
340
+
341
+ ⚠️ Dev team handoff reminder:
342
+ - Each PRD must have @trace.domain matching one of your domains list
343
+ - When dev team sets up their umbrella repo, they map these domain names
344
+ to service submodule paths in their project-context.yaml services section
345
+ - Share domain names with dev team before they configure their umbrellas
346
+ ```