@educa-corp/sdd-framework 0.2.3 → 0.2.5

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 (150) hide show
  1. package/commands/generate-architecture.md +706 -0
  2. package/commands/generate-architecture.tmpl +194 -0
  3. package/commands/generate-code.md +16 -2
  4. package/commands/generate-code.tmpl +16 -2
  5. package/commands/generate-tech-docs.md +19 -0
  6. package/commands/generate-tech-docs.tmpl +19 -0
  7. package/core/FRAMEWORK_VERSION +1 -1
  8. package/core/commands/generate-architecture.md +706 -0
  9. package/core/commands/generate-code.md +16 -2
  10. package/core/commands/generate-tech-docs.md +19 -0
  11. package/core/skills/setup-ai-first/SKILL.md +12 -4
  12. package/core/templates/architecture.template.md +392 -111
  13. package/docs/01-getting-started/installation.md +47 -112
  14. package/docs/01-getting-started/quickstart.md +58 -72
  15. package/docs/01-getting-started/what-is-sdd.md +75 -0
  16. package/docs/02-concepts/architecture.md +109 -0
  17. package/docs/02-concepts/glossary.md +87 -0
  18. package/docs/02-concepts/overview.md +93 -0
  19. package/docs/02-concepts/pipeline-steps/00-setup.md +102 -0
  20. package/docs/02-concepts/pipeline-steps/01-discovery.md +129 -0
  21. package/docs/02-concepts/pipeline-steps/02-specification.md +130 -0
  22. package/docs/02-concepts/pipeline-steps/03-design-spec.md +90 -0
  23. package/docs/02-concepts/pipeline-steps/04-bdd.md +120 -0
  24. package/docs/02-concepts/pipeline-steps/05-tech-docs.md +101 -0
  25. package/docs/02-concepts/pipeline-steps/06-code.md +119 -0
  26. package/docs/02-concepts/pipeline-steps/07-dev-selftest.md +92 -0
  27. package/docs/02-concepts/pipeline-steps/08-qc-automation.md +102 -0
  28. package/docs/02-concepts/pipeline-steps/09-validate-traces.md +104 -0
  29. package/docs/02-concepts/pipeline-steps/10-feedback-loop.md +105 -0
  30. package/docs/02-concepts/pipeline-steps/README.md +92 -0
  31. package/docs/02-concepts/roles-and-hitl.md +73 -0
  32. package/docs/02-concepts/traceability.md +94 -0
  33. package/docs/03-guides/architect.md +98 -0
  34. package/docs/03-guides/developer.md +76 -0
  35. package/docs/03-guides/product-owner.md +68 -0
  36. package/docs/03-guides/tester-qa.md +70 -0
  37. package/docs/04-reference/commands.md +105 -0
  38. package/docs/04-reference/configuration.md +94 -0
  39. package/docs/04-reference/model-selection.md +68 -0
  40. package/docs/04-reference/modules.md +74 -0
  41. package/docs/04-reference/trace-schema.md +93 -0
  42. package/docs/README.md +29 -40
  43. package/docs/explain/00-setup-ai-first.md +77 -0
  44. package/docs/explain/00b-generate-architecture.md +76 -0
  45. package/docs/explain/01-define-product.md +79 -0
  46. package/docs/explain/02-generate-prd.md +78 -0
  47. package/docs/explain/03-refine-prd.md +86 -0
  48. package/docs/explain/04-review-context.md +100 -0
  49. package/docs/explain/05-generate-design-spec.md +73 -0
  50. package/docs/explain/06-generate-bdd.md +77 -0
  51. package/docs/explain/07-generate-tech-docs.md +71 -0
  52. package/docs/explain/08-review-tech-docs.md +79 -0
  53. package/docs/explain/09-generate-code.md +78 -0
  54. package/docs/explain/10-review-code.md +70 -0
  55. package/docs/explain/11-map-testids.md +69 -0
  56. package/docs/explain/12-dev-gen-test.md +66 -0
  57. package/docs/explain/13-dev-run-test.md +69 -0
  58. package/docs/explain/14-dev-smoke-test.md +67 -0
  59. package/docs/explain/15-qc-analyze.md +68 -0
  60. package/docs/explain/16-qc-plan.md +61 -0
  61. package/docs/explain/17-qc-design-test.md +61 -0
  62. package/docs/explain/18-qc-review.md +59 -0
  63. package/docs/explain/19-qc-run-test.md +67 -0
  64. package/docs/explain/20-qc-report.md +61 -0
  65. package/docs/explain/21-validate-traces.md +68 -0
  66. package/docs/explain/22-generate-spec-manifest.md +60 -0
  67. package/docs/explain/23-fix-bug.md +69 -0
  68. package/docs/explain/24-debug.md +61 -0
  69. package/docs/explain/25-report-bug.md +65 -0
  70. package/docs/explain/26-propose-scenario.md +63 -0
  71. package/docs/explain/27-learn.md +65 -0
  72. package/docs/explain/28-sync.md +70 -0
  73. package/docs/explain/29-update-framework.md +65 -0
  74. package/docs/explain/README.md +134 -0
  75. package/package.json +1 -1
  76. package/skills/setup-ai-first/SKILL.md +12 -4
  77. package/skills/setup-ai-first/SKILL.tmpl +12 -4
  78. package/templates/architecture.template.md +392 -111
  79. package/docs/01-getting-started/README.md +0 -19
  80. package/docs/01-getting-started/core-concepts.md +0 -102
  81. package/docs/02-guides/README.md +0 -26
  82. package/docs/02-guides/bdd-input-checklist.md +0 -68
  83. package/docs/02-guides/developer/README.md +0 -49
  84. package/docs/02-guides/developer/bdd-and-trace.md +0 -126
  85. package/docs/02-guides/developer/commands.md +0 -76
  86. package/docs/02-guides/developer/pr-checklist.md +0 -16
  87. package/docs/02-guides/developer/scenarios.md +0 -460
  88. package/docs/02-guides/developer/workflow.md +0 -121
  89. package/docs/02-guides/prd-input-checklist.md +0 -94
  90. package/docs/02-guides/product-owner/README.md +0 -81
  91. package/docs/02-guides/product-owner/commands.md +0 -30
  92. package/docs/02-guides/product-owner/handoff-checklist.md +0 -42
  93. package/docs/02-guides/product-owner/prd-writing-rules.md +0 -45
  94. package/docs/02-guides/product-owner/scenarios.md +0 -438
  95. package/docs/02-guides/tech-docs-input-checklist.md +0 -109
  96. package/docs/02-guides/tester/README.md +0 -75
  97. package/docs/02-guides/tester/bug-reporting.md +0 -117
  98. package/docs/02-guides/tester/qc-automation.md +0 -165
  99. package/docs/02-guides/tester/reading-specs.md +0 -79
  100. package/docs/02-guides/tester/scenarios.md +0 -186
  101. package/docs/02-guides/tester/spec-manifest.md +0 -130
  102. package/docs/02-guides/tester/test-checklist.md +0 -31
  103. package/docs/02-guides/tester/workflow.md +0 -77
  104. package/docs/03-concepts/README.md +0 -20
  105. package/docs/03-concepts/architecture.md +0 -248
  106. package/docs/03-concepts/mechanisms-explained.md +0 -124
  107. package/docs/03-concepts/pipeline.md +0 -278
  108. package/docs/03-concepts/traceability.md +0 -152
  109. package/docs/04-operations/README.md +0 -33
  110. package/docs/04-operations/bug-flow.md +0 -364
  111. package/docs/04-operations/publishing.md +0 -154
  112. package/docs/04-operations/sync-and-update.md +0 -522
  113. package/docs/05-reference/README.md +0 -34
  114. package/docs/05-reference/command-cheatsheet.md +0 -147
  115. package/docs/05-reference/commands.md +0 -234
  116. package/docs/05-reference/model-selection.md +0 -74
  117. package/docs/05-reference/modules.md +0 -110
  118. package/docs/05-reference/trace-schema.md +0 -154
  119. package/docs/06-commands/README.md +0 -75
  120. package/docs/06-commands/explain-debug.md +0 -32
  121. package/docs/06-commands/explain-define-product.md +0 -43
  122. package/docs/06-commands/explain-dev-gen-test.md +0 -28
  123. package/docs/06-commands/explain-dev-run-test.md +0 -24
  124. package/docs/06-commands/explain-dev-smoke-test.md +0 -25
  125. package/docs/06-commands/explain-fix-bug.md +0 -28
  126. package/docs/06-commands/explain-generate-bdd.md +0 -45
  127. package/docs/06-commands/explain-generate-code.md +0 -53
  128. package/docs/06-commands/explain-generate-design-spec.md +0 -54
  129. package/docs/06-commands/explain-generate-prd.md +0 -45
  130. package/docs/06-commands/explain-generate-spec-manifest.md +0 -20
  131. package/docs/06-commands/explain-generate-tech-docs.md +0 -56
  132. package/docs/06-commands/explain-learn.md +0 -21
  133. package/docs/06-commands/explain-map-testids.md +0 -28
  134. package/docs/06-commands/explain-propose-scenario.md +0 -24
  135. package/docs/06-commands/explain-qc-analyze.md +0 -22
  136. package/docs/06-commands/explain-qc-design-test.md +0 -20
  137. package/docs/06-commands/explain-qc-plan.md +0 -21
  138. package/docs/06-commands/explain-qc-report.md +0 -23
  139. package/docs/06-commands/explain-qc-review.md +0 -24
  140. package/docs/06-commands/explain-qc-run-test.md +0 -27
  141. package/docs/06-commands/explain-refine-prd.md +0 -51
  142. package/docs/06-commands/explain-report-bug.md +0 -24
  143. package/docs/06-commands/explain-review-code.md +0 -45
  144. package/docs/06-commands/explain-review-context.md +0 -68
  145. package/docs/06-commands/explain-review-tech-docs.md +0 -45
  146. package/docs/06-commands/explain-setup-ai-first.md +0 -25
  147. package/docs/06-commands/explain-sync.md +0 -24
  148. package/docs/06-commands/explain-update-framework.md +0 -22
  149. package/docs/06-commands/explain-validate-traces.md +0 -25
  150. package/docs/t-sample.md +0 -826
