@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
@@ -250,7 +250,8 @@ Suggest the logical next command based on workflow phase:
250
250
  | /define-product | `/generate-prd {product-definition-file}` |
251
251
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
252
252
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
253
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
253
+ | /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 |
254
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
254
255
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
255
256
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
256
257
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -324,6 +325,7 @@ Read `.agent/project-context.yaml`. Extract and store:
324
325
  - `paths.core_entities` → path to core-entities.md
325
326
  - `paths.tech_docs_dir` → technical documentation root
326
327
  - `paths.trace_dir` → trace state directory
328
+ - `paths.design_spec_dir` → Design Spec documents root (FE/App only)
327
329
 
328
330
  If `paths` section is absent, use these defaults:
329
331
  - `specs_dir` = `specs/bdd`
@@ -335,11 +337,44 @@ If `paths` section is absent, use these defaults:
335
337
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
336
338
  - `tech_docs_dir` = `specs/tech-docs`
337
339
  - `trace_dir` = `.trace`
340
+ - `design_spec_dir` = `specs/design-spec`
338
341
 
339
342
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
340
343
 
341
344
  ---
342
345
 
346
+ ## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
347
+
348
+ *Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
349
+
350
+ If `services` section is present:
351
+
352
+ **1. Detect active domain** (in priority order):
353
+ - Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
354
+ - Extract from target file path: segment immediately after `prd_dir` base path
355
+ *(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
356
+ - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
357
+
358
+ **2. Route to service** — if active domain matches a key in `services`:
359
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir`
360
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
361
+ - Store `active_service` = `services.{domain}.path`
362
+ - Store `active_service_module` = `services.{domain}.module`
363
+ - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
364
+
365
+ **3. Fallback** — if domain not detected or no matching service key:
366
+ - Keep default paths from Step 1
367
+ - Set `active_service = unresolved`
368
+
369
+ **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
370
+ - Override `paths.prd_dir` → `{spec_source}/specs/prd`
371
+ - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
372
+ - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
373
+ - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
374
+ - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
375
+
376
+ ---
377
+
343
378
  ## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
344
379
 
345
380
  If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
@@ -445,6 +480,7 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
445
480
  Ticket : {ticket_prefix}-
446
481
  Dict : {loaded — N canonical terms, M banned terms | missing}
447
482
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
483
+ Service : {active_service} ({active_service_module}) | single-service
448
484
  Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
449
485
  ```
450
486
 
@@ -557,7 +593,8 @@ Suggest the logical next command based on workflow phase:
557
593
  | /define-product | `/generate-prd {product-definition-file}` |
558
594
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
559
595
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
560
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
596
+ | /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 |
597
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
561
598
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
562
599
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
563
600
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -634,6 +671,7 @@ Read `.agent/project-context.yaml`. Extract and store:
634
671
  - `paths.core_entities` → path to core-entities.md
635
672
  - `paths.tech_docs_dir` → technical documentation root
636
673
  - `paths.trace_dir` → trace state directory
674
+ - `paths.design_spec_dir` → Design Spec documents root (FE/App only)
637
675
 
638
676
  If `paths` section is absent, use these defaults:
639
677
  - `specs_dir` = `specs/bdd`
@@ -645,11 +683,44 @@ If `paths` section is absent, use these defaults:
645
683
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
646
684
  - `tech_docs_dir` = `specs/tech-docs`
647
685
  - `trace_dir` = `.trace`
686
+ - `design_spec_dir` = `specs/design-spec`
648
687
 
649
688
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
650
689
 
651
690
  ---
652
691
 
692
+ ## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
693
+
694
+ *Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
695
+
696
+ If `services` section is present:
697
+
698
+ **1. Detect active domain** (in priority order):
699
+ - Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
700
+ - Extract from target file path: segment immediately after `prd_dir` base path
701
+ *(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
702
+ - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
703
+
704
+ **2. Route to service** — if active domain matches a key in `services`:
705
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir`
706
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
707
+ - Store `active_service` = `services.{domain}.path`
708
+ - Store `active_service_module` = `services.{domain}.module`
709
+ - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
710
+
711
+ **3. Fallback** — if domain not detected or no matching service key:
712
+ - Keep default paths from Step 1
713
+ - Set `active_service = unresolved`
714
+
715
+ **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
716
+ - Override `paths.prd_dir` → `{spec_source}/specs/prd`
717
+ - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
718
+ - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
719
+ - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
720
+ - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
721
+
722
+ ---
723
+
653
724
  ## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
654
725
 
655
726
  If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
@@ -755,6 +826,7 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
755
826
  Ticket : {ticket_prefix}-
756
827
  Dict : {loaded — N canonical terms, M banned terms | missing}
757
828
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
829
+ Service : {active_service} ({active_service_module}) | single-service
758
830
  Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
759
831
  ```
760
832
 
@@ -882,7 +954,8 @@ Suggest the logical next command based on workflow phase:
882
954
  | /define-product | `/generate-prd {product-definition-file}` |
883
955
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
884
956
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
885
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
957
+ | /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 |
958
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
886
959
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
887
960
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
888
961
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -42,6 +42,7 @@ Read `.agent/project-context.yaml`. Extract and store:
42
42
  - `paths.core_entities` → path to core-entities.md
43
43
  - `paths.tech_docs_dir` → technical documentation root
44
44
  - `paths.trace_dir` → trace state directory
45
+ - `paths.design_spec_dir` → Design Spec documents root (FE/App only)
45
46
 
46
47
  If `paths` section is absent, use these defaults:
47
48
  - `specs_dir` = `specs/bdd`
@@ -53,11 +54,44 @@ If `paths` section is absent, use these defaults:
53
54
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
54
55
  - `tech_docs_dir` = `specs/tech-docs`
55
56
  - `trace_dir` = `.trace`
57
+ - `design_spec_dir` = `specs/design-spec`
56
58
 
57
59
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
58
60
 
59
61
  ---
60
62
 
63
+ ## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
64
+
65
+ *Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
66
+
67
+ If `services` section is present:
68
+
69
+ **1. Detect active domain** (in priority order):
70
+ - Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
71
+ - Extract from target file path: segment immediately after `prd_dir` base path
72
+ *(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
73
+ - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
74
+
75
+ **2. Route to service** — if active domain matches a key in `services`:
76
+ - Override `paths.specs_dir` → `services.{domain}.specs_dir`
77
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
78
+ - Store `active_service` = `services.{domain}.path`
79
+ - Store `active_service_module` = `services.{domain}.module`
80
+ - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
81
+
82
+ **3. Fallback** — if domain not detected or no matching service key:
83
+ - Keep default paths from Step 1
84
+ - Set `active_service = unresolved`
85
+
86
+ **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
87
+ - Override `paths.prd_dir` → `{spec_source}/specs/prd`
88
+ - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
89
+ - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
90
+ - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
91
+ - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
92
+
93
+ ---
94
+
61
95
  ## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
62
96
 
63
97
  If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
@@ -163,6 +197,7 @@ Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Ser
163
197
  Ticket : {ticket_prefix}-
164
198
  Dict : {loaded — N canonical terms, M banned terms | missing}
165
199
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
200
+ Service : {active_service} ({active_service_module}) | single-service
166
201
  Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
167
202
  ```
168
203
 
@@ -30,7 +30,8 @@ Suggest the logical next command based on workflow phase:
30
30
  | /define-product | `/generate-prd {product-definition-file}` |
31
31
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
32
32
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
33
- | /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
33
+ | /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 |
34
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
34
35
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
35
36
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
36
37
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
@@ -0,0 +1,209 @@
1
+ # {TICKET-ID} {Feature Name} — Design Spec [{Platform}]
2
+
3
+ <!--
4
+ Template này được sử dụng bởi /generate-design-spec.
5
+ Platform = web | app | app-ios | app-android
6
+
7
+ PLATFORM SECTIONS:
8
+ - Section 3A + 4A: chỉ dành cho web (react/nextjs/vue/angular). Xóa C khi dùng cho web.
9
+ - Section 3C + 4B: chỉ dành cho app (flutter/react-native/ios/android). Xóa A+B khi dùng cho app.
10
+
11
+ COMPONENT MAPPING (bắt buộc):
12
+ - Mọi component trong Component Inventory PHẢI được map với figma-components/{module}.md
13
+ - ✅ Matched → dùng Code Component và Import Path từ catalog
14
+ - ⚠️ TODO → đánh dấu [TODO — chưa implement]
15
+ - ❌ Chưa có → đánh dấu [NEW — cần confirm với designer]
16
+
17
+ SCREEN STATES (bắt buộc mỗi màn):
18
+ - Tối thiểu: default, loading, error
19
+ - Thêm "empty" nếu màn có thể hiển thị trạng thái không có dữ liệu
20
+ - Thêm "success" nếu action tạo ra trạng thái xác nhận riêng biệt
21
+ -->
22
+
23
+ ---
24
+
25
+ ## Metadata
26
+
27
+ | Field | Value |
28
+ |--------------------|---------------------------------------------------------------|
29
+ | **Spec ID** | {TICKET-ID}-DS-{platform} |
30
+ | **Version** | 1.0 |
31
+ | **Status** | draft / approved |
32
+ | **Platform** | {web \| app \| app-ios \| app-android} |
33
+ | **Module** | {active_module} |
34
+ | **Service** | {active_service} |
35
+ | **Domain** | {domain} |
36
+ | **Business PRD** | [{TICKET-ID}](./{TICKET-ID}-slug.md) |
37
+ | **Figma** | {figma_url or TBD} |
38
+ | **Author** | {PO name or "AI-assisted"} |
39
+ | **Created** | {YYYY-MM-DD} |
40
+ | **Updated** | {YYYY-MM-DD} |
41
+
42
+ ---
43
+
44
+ # 1. Screen Inventory
45
+
46
+ | # | Screen Name | Entry Point | Figma Frame | Notes |
47
+ |---|-------------|-------------|-------------|-------|
48
+ | 1 | {Screen 1} | {how user arrives} | [Frame]({figma_url}) | |
49
+ | 2 | {Screen 2} | {entry point} | [Frame]({figma_url}) | |
50
+
51
+ ---
52
+
53
+ # 2. Screen Specs
54
+
55
+ ## Screen 1: {Screen Name}
56
+
57
+ **Figma**: [{Frame name}]({figma_frame_url})
58
+
59
+ ### Layout
60
+
61
+ {Grid / max-width / padding / spacing — reference design tokens where applicable}
62
+
63
+ ### Component Inventory
64
+
65
+ | Component (Figma) | Code Component | Import Path | States | Notes |
66
+ |------------------------|----------------|------------------------|---------------------------------|---------|
67
+ | {Figma/Button/Primary} | Button | @/components/ui/Button | default, loading, disabled | |
68
+ | {Figma/Input/Text} | TextInput | @/components/ui/Input | default, focus, error, disabled | |
69
+
70
+ ### Screen States
71
+
72
+ | State | Trigger | UI Behavior |
73
+ |-----------|----------------------------------|----------------------------------------------------------|
74
+ | default | Screen loaded, data available | {Describe full rendered appearance} |
75
+ | loading | API call in flight | {Skeleton / spinner position and style} |
76
+ | error | API failure / validation error | {Toast / inline error / error screen + recovery CTA} |
77
+ | empty | No data returned | {Illustration + CTA — e.g., "No items yet. Add one →"} |
78
+ | success | Action completed (if applicable) | {Confirmation toast / navigation / visual change} |
79
+
80
+ ### Actions & Navigation
81
+
82
+ | Action | Trigger | Result |
83
+ |-----------------|---------------------------|---------------------------------------------------|
84
+ | {Action name} | Tap/click {element} | Navigate to {Screen N} / Open {Modal name} |
85
+ | {Back/Cancel} | Back gesture / button | Return to {previous screen} without saving |
86
+
87
+ ---
88
+
89
+ <!-- Repeat ## Screen N for each additional screen -->
90
+
91
+ ---
92
+
93
+ # 3. Interaction Patterns
94
+
95
+ <!-- === WEB ONLY — delete this section for app === -->
96
+
97
+ ## A. Responsive Behavior *(web)*
98
+
99
+ | Breakpoint | Width | Layout Changes |
100
+ |------------|------------|---------------------------------------------|
101
+ | Mobile | < 768px | {Single column, bottom nav, full-width CTA} |
102
+ | Tablet | 768–1279px | {2-col grid, sidebar collapsed} |
103
+ | Desktop | ≥ 1280px | {Full layout, max-width 1440px} |
104
+
105
+ ## B. Hover / Focus / Keyboard *(web)*
106
+
107
+ | Element | Hover | Focus | Keyboard |
108
+ |----------------|-------------------------------|---------------------------------|---------------|
109
+ | Primary button | Background → {color.hover} | Outline 2px {color.focus} | Enter / Space |
110
+ | Text input | Border → {color.border.hover} | Border → {color.primary} | Tab to focus |
111
+
112
+ <!-- === APP ONLY — delete sections A+B for app === -->
113
+
114
+ ## C. Gestures & Navigation *(app)*
115
+
116
+ | Gesture | Screen / Element | Behavior |
117
+ |----------------------|---------------------|---------------------------------------------|
118
+ | Back gesture | All screens | {Return / show "Discard changes?" dialog} |
119
+ | Pull-to-refresh | {Screen names} | Refresh data, spinner at top |
120
+ | Swipe left on row | {List item} | Reveal {Delete / Archive} action |
121
+
122
+ ### Navigation Stack *(app)*
123
+
124
+ ```
125
+ {e.g., BottomTab(Home) → ListPage → DetailPage → EditPage}
126
+ ```
127
+
128
+ ### Platform Conventions *(app)*
129
+
130
+ | Aspect | iOS | Android |
131
+ |------------------|-------------------------------------------|-------------------------------------|
132
+ | Navigation bar | Back button top-left, title centered | Up arrow, title left-aligned |
133
+ | Bottom sheet | UISheetPresentation, grabber visible | BottomSheet, drag handle |
134
+ | Dialog | Actions right-aligned | Actions left-aligned |
135
+
136
+ ---
137
+
138
+ # 4. Platform Considerations
139
+
140
+ <!-- === WEB ONLY === -->
141
+
142
+ ## A. Accessibility *(web)*
143
+
144
+ - [ ] All interactive elements reachable by Tab key — no keyboard traps
145
+ - [ ] Focus trap inside modals
146
+ - [ ] Icon-only buttons have `aria-label`
147
+ - [ ] Dynamic content announces via `aria-live`
148
+ - [ ] WCAG AA contrast: text ≥ 4.5:1, large text ≥ 3:1
149
+ - [ ] Form inputs have visible labels (not placeholder-only)
150
+
151
+ <!-- === APP ONLY === -->
152
+
153
+ ## B. Device & OS *(app)*
154
+
155
+ - [ ] Safe area insets applied (top + bottom) on all screens
156
+ - [ ] Minimum touch target: 44×44pt (iOS) / 48×48dp (Android)
157
+ - [ ] Tested on 375pt (iPhone SE) and 360dp (small Android)
158
+ - [ ] Deep link: `{scheme}://{host}/{path}` → {screen name}
159
+ - [ ] Permissions: {Camera / Location / Notification} — rationale copy TBD
160
+ - [ ] Offline: {screen name} shows cached data + banner; {action} disabled with tooltip
161
+ - [ ] Dark mode tested — no hardcoded colors
162
+
163
+ ---
164
+
165
+ # 5. AC-UI — Design Acceptance Criteria
166
+
167
+ > Reviewed and signed off by **PO + Designer** before BDD generation.
168
+ > Complements business-level AC in [Business PRD](./{TICKET-ID}-slug.md).
169
+
170
+ | ID | Acceptance Criterion | Verified by |
171
+ |--------|--------------------------------------------------------------------------|-----------------|
172
+ | AC-UI1 | All screens match approved Figma frames within design-system tolerances | Designer |
173
+ | AC-UI2 | Loading state appears within 200ms of any API call initiation | QA |
174
+ | AC-UI3 | All error messages are visible, descriptive, and include a recovery CTA | PO |
175
+ | AC-UI4 | Empty states include illustration and call-to-action | PO + Designer |
176
+ | AC-UI5 | {Platform-specific criterion} | QA |
177
+
178
+ ---
179
+
180
+ # Appendix
181
+
182
+ ## Figma Summary
183
+
184
+ | Screen | Figma Frame | Status |
185
+ |------------|----------------------|--------------------------------|
186
+ | {Screen 1} | [Link]({url}) | ✅ Ready / ⏳ WIP / ❌ Missing |
187
+
188
+ ## Design Tokens Referenced
189
+
190
+ | Token | Value | Used in |
191
+ |-------------------|----------|----------------------------|
192
+ | `color.primary` | {#hex} | Buttons, links |
193
+ | `spacing.md` | {16px} | Standard vertical gap |
194
+
195
+ ## References
196
+
197
+ - [{TICKET-ID}](./{TICKET-ID}-slug.md) — Business PRD
198
+
199
+ ## AI Assumptions
200
+
201
+ - {Assumption — [AI DRAFT]}
202
+
203
+ ---
204
+
205
+ ## Changelog
206
+
207
+ | Version | Date | Changes |
208
+ |---------|--------------|-----------------|
209
+ | 1.0 | {YYYY-MM-DD} | Initial version |
@@ -48,6 +48,9 @@ paths:
48
48
  # Tech Docs
49
49
  tech_docs_dir: "tech-docs"
50
50
 
51
+ # Design Specs (FE/App platforms only — web, app)
52
+ design_spec_dir: "specs/design-spec"
53
+
51
54
  # Trace
52
55
  trace_dir: ".trace"
53
56
 
@@ -69,6 +72,32 @@ domains:
69
72
  - "{{DOMAIN_1}}"
70
73
  # - "{{DOMAIN_2}}"
71
74
 
75
+ # ----- Multi-Service / Umbrella Setup -----
76
+ # Fill this section ONLY if this is an UMBRELLA repo that contains multiple
77
+ # service submodules. Leave commented out for single-service projects.
78
+ #
79
+ # setup:
80
+ # mode: umbrella # "umbrella" | "single" (default: single)
81
+ # spec_source: "{{SPEC_SUBMODULE_PATH}}" # path to PO spec submodule, e.g. "free-trial-specs"
82
+ #
83
+ # When spec_source is set, context-loader auto-derives:
84
+ # prd_dir → {spec_source}/specs/prd
85
+ # design_spec_dir → {spec_source}/specs/design-spec
86
+ # domain_knowledge_dir → {spec_source}/specs/domain-knowledge
87
+ # (You can still override these manually in paths: section below.)
88
+ #
89
+ # services: # domain → service submodule routing
90
+ # {{DOMAIN_1}}: # must match @trace.domain in PRD files
91
+ # path: "{{SERVICE_SUBMODULE_DIR}}" # relative path to service submodule
92
+ # module: "{{STACK_MODULE}}" # e.g., java-spring, nextjs, flutter
93
+ # specs_dir: "{{SERVICE_SUBMODULE_DIR}}/specs/bdd"
94
+ # tech_docs_dir: "{{SERVICE_SUBMODULE_DIR}}/specs/tech-docs"
95
+ # {{DOMAIN_2}}:
96
+ # path: "{{SERVICE_2_DIR}}"
97
+ # module: "{{STACK_MODULE}}"
98
+ # specs_dir: "{{SERVICE_2_DIR}}/specs/bdd"
99
+ # tech_docs_dir: "{{SERVICE_2_DIR}}/specs/tech-docs"
100
+
72
101
  # ----- Architecture -----
73
102
  architecture:
74
103
  style: "{{ARCH_STYLE}}" # e.g., Layered / Clean / Hexagonal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anhth2/spec-driven-dev-plugin",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "AI-First Spec-Driven Development workflow plugin for Claude Code",
5
5
  "bin": {
6
6
  "spec-driven-dev": "./bin/index.js"
@@ -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}` |