@@ -0,0 +1,105 @@
1
+ [← Docs Home](../README.md) · [Reference](./)
2
+
3
+ # Reference · Commands — Bảng đầy đủ (Command Catalog)
4
+
5
+ > 31 slash command, gom theo phase pipeline. Chi tiết cơ chế từng bước → [Pipeline Steps](../02-concepts/pipeline-steps/).
6
+
7
+ Mọi lệnh chạy chung một **Gate** (model check → target → context-loader → checkpoint). Xem [Khung chung](../02-concepts/pipeline-steps/README.md#khung-chung-mọi-command-common-gate).
8
+
9
+ ---
10
+
11
+ ## 0 · Setup & Foundation
12
+
13
+ | Lệnh | Input | Output | Owner |
14
+ |------|-------|--------|-------|
15
+ | `/setup-ai-first` | Dự án trống/có code | `.agent/`, `.claude/`, `project-context.yaml`, `CLAUDE.md` | Admin/Lead |
16
+ | `/generate-architecture` | config + tài liệu (`--from`) + code | `architecture.md` (SSOT kiến trúc, theo tier) | SA/Lead |
17
+
18
+ ## 1 · Discovery
19
+
20
+ | Lệnh | Input | Output | Owner |
21
+ |------|-------|--------|-------|
22
+ | `/define-product` | Ý tưởng (+Figma) | `product-definition/*.md` (8 chặng) | PO |
23
+
24
+ ## 2 · Specification (PRD)
25
+
26
+ | Lệnh | Input | Output | Owner |
27
+ |------|-------|--------|-------|
28
+ | `/generate-prd` | product-definition | PRD draft | PO |
29
+ | `/refine-prd` | PRD | Findings 3 lăng kính DEV/SA/PO | PO+SA+Dev |
30
+ | `/review-context` (PRD) | PRD | Findings P0–P5 → `Status: approved` | PO |
31
+
32
+ ## 3 · Design-Spec (chỉ FE/App)
33
+
34
+ | Lệnh | Input | Output | Owner |
35
+ |------|-------|--------|-------|
36
+ | `/generate-design-spec` | PRD approved + Figma | `design-spec/*.md` | PO/PM |
37
+
38
+ ## 4 · BDD
39
+
40
+ | Lệnh | Input | Output | Owner |
41
+ |------|-------|--------|-------|
42
+ | `/generate-bdd` | PRD approved (+design-spec) | `bdd/**/*.feature` | PO |
43
+ | `/review-context` (BDD) | `.feature` | Findings B1–B6 → `@trace.status: approved` | PO/Dev |
44
+
45
+ ## 5 · Tech-Docs
46
+
47
+ | Lệnh | Input | Output | Owner |
48
+ |------|-------|--------|-------|
49
+ | `/generate-tech-docs` | BDD approved + entity catalog | `tech-docs/{TICKET}-tech-design.md` | SA |
50
+ | `/review-tech-docs` | tech-design | Findings đa chiều + ký T7 | SA/Lead |
51
+
52
+ ## 6 · Code
53
+
54
+ | Lệnh | Input | Output | Owner |
55
+ |------|-------|--------|-------|
56
+ | `/generate-code` | `.feature` approved + tech-design | Code + `.trace/*.tsv` | Dev |
57
+ | `/review-code` | Code | Findings (read-only) | Dev/Lead |
58
+ | `/fix-bug` | Bug report | Fix + regression test | Dev |
59
+ | `/map-testids` | UI code | testid map (FE) | Dev |
60
+ | `/debug` | Mô tả lỗi | Phân tích (read-only) | Dev |
61
+
62
+ ## 7 · Dev self-test
63
+
64
+ | Lệnh | Input | Output | Owner |
65
+ |------|-------|--------|-------|
66
+ | `/dev-gen-test` | Code + `.feature` | Bộ self-test | Dev |
67
+ | `/dev-run-test` | Self-test | Kết quả + cột `dev_selftest` | Dev |
68
+ | `/dev-smoke-test` | Service/app đang chạy | Kết quả smoke tại chỗ | Dev |
69
+
70
+ ## 8 · QC Automation
71
+
72
+ | Lệnh | Input | Output | Owner |
73
+ |------|-------|--------|-------|
74
+ | `/qc-analyze` | UC + spec | `REQUIREMENT_ANALYSIS.md`, `DOC_GAPS.md` | QA |
75
+ | `/qc-plan` | Analysis | `TEST_PLAN.md` (rủi ro) | QA |
76
+ | `/qc-design-test` | Plan | `test-cases/*.Test.md` | QA |
77
+ | `/qc-review` | Test case/script | 🛑 Cổng review | QA |
78
+ | `/qc-run-test` | `.Test.md` reviewed | Script Playwright + `qc_status` | QA |
79
+ | `/qc-report` | Kết quả run | Report + evidence + product-gap | QA |
80
+
81
+ ## 9 · Quality & Trace
82
+
83
+ | Lệnh | Input | Output | Owner |
84
+ |------|-------|--------|-------|
85
+ | `/validate-traces` | `.trace/*.tsv` + spec/code/test | Ma trận coverage (read-only) | Dev/QA/Lead |
86
+ | `/generate-spec-manifest` | Specs | Mục lục spec cho agent ngoài | SA/Lead |
87
+
88
+ ## 10 · Feedback & Ops
89
+
90
+ | Lệnh | Input | Output | Owner |
91
+ |------|-------|--------|-------|
92
+ | `/report-bug` | Lỗi phát hiện | `feedback/bug-reports/` (spec-anchored) | Tester/QC |
93
+ | `/propose-scenario` | Scenario thiếu | `feedback/bdd-proposals/` | Tester/QC |
94
+ | `/learn` | Định hướng lặp lại | `project-lessons.md` | Tất cả |
95
+ | `/sync` | (umbrella) | Pull + submodule + nổi feedback + Living Docs | Lead |
96
+ | `/update-framework` | — | Sync bản npm mới | Lead |
97
+
98
+ ---
99
+
100
+ ## Ký hiệu trạng thái trong report
101
+
102
+ - 🛑 checkpoint (dừng, chờ `Y`) · 🔒 gate trạng thái (chặn downstream) · ⚪ read-only
103
+ - ⚠️ cảnh báo mềm (không chặn) · ✅ pass · ❌ fail
104
+
105
+ → [Trace Schema](trace-schema.md) · [Modules](modules.md) · [Configuration](configuration.md) · [Model Selection](model-selection.md)
@@ -0,0 +1,94 @@
1
+ [← Reference](./) · [Concepts › Architecture](../02-concepts/architecture.md)
2
+
3
+ # Reference · Configuration
4
+
5
+ > Hai file cấu hình chính. `/update-framework` **không** đụng chúng — đây là nội dung của bạn.
6
+
7
+ ---
8
+
9
+ ## 1. `project-context.yaml`
10
+
11
+ **Single source of truth** cho paths/mode/routing. Nằm ở `.agent/project-context.yaml`, sinh từ `templates/project-context.yaml` qua token substitution khi init. Mọi workflow đọc file này để biết **WHERE** tìm mọi thứ.
12
+
13
+ ### Cấu trúc chính
14
+
15
+ ```yaml
16
+ project:
17
+ name: "..."
18
+ description: "..."
19
+
20
+ paths:
21
+ specs_dir: "specs" # gốc mọi spec artifact
22
+ trace_dir: ".trace" # trace state .tsv
23
+ qc_dir: "docs" # working docs của QC
24
+ qc_skills_dir: ".agent/skills/qc" # nơi qc-* nạp skill (override sang repo QC riêng)
25
+ refinement_dir: ".agent/review" # findings review
26
+
27
+ setup:
28
+ mode: single | umbrella
29
+ spec_source: "..." # (umbrella) spec repo dùng chung
30
+
31
+ services: # (multi/umbrella) map domain → service
32
+ # dạng phẳng: {domain}: { path, module }
33
+ # dạng map-theo-platform: {domain}: { web: {path,module}, app: {...}, system: {...} }
34
+
35
+ conventions:
36
+ build_command: "..." # lệnh build verify (≤3 retry)
37
+ test_command: "..."
38
+
39
+ tech_stack:
40
+ database: "..." # vd PostgreSQL
41
+ ```
42
+
43
+ ### Bố cục feature-package (path resolution)
44
+
45
+ Mọi artifact của một feature nằm chung `specs/{domain}/{prd-slug}/`:
46
+
47
+ ```
48
+ specs/{domain}/{prd-slug}/
49
+ ├── {TICKET-ID}-{prd-slug}.md # PRD (file .md duy nhất ở gốc)
50
+ ├── bdd/{web|app|system}/*.feature # BDD
51
+ ├── tech-docs/{TICKET-ID}-tech-design.md
52
+ └── design-spec/{TICKET-ID}*.md # FE/App
53
+ .trace/{domain}/{prd-slug}/{UC-ID}-{platform}.tsv
54
+ ```
55
+
56
+ - `{domain}` = segment đầu sau `specs_dir`.
57
+ - `{prd-slug}` = segment kế tiếp (folder feature-package) — **không** phải folder cha trực tiếp của file lồng sâu.
58
+
59
+ ---
60
+
61
+ ## 2. `CLAUDE.md` (phân tầng)
62
+
63
+ Instruction cho AI agent — AI *follow* file này thay vì *invent*.
64
+
65
+ | Tầng | Nội dung |
66
+ |------|----------|
67
+ | **root** `CLAUDE.md` | Luật chung dự án/umbrella |
68
+ | **overlay** `{service}/CLAUDE.md` | §2 kiến trúc & thứ tự layer & package strategy · §3 coding standards · §5 error handling — **theo stack** |
69
+
70
+ > Service overlay **thắng** root khi mâu thuẫn. context-loader nạp cả hai, đặt ở **cuối** context (Lost-in-the-Middle: "follow style này").
71
+
72
+ ---
73
+
74
+ ## 3. Single vs Umbrella
75
+
76
+ | | Single | Umbrella |
77
+ |---|--------|----------|
78
+ | `setup.mode` | `single` | `umbrella` |
79
+ | Spec ở đâu | Cùng repo | **Spec repo dùng chung** (`spec_source`) |
80
+ | Code ở đâu | Cùng repo | Service submodule (chỉ code + tooling) |
81
+ | Trace/feedback/findings | Cùng repo | Trong spec repo (một nơi authoritative) |
82
+ | Đồng bộ | — | `/sync` (pull + submodule + nổi feedback + Living Docs) |
83
+
84
+ Khi `spec_source` được đặt, **mọi** PRD/BDD/tech-doc/design-spec/`.trace`/`.agent/review`/`feedback` route về spec repo — vì đều là **artifact liên team**.
85
+
86
+ ---
87
+
88
+ ## Không bị ghi đè khi update
89
+
90
+ `/update-framework` ghi đè `.agent/commands|steps|hooks|rules|templates|skills|modules` nhưng **giữ nguyên**: `CLAUDE.md`, `project-context.yaml`, `domain-knowledge/`, `.trace/`.
91
+
92
+ ---
93
+
94
+ → [Architecture › Configuration](../02-concepts/architecture.md#configuration-2-file) · [Modules](modules.md)
@@ -0,0 +1,68 @@
1
+ [← Reference](./) · [Concepts › Roles & HITL](../02-concepts/roles-and-hitl.md)
2
+
3
+ # Reference · Model Selection
4
+
5
+ > Framework **không ràng buộc model cứng** — chỉ khuyến nghị qua **model check mềm** ở Gate. Giả định LLM đủ năng lực reasoning.
6
+
7
+ ---
8
+
9
+ ## Model check (Gate Bước 0-B)
10
+
11
+ Các lệnh sinh nội dung & review phức tạp đòi hỏi suy luận mạnh. Ở Gate, framework hiển thị:
12
+
13
+ ```
14
+ ⚙️ MODEL CHECK
15
+ Recommended : claude-opus (model Opus mới nhất)
16
+ Why needed : Phân tích spec, review kiến trúc, sinh code đòi hỏi
17
+ suy luận sâu. Model nhỏ hơn dễ bỏ sót edge case.
18
+
19
+ Đang chạy claude-opus?
20
+ Y — đúng → tiếp tục
21
+ S — bỏ qua (chấp nhận rủi ro chất lượng thấp hơn)
22
+ N — dừng, đổi model rồi chạy lại
23
+ ```
24
+
25
+ | Trả lời | Kết quả |
26
+ |---------|---------|
27
+ | **Y** | Tiếp tục |
28
+ | **S** | Tiếp tục, thêm ⚠️ vào report cuối (người dùng chấp nhận rủi ro) |
29
+ | **N** / khác | **Dừng** — đổi sang Opus rồi chạy lại |
30
+
31
+ > Sub-agent (`_agent_mode`) **bỏ qua** model check — orchestrator đã kiểm tra rồi.
32
+
33
+ ---
34
+
35
+ ## Tại sao khuyến nghị Opus
36
+
37
+ Rủi ro khi dùng model nhỏ hơn cho các lệnh nặng:
38
+ - Bỏ sót edge case khi phân tích spec.
39
+ - Phân tích spec thiếu sót → findings không đầy đủ.
40
+ - Vi phạm kiến trúc khi sinh code.
41
+
42
+ Các lệnh **read-only cơ học** (áp findings, resume) có thể bỏ qua model check vì không cần suy luận sâu.
43
+
44
+ ---
45
+
46
+ ## Đổi model trong Claude Code
47
+
48
+ - Settings → Model → chọn "claude-opus", **hoặc**
49
+ - `/model` → chọn `claude-opus`
50
+
51
+ ---
52
+
53
+ ## Model IDs (tham khảo)
54
+
55
+ Model Claude mới nhất tại thời điểm viết:
56
+
57
+ | Model | ID |
58
+ |-------|-----|
59
+ | Opus 4.8 | `claude-opus-4-8` |
60
+ | Sonnet 5 | `claude-sonnet-5` |
61
+ | Haiku 4.5 | `claude-haiku-4-5-20251001` |
62
+ | Fable 5 | `claude-fable-5` |
63
+
64
+ > Dùng model mạnh nhất (Opus) cho các bước generate/review; các bước cơ học có thể dùng model nhẹ hơn.
65
+
66
+ ---
67
+
68
+ → [Roles & HITL](../02-concepts/roles-and-hitl.md) · [Commands](commands.md)
@@ -0,0 +1,74 @@
1
+ [← Reference](./) · [Concepts › Architecture](../02-concepts/architecture.md)
2
+
3
+ # Reference · Modules — Stack overlay
4
+
5
+ > Module = overlay tuỳ chọn mở rộng base. Skill **đọc `stack-profile.yaml`** thay vì hardcode → đổi stack chỉ cần thêm module.
6
+
7
+ ---
8
+
9
+ ## Module có sẵn (15)
10
+
11
+ ### Tech stack — Backend
12
+
13
+ | Module | Stack |
14
+ |--------|-------|
15
+ | `java-spring` | Java + Spring Boot |
16
+ | `dotnet` | .NET / C# |
17
+ | `golang` | Go |
18
+ | `php-laravel` | PHP + Laravel |
19
+
20
+ ### Tech stack — Frontend / Mobile
21
+
22
+ | Module | Stack |
23
+ |--------|-------|
24
+ | `react` | React |
25
+ | `vue` | Vue |
26
+ | `angular` | Angular |
27
+ | `nextjs` | Next.js |
28
+ | `nuxt` | Nuxt |
29
+ | `react-native` | React Native |
30
+ | `flutter` | Flutter |
31
+ | `android-compose` | Android (Jetpack Compose) |
32
+ | `ios-swiftui` | iOS (SwiftUI) |
33
+
34
+ ### Capability
35
+
36
+ | Module | Vai trò |
37
+ |--------|---------|
38
+ | `qc-playwright` | QC automation — Python + pytest-playwright + Page Object |
39
+ | `context-engineering` | Hỗ trợ context-loader |
40
+
41
+ ---
42
+
43
+ ## Stack profile contract
44
+
45
+ Mỗi stack module khai báo qua `stack-profile.yaml`:
46
+
47
+ | Khoá | Ý nghĩa |
48
+ |------|---------|
49
+ | `artifact_types[]` | Loại artifact stack này sinh |
50
+ | `generation_layers[]` | Thứ tự layer + dependency (vd Controller → Service → Repository) |
51
+ | `build_verify` | Lệnh build để verify (≤3 retry) |
52
+ | `test_types{}` | Các loại test hỗ trợ |
53
+
54
+ Cộng `module.yaml` khai báo metadata module.
55
+
56
+ ---
57
+
58
+ ## Cài & dùng
59
+
60
+ ```bash
61
+ # Khi init
62
+ npx @educa-corp/sdd-framework --init --module java-spring
63
+ # Multi-service
64
+ npx @educa-corp/sdd-framework --init \
65
+ --services backend:java-spring,web:react,app:flutter
66
+ ```
67
+
68
+ Module nằm ở `.agent/modules/{name}/`. QC skill có thể trỏ ra repo riêng của team QC qua `paths.qc_skills_dir` để không bị ghi đè khi `/update-framework`.
69
+
70
+ > Ghi chú: bản hiện tại **không** có module jira/figma/locale tích hợp tự động; framework mặc định **ngôn ngữ Việt**; tham chiếu Jira chỉ là field Ticket trong Metadata PRD.
71
+
72
+ ---
73
+
74
+ → [Architecture › Module System](../02-concepts/architecture.md#module-system) · [Configuration](configuration.md)
@@ -0,0 +1,93 @@
1
+ [← Reference](./) · [Concepts › Traceability](../02-concepts/traceability.md)
2
+
3
+ # Reference · Trace Schema
4
+
5
+ > Field metadata `@trace.*` và cột file `.tsv`. Giải thích khái niệm → [Traceability](../02-concepts/traceability.md).
6
+
7
+ ---
8
+
9
+ ## Trace tags theo artifact
10
+
11
+ ### BDD scenario (`.feature`)
12
+
13
+ | Tag | Ý nghĩa |
14
+ |-----|---------|
15
+ | `@trace.id` | UC-ID (vd `UC-02`) |
16
+ | `@trace.scenario` | SC-ID (vd `SC-02.1`) |
17
+ | `@trace.business_rules` | BR liên quan (vd `BR-03`) |
18
+ | `@trace.bdd_version` | Version của `.feature` (phát hiện drift) |
19
+ | `@trace.prd_version` | Version PRD nguồn |
20
+ | `@trace.status` | `draft` / `in-review` / `approved` (gate) |
21
+ | `@trace.platform` | `web` / `app` / `system` |
22
+ | `@trace.domain` | Domain nghiệp vụ |
23
+
24
+ ### Code (boundary only)
25
+
26
+ | Tag | Ý nghĩa |
27
+ |-----|---------|
28
+ | `@trace.implements` | SC mà method này hiện thực |
29
+ | `@trace.source` | `.feature` nguồn |
30
+
31
+ > **KHÔNG** lưu version trong code — tránh dual SSOT. Version dò qua `.tsv`.
32
+
33
+ ### Test
34
+
35
+ | Tag | Ý nghĩa |
36
+ |-----|---------|
37
+ | `@trace.verifies` | SC mà test kiểm chứng (vd `UC-02-SC1`) |
38
+ | `@trace.covers` | Phạm vi phủ |
39
+
40
+ ### Bug fix
41
+
42
+ | Tag | Ý nghĩa |
43
+ |-----|---------|
44
+ | `@trace.fixes` | Bug/ticket được sửa |
45
+ | `@trace.root_cause` | Nguyên nhân gốc |
46
+ | `@trace.regression` | Test regression thêm vào |
47
+
48
+ ---
49
+
50
+ ## Boundary-only tagging
51
+
52
+ | ✅ Tag | ❌ Không tag |
53
+ |--------|-------------|
54
+ | Controller · Handler · Middleware · Steps file | Entity · Repository · DTO · Interface · Base class |
55
+
56
+ Shared code dò qua **import chain** từ boundary → tránh tag explosion.
57
+
58
+ ---
59
+
60
+ ## Trace state — `.tsv`
61
+
62
+ Đường dẫn: `.trace/{domain}/{prd-slug}/{UC-ID}-{platform}.tsv` (mỗi UC × platform một sổ; trong umbrella nằm ở spec repo).
63
+
64
+ | Cột | Chủ sở hữu | Ý nghĩa |
65
+ |-----|-----------|---------|
66
+ | `status` | `/generate-code`, `/validate-traces` | OK / GAP / DRIFT / UNTRACKED |
67
+ | `implemented_by` | `/generate-code` | File code hiện thực SC (`—` nếu chưa) |
68
+ | `spec_ver` | spec | Version spec hiện tại |
69
+ | `gen_ver` | `/generate-code` | Version lúc sinh code (`—` nếu chưa) |
70
+ | `test_count` | test | Số test phủ SC |
71
+ | `dev_selftest` | `/dev-run-test` | Smoke của dev (pass/fail/`—`) |
72
+ | `qc_status` | `/qc-run-test`, `/report-bug` | QC chính thức (pass/fail/gap) |
73
+ | `bdd_version` | spec | Version BDD |
74
+ | `last_updated` | nhiều | Mốc cập nhật |
75
+
76
+ ---
77
+
78
+ ## Phân loại coverage (thứ tự ưu tiên)
79
+
80
+ | # | Trạng thái | Điều kiện |
81
+ |---|-----------|-----------|
82
+ | 1 | **UNTRACKED** | `gen_ver == —` |
83
+ | 2 | **DRIFT** | `implemented_by != —` AND `spec_ver != gen_ver` |
84
+ | 3 | **GAP** | `implemented_by != —` AND (`test_count == —` OR `0`) |
85
+ | 4 | **OK** | `spec_ver == gen_ver` AND `implemented_by != —` AND `test_count > 0` |
86
+
87
+ `code_coverage = (rows where implemented_by != —) / total_scs`
88
+
89
+ > DRIFT xét **trước** GAP: code lỗi thời + chưa test + spec drift phải hiện DRIFT (regen) không phải GAP (skip).
90
+
91
+ ---
92
+
93
+ → [Traceability](../02-concepts/traceability.md) · [Validate Traces](../02-concepts/pipeline-steps/09-validate-traces.md)
package/docs/README.md CHANGED
@@ -1,53 +1,42 @@
1
- # 📚 SDD Framework — Documentation
1
+ # 📚 SDD Framework — Tài liệu (Documentation)
2
2
 
3
- > SDD Framework for Claude Code: Discovery PRD Design-Spec BDD
4
- > CodeDev self-checkQC automation, with traceability and human review gates.
3
+ > **SDD Framework** cho Claude Code đường ray một chiều đưa đội ngũ đi từ
4
+ > **ý tưởng PRD → Design-SpecBDD Tech-Docs Code Dev self-test → QC**,
5
+ > với **gate review của con người** ở mỗi khúc cua và **truy vết (traceability)** đầu-cuối.
5
6
 
6
- Tài liệu được chia theo **vai trò** **chủ đề**. Bắt đầu ở mục phù hợp với bạn:
7
+ Tài liệu chia theo **mục tiêu người đọc**. Bắt đầu ở đúng mục dành cho bạn:
7
8
 
8
- | Bạn là… | Bắt đầu ở |
9
- |---------|-----------|
10
- | Người mới / cài đặt lần đầu | [01 · Getting Started](01-getting-started/) |
11
- | Product Owner | [Guide · Product Owner](02-guides/product-owner/README.md) |
12
- | Developer | [Guide · Developer](02-guides/developer/README.md) |
13
- | QC / Tester (QA) | [Guide · Tester / QA](02-guides/tester/README.md) — gồm cả pipeline QC tự động (`/qc-*`) |
14
- | Muốn hiểu kiến trúc | [03 · Concepts](03-concepts/) |
15
- | Vận hành / admin | [04 · Operations](04-operations/) |
16
- | Tra cứu lệnh | [05 · Reference](05-reference/) |
17
- | Muốn hiểu một lệnh chạy sao (dễ hiểu) | [06 · Commands (Dễ Hiểu)](06-commands/) |
9
+ | Bạn muốn… | Đọc ở |
10
+ |-----------|-------|
11
+ | Cài đặt & chạy feature đầu tiên | [01 · Getting Started](01-getting-started/) |
12
+ | Hiểu framework: mô hình toàn trình + từng bước | [02 · Concepts](02-concepts/) |
13
+ | Biết **vai trò của tôi** làm gì ở mỗi bước | [03 · Guides theo vai trò](03-guides/) |
14
+ | Tra cứu lệnh, schema, module, config | [04 · Reference](04-reference/) |
18
15
 
19
16
  ---
20
17
 
21
- ## Mục lục
18
+ ## Mục lục (Table of Contents)
22
19
 
23
- ### 01 · [Getting Started](01-getting-started/)
24
- - [Installation](01-getting-started/installation.md) — cài framework, prerequisites
25
- - [Quick Start](01-getting-started/quickstart.md) — chạy feature đầu tiên end-to-end
26
- - [Core Concepts](01-getting-started/core-concepts.md) — khái niệm trong 5 phút
20
+ ### 01 · [Getting Started](01-getting-started/) — *Cài & chạy được*
21
+ - [What is SDD](01-getting-started/what-is-sdd.md) — framework là gì, giải quyết vấn đề gì
22
+ - [Installation](01-getting-started/installation.md) — cài đặt, `npx --init`, chọn module
23
+ - [Quick Start](01-getting-started/quickstart.md) — feature đầu tiên end-to-end
27
24
 
28
- ### 02 · [Guides (theo vai trò)](02-guides/)
29
- - [Product Owner](02-guides/product-owner/README.md) — define-product, PRD, design-spec, review
30
- - [Developer](02-guides/developer/README.md) — BDD, tech-docs, code, dev self-check
31
- - [Tester / QA](02-guides/tester/README.md) — spec-manifest, report-bug, propose-scenario, Living Docs, **chương [QC Automation](02-guides/tester/qc-automation.md)** (pipeline `/qc-*`, `qc_status`)
25
+ ### 02 · [Concepts](02-concepts/) — *Hiểu framework*
26
+ - [Overview](02-concepts/overview.md) — hình toàn trình + triết lý
27
+ - [Glossary](02-concepts/glossary.md) — thuật ngữ (PRD, BDD, UC, trace, drift, gate, HITL…)
28
+ - [Roles & HITL](02-concepts/roles-and-hitl.md) — ma trận vai trò × pipeline, mật độ checkpoint
29
+ - [Traceability](02-concepts/traceability.md) — trace tags, `.tsv`, drift, `dev_selftest` vs `qc_status`
30
+ - [Architecture](02-concepts/architecture.md) — 3 lớp, context-loader, module
31
+ - ⭐ [**Pipeline Steps**](02-concepts/pipeline-steps/) — **chi tiết từng bước**: input · output · ai làm gì · câu hỏi · cách xử lý
32
32
 
33
- ### 03 · [Concepts](03-concepts/)
34
- - [Architecture](03-concepts/architecture.md) layers, modules, plug-in system
35
- - [Pipeline](03-concepts/pipeline.md) — các phase Discovery → QC
36
- - [Traceability & Living Docs](03-concepts/traceability.md) — trace TSV, dev_selftest vs qc_status
33
+ ### 03 · [Guides theo vai trò](03-guides/) — *Tôi làm gì ở mỗi bước*
34
+ - [Product Owner](03-guides/product-owner.md) · [Developer](03-guides/developer.md) · [Architect / SA](03-guides/architect.md) · [Tester / QA](03-guides/tester-qa.md)
37
35
 
38
- ### 04 · [Operations](04-operations/)
39
- - [Sync & Update](04-operations/sync-and-update.md) — `/sync`, `/update-framework`, umbrella
40
- - [Bug Flow](04-operations/bug-flow.md) report fix verify
41
- - [Publishing](04-operations/publishing.md) — build + npm publish
42
-
43
- ### 05 · [Reference](05-reference/)
44
- - [Commands](05-reference/commands.md) — bảng đầy đủ mọi slash command
45
- - [Trace Schema](05-reference/trace-schema.md) — cột TSV, trace tags
46
- - [Modules](05-reference/modules.md) — stack modules (java-spring, react, …, qc-playwright)
47
-
48
- ### 06 · [Commands (Dễ Hiểu)](06-commands/)
49
- - Giải thích luồng chạy của **cả 30 slash command** bằng ví von đời thường — mỗi trang một `explain-{command}.md`, gom theo phase pipeline. Xem [mục lục 06](06-commands/README.md).
36
+ ### 04 · [Reference](04-reference/) — *Tra cứu*
37
+ - [Commands](04-reference/commands.md) — bảng đầy đủ mọi slash command
38
+ - [Trace Schema](04-reference/trace-schema.md) · [Modules](04-reference/modules.md) · [Configuration](04-reference/configuration.md) · [Model Selection](04-reference/model-selection.md)
50
39
 
51
40
  ---
52
41
 
53
- *Mỗi file có breadcrumb điều hướng ở đầu. Phiên bản framework mới nhất: xem trên [npm](https://www.npmjs.com/package/@educa-corp/sdd-framework).*
42
+ *Phiên bản framework mới nhất: xem trên [npm](https://www.npmjs.com/package/@educa-corp/sdd-framework) — `npm view @educa-corp/sdd-framework version`.*
@@ -0,0 +1,77 @@
1
+ [← Explain Home](README.md) · [Next: /generate-architecture →](00b-generate-architecture.md)
2
+
3
+ # 00 · `/setup-ai-first` — Khởi tạo framework trong dự án
4
+
5
+ > **Một câu.** Dựng khung thư mục + config + `CLAUDE.md` + domain-knowledge cho một dự án, thích ứng theo **3 loại dự án** (single / umbrella / PO-spec).
6
+
7
+ ---
8
+
9
+ ## Vấn đề giải quyết
10
+
11
+ Mọi command sau đều đọc `project-context.yaml` + `CLAUDE.md` + `domain-knowledge/` để biết **đọc/ghi ở đâu, viết theo convention nào**. Không có bước setup → mọi lệnh halt ở gate "required context missing". Đây là bước dựng nền một-lần.
12
+
13
+ ---
14
+
15
+ ## Vị trí & tiền đề
16
+
17
+ - **Vị trí:** tiền pipeline (trước cả Discovery).
18
+ - **Đặc biệt:** lệnh này **bỏ qua Gate Step 1/2/3** (chưa có file input, chưa có project context) — chỉ chạy Step 0-B (model check). Project root = thư mục hiện tại.
19
+ - **Tiền đề:** một repo git (trống hoặc có code) + Node.js.
20
+
21
+ ---
22
+
23
+ ## Input / Output
24
+
25
+ **Input:** trả lời Q&A (loại dự án, service/stack, spec submodule path…).
26
+
27
+ **Output** (tuỳ `project_type`):
28
+
29
+ | project_type | Tạo gì |
30
+ |--------------|--------|
31
+ | **1 · Single** | `specs/{product-definition,domain-knowledge}/`, `.trace/`, `.agent/review/`, `CLAUDE.md` (đủ §1–§7), `project-context.yaml`, `business-dictionary.md`, `core-entities.md` |
32
+ | **2 · Umbrella** | Chỉ `.trace/` + `.agent/review/` ở umbrella root; `project-context.yaml` mode umbrella với `services` + `spec_source`; **không** tạo `CLAUDE.md` root (không có một stack đơn) |
33
+ | **3 · PO Spec repo** | `specs/{product-definition,domain-knowledge}/`, `feedback/`, `.agent/review/`, `CLAUDE.md` tối thiểu (§1+§7) |
34
+
35
+ ---
36
+
37
+ ## Các bước xử lý (chi tiết)
38
+
39
+ 1. **Precondition check** — nếu đã có `CLAUDE.md` + `project-context.yaml` → hỏi regenerate? (an toàn chạy lại; mỗi bước đề nghị merge/skip).
40
+ 2. **Step 0.5 · Loại dự án** — hỏi single / umbrella / PO-spec → lưu `project_type`.
41
+ - Umbrella hỏi thêm: path spec submodule; một domain trải nhiều platform không? → **FORM A** (`domain:module`) hay **FORM B** (`domain:platform:module`, platform ∈ system/web/app).
42
+ 3. **Step 1 · Cấu trúc thư mục** — tạo base dir theo `project_type` (bảng trên). Folder feature-package `specs/{domain}/{prd-slug}/` **không** tạo trước — lệnh generate tự tạo on demand.
43
+ 4. **Step 2 · CLAUDE.md** — tạo từ template 7 section (§1 Overview, §2 Architecture, §3 Coding Standards, §4 Traceability, §5 Error Handling, §6 Build&Test, §7 Git). Umbrella bỏ qua; PO-spec chỉ §1+§7.
44
+ 5. **Step 3 · project-context.yaml** — copy từ `templates/project-context.yaml`, điền `{{PLACEHOLDER}}`. Umbrella: verify/sửa `services` (path phải khớp tên submodule thật — generator để placeholder `TODO-…`).
45
+ 6. **Step 4 · business-dictionary.md** — Canonical Terms / Banned Terms / Enum Registry. *(Umbrella skip — sống trong spec submodule.)*
46
+ 7. **Step 5 · core-entities.md** — entity catalog máy-đọc-được (field, invariant, relationship). *(Umbrella skip.)*
47
+ 8. **Step 6 · VS Code extension** — khuyến nghị cài "Spec Driven Docs Tools" (Review Board + Living Docs UI).
48
+ 9. **Step 7 · Verify** — checklist theo `project_type` (file/folder tồn tại; umbrella check submodule init).
49
+
50
+ ---
51
+
52
+ ## Checkpoint & Gate
53
+
54
+ - Chỉ có model check (Step 0-B) + xác nhận regenerate nếu đã setup.
55
+ - **Không** gate chặn — nhưng nhắc mạnh: sau setup phải **điền tay** `CLAUDE.md` + `project-context.yaml` + `domain-knowledge/` (AI *follow*, trống thì *đoán*).
56
+
57
+ ---
58
+
59
+ ## Cơ chế đặc biệt
60
+
61
+ - **3 project types** rẽ nhánh sâu — đặc biệt umbrella FORM A vs FORM B định hình cách `services` được khai báo và routing về sau.
62
+ - **On-demand feature folders** — không scaffold trước `specs/{domain}/{prd-slug}/`, giảm rác.
63
+ - **Umbrella tách spec/code** — spec sống ở `spec_source`; service submodule chỉ code + `.trace/`.
64
+
65
+ ---
66
+
67
+ ## 👓 Góc nhìn tối ưu
68
+
69
+ - **Điểm ma sát #1: điền tay sau setup.** `CLAUDE.md` + `core-entities.md` để trống là nguyên nhân gốc của "AI sinh sai convention/field". Có thể tối ưu bằng scaffold thông minh hơn (đọc `pom.xml`/`package.json` suy §1, §6) — hiện `/sync` đã làm phần này cho umbrella, single-service thì chưa.
70
+ - **Umbrella `services.path` placeholder `TODO-…`** dễ bị quên sửa → routing hỏng. Đáng thêm một validate cứng.
71
+ - **Trùng lặp checklist verify theo 3 project_type** — nếu thêm project_type mới phải sửa nhiều chỗ.
72
+
73
+ ---
74
+
75
+ ## Kết nối
76
+
77
+ **Trước:** — (đầu tiên) · **Sau:** [`/define-product`](01-define-product.md) để bắt đầu feature đầu tiên.