@educa-corp/sdd-framework 0.5.0 → 0.7.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.
- package/bin/build.js +113 -19
- package/bin/gate-trace.js +487 -0
- package/bin/index.js +445 -146
- package/bin/lint-trace.js +643 -0
- package/bin/self-check.js +804 -2
- package/bin/trace-schema.json +621 -10
- package/core/FRAMEWORK_VERSION +1 -1
- package/core/README.md +20 -0
- package/core/commands/amend-prd.md +518 -0
- package/core/commands/debug.md +123 -511
- package/core/commands/define-product.md +86 -510
- package/core/commands/dev-gen-test.md +86 -510
- package/core/commands/dev-run-test.md +133 -519
- package/core/commands/dev-smoke-test.md +86 -510
- package/core/commands/extend-prd.md +128 -522
- package/core/commands/fix-bug.md +118 -509
- package/core/commands/generate-architecture.md +94 -515
- package/core/commands/generate-bdd.md +128 -513
- package/core/commands/generate-code.md +119 -510
- package/core/commands/generate-design-spec.md +86 -510
- package/core/commands/generate-prd.md +89 -510
- package/core/commands/generate-spec-manifest.md +86 -510
- package/core/commands/generate-tech-docs.md +120 -512
- package/core/commands/learn.md +172 -496
- package/core/commands/map-testids.md +86 -510
- package/core/commands/propose-scenario.md +86 -510
- package/core/commands/qc-analyze.md +86 -510
- package/core/commands/qc-design-test.md +86 -510
- package/core/commands/qc-plan.md +86 -510
- package/core/commands/qc-report.md +86 -510
- package/core/commands/qc-review.md +86 -510
- package/core/commands/qc-run-test.md +115 -513
- package/core/commands/refine-prd.md +112 -522
- package/core/commands/report-bug.md +86 -510
- package/core/commands/review-code.md +123 -511
- package/core/commands/review-context.md +136 -522
- package/core/commands/review-tech-docs.md +90 -511
- package/core/commands/setup-ai-first.md +166 -138
- package/core/commands/sync.md +155 -107
- package/core/commands/update-framework.md +16 -103
- package/core/commands/validate-traces.md +426 -511
- package/core/hooks/data-guard.js +174 -83
- package/core/hooks/settings.json +2 -1
- package/core/rules/workflow.md +64 -4
- package/core/steps/capture-lesson.md +34 -1
- package/core/steps/context-loader.md +50 -8
- package/core/steps/gate.md +92 -35
- package/core/steps/report-footer.md +23 -0
- package/core/templates/README.md +24 -1
- package/core/templates/ci/trace-gate.yml +146 -0
- package/core/templates/feature.template +1 -1
- package/core/templates/hooks/pre-push +61 -0
- package/docs/02-concepts/architecture.md +61 -6
- package/docs/02-concepts/traceability.md +57 -0
- package/docs/03-guides/architect.md +63 -0
- package/docs/04-reference/commands.md +148 -134
- package/docs/04-reference/model-selection.md +32 -19
- package/docs/04-reference/trace-schema.md +39 -0
- package/docs/explain/02b-extend-prd.md +1 -1
- package/docs/explain/02c-amend-prd.md +152 -0
- package/docs/explain/21-validate-traces.md +2 -1
- package/docs/explain/27-learn.md +5 -3
- package/docs/explain/28-sync.md +25 -0
- package/docs/explain/README.md +136 -135
- package/package.json +5 -9
- package/commands/debug.md +0 -917
- package/commands/debug.tmpl +0 -257
- package/commands/define-product.md +0 -862
- package/commands/define-product.tmpl +0 -225
- package/commands/dev-gen-test.md +0 -1124
- package/commands/dev-gen-test.tmpl +0 -490
- package/commands/dev-run-test.md +0 -859
- package/commands/dev-run-test.tmpl +0 -225
- package/commands/dev-smoke-test.md +0 -798
- package/commands/dev-smoke-test.tmpl +0 -217
- package/commands/extend-prd.md +0 -907
- package/commands/extend-prd.tmpl +0 -270
- package/commands/fix-bug.md +0 -910
- package/commands/fix-bug.tmpl +0 -197
- package/commands/generate-architecture.md +0 -775
- package/commands/generate-architecture.tmpl +0 -194
- package/commands/generate-bdd.md +0 -1347
- package/commands/generate-bdd.tmpl +0 -590
- package/commands/generate-code.md +0 -1283
- package/commands/generate-code.tmpl +0 -649
- package/commands/generate-design-spec.md +0 -1161
- package/commands/generate-design-spec.tmpl +0 -524
- package/commands/generate-prd.md +0 -1143
- package/commands/generate-prd.tmpl +0 -223
- package/commands/generate-spec-manifest.md +0 -745
- package/commands/generate-spec-manifest.tmpl +0 -164
- package/commands/generate-tech-docs.md +0 -1344
- package/commands/generate-tech-docs.tmpl +0 -273
- package/commands/learn.md +0 -723
- package/commands/learn.tmpl +0 -63
- package/commands/map-testids.md +0 -662
- package/commands/map-testids.tmpl +0 -81
- package/commands/propose-scenario.md +0 -783
- package/commands/propose-scenario.tmpl +0 -202
- package/commands/qc-analyze.md +0 -693
- package/commands/qc-analyze.tmpl +0 -112
- package/commands/qc-design-test.md +0 -650
- package/commands/qc-design-test.tmpl +0 -69
- package/commands/qc-plan.md +0 -630
- package/commands/qc-plan.tmpl +0 -49
- package/commands/qc-report.md +0 -641
- package/commands/qc-report.tmpl +0 -60
- package/commands/qc-review.md +0 -634
- package/commands/qc-review.tmpl +0 -53
- package/commands/qc-run-test.md +0 -750
- package/commands/qc-run-test.tmpl +0 -116
- package/commands/refine-prd.md +0 -1074
- package/commands/refine-prd.tmpl +0 -278
- package/commands/report-bug.md +0 -729
- package/commands/report-bug.tmpl +0 -148
- package/commands/review-code.md +0 -803
- package/commands/review-code.tmpl +0 -143
- package/commands/review-context.md +0 -1323
- package/commands/review-context.tmpl +0 -527
- package/commands/review-tech-docs.md +0 -982
- package/commands/review-tech-docs.tmpl +0 -401
- package/commands/setup-ai-first.md +0 -574
- package/commands/setup-ai-first.tmpl +0 -378
- package/commands/sync.md +0 -486
- package/commands/sync.tmpl +0 -384
- package/commands/update-framework.md +0 -290
- package/commands/update-framework.tmpl +0 -188
- package/commands/validate-traces.md +0 -1435
- package/commands/validate-traces.tmpl +0 -854
- package/hooks/data-guard.js +0 -141
- package/hooks/settings.json +0 -18
- package/modules/android-compose/module.yaml +0 -13
- package/modules/android-compose/stack-profile.yaml +0 -57
- package/modules/angular/architecture-snippets/component-patterns.md +0 -187
- package/modules/angular/module.yaml +0 -6
- package/modules/angular/stack-profile.yaml +0 -38
- package/modules/context-engineering/architecture-snippets/context-design.md +0 -119
- package/modules/context-engineering/module.yaml +0 -9
- package/modules/context-engineering/stack-profile.yaml +0 -61
- package/modules/dotnet/architecture-snippets/clean-arch.md +0 -160
- package/modules/dotnet/module.yaml +0 -6
- package/modules/dotnet/stack-profile.yaml +0 -50
- package/modules/flutter/module.yaml +0 -14
- package/modules/flutter/stack-profile.yaml +0 -59
- package/modules/golang/architecture-snippets/domain-layout.md +0 -283
- package/modules/golang/module.yaml +0 -6
- package/modules/golang/stack-profile.yaml +0 -40
- package/modules/ios-swiftui/module.yaml +0 -13
- package/modules/ios-swiftui/stack-profile.yaml +0 -55
- package/modules/java-spring/architecture-snippets/layered-arch.md +0 -201
- package/modules/java-spring/module.yaml +0 -15
- package/modules/java-spring/stack-profile.yaml +0 -28
- package/modules/nextjs/architecture-snippets/app-router-patterns.md +0 -269
- package/modules/nextjs/module.yaml +0 -14
- package/modules/nextjs/stack-profile.yaml +0 -74
- package/modules/nuxt/module.yaml +0 -14
- package/modules/nuxt/stack-profile.yaml +0 -58
- package/modules/phaser-game/architecture-snippets/phaser-scene-patterns.md +0 -646
- package/modules/phaser-game/module.yaml +0 -15
- package/modules/phaser-game/stack-profile.yaml +0 -90
- package/modules/php-laravel/architecture-snippets/service-repository.md +0 -302
- package/modules/php-laravel/module.yaml +0 -15
- package/modules/php-laravel/stack-profile.yaml +0 -56
- package/modules/qc-playwright/stack-profile.yaml +0 -66
- package/modules/react/architecture-snippets/hooks-query-patterns.md +0 -254
- package/modules/react/module.yaml +0 -14
- package/modules/react/stack-profile.yaml +0 -63
- package/modules/react-native/module.yaml +0 -14
- package/modules/react-native/stack-profile.yaml +0 -56
- package/modules/vue/module.yaml +0 -14
- package/modules/vue/stack-profile.yaml +0 -65
- package/rules/data-protection.md +0 -80
- package/rules/workflow.md +0 -73
- package/scripts/init.sh +0 -49
- package/scripts/upgrade.sh +0 -94
- package/skills/code/SKILL.md +0 -19
- package/skills/code/SKILL.tmpl +0 -19
- package/skills/debug/SKILL.md +0 -19
- package/skills/debug/SKILL.tmpl +0 -19
- package/skills/design-spec/SKILL.md +0 -11
- package/skills/design-spec/SKILL.tmpl +0 -11
- package/skills/discovery/SKILL.md +0 -14
- package/skills/discovery/SKILL.tmpl +0 -14
- package/skills/prd/SKILL.md +0 -19
- package/skills/prd/SKILL.tmpl +0 -19
- package/skills/qc/qa-analyst/DOC_GAPS.template.md +0 -63
- package/skills/qc/qa-analyst/acceptance-criteria.md +0 -60
- package/skills/qc/qa-analyst/business-rules.md +0 -59
- package/skills/qc/qa-analyst/data-flow.md +0 -64
- package/skills/qc/qa-analyst/spec-breakdown.md +0 -61
- package/skills/qc/qa-designer/e2e/journey.md +0 -41
- package/skills/qc/qa-designer/exploratory/charter.md +0 -68
- package/skills/qc/qa-designer/exploratory/explore-to-functional.md +0 -43
- package/skills/qc/qa-designer/functional/api.md +0 -45
- package/skills/qc/qa-designer/functional/gui-feature.md +0 -46
- package/skills/qc/qa-designer/functional/gui-screen.md +0 -52
- package/skills/qc/qa-designer/integration/api.md +0 -42
- package/skills/qc/qa-designer/integration/db.md +0 -39
- package/skills/qc/qa-designer/integration/gui.md +0 -40
- package/skills/qc/qa-designer/integration/kafka.md +0 -40
- package/skills/qc/qa-designer/non-functional.md +0 -40
- package/skills/qc/qa-planner/test-plan.md +0 -120
- package/skills/qc/qa-reviewer/script/e2e.md +0 -87
- package/skills/qc/qa-reviewer/script/exploratory.md +0 -45
- package/skills/qc/qa-reviewer/script/functional.md +0 -101
- package/skills/qc/qa-reviewer/script/integration.md +0 -91
- package/skills/qc/qa-reviewer/script/non-functional.md +0 -126
- package/skills/qc/qa-reviewer/test-case/e2e.md +0 -73
- package/skills/qc/qa-reviewer/test-case/exploratory.md +0 -43
- package/skills/qc/qa-reviewer/test-case/functional.md +0 -76
- package/skills/qc/qa-reviewer/test-case/integration.md +0 -69
- package/skills/qc/qa-reviewer/test-case/non-functional.md +0 -73
- package/skills/qc/qa-runner/e2e.md +0 -49
- package/skills/qc/qa-runner/exploratory/session.md +0 -36
- package/skills/qc/qa-runner/functional/api.md +0 -35
- package/skills/qc/qa-runner/functional/gui-feature.md +0 -51
- package/skills/qc/qa-runner/functional/gui-screen.md +0 -55
- package/skills/qc/qa-runner/integration.md +0 -47
- package/skills/qc/qa-runner/non-functional.md +0 -49
- package/skills/qc/qa-runner/report/report.md +0 -37
- package/skills/setup-ai-first/SKILL.md +0 -19
- package/skills/setup-ai-first/SKILL.tmpl +0 -19
- package/skills/spec/SKILL.md +0 -19
- package/skills/spec/SKILL.tmpl +0 -19
- package/skills/test/SKILL.md +0 -18
- package/skills/test/SKILL.tmpl +0 -18
- package/steps/business-language.md +0 -56
- package/steps/capture-lesson.md +0 -79
- package/steps/context-loader.md +0 -385
- package/steps/gate.md +0 -94
- package/steps/report-footer.md +0 -102
- package/steps/review-fanout.md +0 -159
- package/steps/spawn-agent.md +0 -129
- package/steps/trace-mirror.md +0 -53
- package/templates/README.md +0 -47
- package/templates/architecture.template.md +0 -394
- package/templates/design-spec.template.md +0 -217
- package/templates/feature.template +0 -123
- package/templates/platform-guide.template.md +0 -145
- package/templates/prd.template.md +0 -283
- package/templates/product-definition.template.md +0 -188
- package/templates/project-context.yaml +0 -212
- package/templates/tech-design.template.md +0 -490
|
@@ -1,574 +0,0 @@
|
|
|
1
|
-
# /setup-ai-first — Khởi tạo SDD Framework trong một dự án
|
|
2
|
-
|
|
3
|
-
Dẫn người dùng qua một setup một-lần tạo mọi thư mục cần thiết, cài CLAUDE.md, và verify môi trường.
|
|
4
|
-
|
|
5
|
-
## Gate
|
|
6
|
-
# Gate — Quy trình vào chuẩn cho mọi lệnh
|
|
7
|
-
|
|
8
|
-
Mọi lệnh PHẢI chạy gate này trước khi thực thi phần logic riêng của nó.
|
|
9
|
-
|
|
10
|
-
## Bước 0 — Kiểm tra chế độ Sub-Agent
|
|
11
|
-
|
|
12
|
-
Trước tiên, kiểm tra xem `$ARGUMENTS` có phải là payload JSON từ một orchestrator hay không:
|
|
13
|
-
|
|
14
|
-
1. Thử parse `$ARGUMENTS` dưới dạng JSON.
|
|
15
|
-
2. Nếu parse thành công **và** chứa `"_agent_mode": true`:
|
|
16
|
-
- **Bỏ qua hoàn toàn Bước 1, 2 và 3 của Gate này.**
|
|
17
|
-
- Đặt target file = `payload.target_file`
|
|
18
|
-
- Đặt loaded context = `payload.context` (KHÔNG chạy context-loader.md)
|
|
19
|
-
- Đặt phạm vi UC = `payload.uc_id` (chỉ xử lý UC này)
|
|
20
|
-
- Đặt line range = `payload.uc_section` (chỉ đọc đúng section đó của PRD)
|
|
21
|
-
- Đặt dimension = `payload.dimension` nếu có (lệnh review per-UC: chỉ review đúng lăng kính này)
|
|
22
|
-
- Đi thẳng tới phần logic riêng của lệnh.
|
|
23
|
-
3. Nếu `$ARGUMENTS` không phải JSON hoặc không có `_agent_mode` → tiếp tục sang Bước 1 (chế độ thường).
|
|
24
|
-
|
|
25
|
-
## Bước 0-B — Kiểm tra Model
|
|
26
|
-
|
|
27
|
-
*Bỏ qua bước này nếu `_agent_mode: true` (sub-agent — orchestrator đã kiểm tra rồi).*
|
|
28
|
-
|
|
29
|
-
Các lệnh sinh nội dung và review phức tạp đòi hỏi khả năng suy luận mạnh.
|
|
30
|
-
Dùng model nhỏ hơn sẽ rủi ro: bỏ sót edge case, phân tích spec thiếu sót, vi phạm kiến trúc.
|
|
31
|
-
|
|
32
|
-
Hiển thị và chờ phản hồi:
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
⚙️ MODEL CHECK
|
|
36
|
-
──────────────────────────────────────────────────────────────────
|
|
37
|
-
Recommended : model Opus mới nhất
|
|
38
|
-
Why needed : Phân tích spec, review kiến trúc, sinh code đòi hỏi
|
|
39
|
-
suy luận sâu. Model nhỏ hơn (Haiku/Sonnet) dễ bỏ sót edge case.
|
|
40
|
-
|
|
41
|
-
Cách đổi trong Claude Code:
|
|
42
|
-
• /model → chọn model Opus
|
|
43
|
-
• hoặc: Settings → Model
|
|
44
|
-
|
|
45
|
-
Đang chạy một model Opus?
|
|
46
|
-
Y — đúng → tiếp tục
|
|
47
|
-
S — bỏ qua kiểm tra (tôi chấp nhận rủi ro chất lượng thấp hơn với model hiện tại)
|
|
48
|
-
──────────────────────────────────────────────────────────────────
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
- "Y" → tiếp tục sang Bước 1.
|
|
52
|
-
- "S" → tiếp tục sang Bước 1 (người dùng chấp nhận rủi ro, thêm ⚠️ vào report cuối).
|
|
53
|
-
- "N" hoặc bất kỳ giá trị nào khác → **DỪNG.** Xuất: "Vui lòng chuyển sang một model Opus (`/model`) rồi chạy lại lệnh này."
|
|
54
|
-
|
|
55
|
-
## Bước 1 — Xác định Target File
|
|
56
|
-
|
|
57
|
-
0. **Tách cờ trước khi resolve target.** `$ARGUMENTS` có thể lẫn các `--flag` (vd `--phase=integration`, `--comment`, `--fix`). **Loại bỏ mọi token bắt đầu bằng `--`** ra khỏi phần dùng để tìm target — chỉ giữ phần path/UC-ID/ticket. (Các flag đó do phần logic riêng của lệnh parse ở bước sau, KHÔNG phải tên file.)
|
|
58
|
-
1. Nếu `$ARGUMENTS` (đã tách cờ) được cung cấp và trỏ tới một file tồn tại → dùng trực tiếp làm target.
|
|
59
|
-
2. Nếu `$ARGUMENTS` là một **UC-ID / ticket ID / tên rút gọn** (không có path) → phân giải thành file bằng cách glob theo bố cục feature-package. `{prd-slug}` lúc này **chưa biết**, nên dùng wildcard `*` cho segment đó, và `**` đệ quy dưới `bdd/` để phủ hết các thư mục con theo platform (`bdd/web/`, `bdd/app/`, `bdd/system/`):
|
|
60
|
-
- **Lệnh BDD** (target là `.feature`): `{specs_dir}/{domain}/*/bdd/**/{UC-ID}*.feature` — hoặc `{specs_dir}/*/*/bdd/**/{UC-ID}*.feature` nếu domain cũng chưa biết. Nếu lệnh ngụ ý một platform/scope cụ thể (vd: system tech-doc cần BDD `system/`), ưu tiên kết quả trong thư mục con platform đó.
|
|
61
|
-
- **Lệnh PRD** (target là file PRD `{TICKET-ID}-{prd-slug}.md` — file `.md` duy nhất ở gốc feature folder, cạnh `bdd/`): `{specs_dir}/{domain}/*/{TICKET-ID}*.md` nếu biết TICKET-ID; nếu không, `{specs_dir}/{domain}/*/*.md` (khớp feature folder có id tương ứng), hoặc `{specs_dir}/*/*/*.md` nếu domain cũng chưa biết. *(Glob `*/*.md` ở cấp gốc folder chỉ khớp PRD — tech-docs/design-spec `.md` nằm sâu hơn trong thư mục con.)*
|
|
62
|
-
- **Lệnh tech-docs** — target là tech-doc **gộp cấp PRD** `{TICKET-ID}-tech-design.md` (MỘT doc phủ nhiều UC; danh sách UC nằm ở `@trace.ucs`). Vì tên file mang `{TICKET-ID}` chứ **không** mang `{UC-ID}`, phải tách trước khi glob:
|
|
63
|
-
- `$ARGUMENTS` là **UC-ID** (`{TICKET-ID}-UC{N}`) → lấy `{TICKET-ID}` = phần **trước** `-UC`, rồi glob `{specs_dir}/{domain}/*/tech-docs/{TICKET-ID}-tech-design.md`.
|
|
64
|
-
- `$ARGUMENTS` là **TICKET-ID** → glob trực tiếp như trên.
|
|
65
|
-
- Chưa biết domain → `{specs_dir}/*/*/tech-docs/{TICKET-ID}-tech-design.md`.
|
|
66
|
-
- Vẫn không khớp → glob rộng `{specs_dir}/*/*/tech-docs/*tech-design*.md` rồi liệt kê để người dùng chọn.
|
|
67
|
-
*(Đừng glob `{UC-ID}*-tech-design*.md` — nó nở thành `FT-001-UC1*-tech-design*.md` và **không bao giờ** khớp `FT-001-tech-design.md`.)*
|
|
68
|
-
- **Lệnh design-spec**: `{specs_dir}/{domain}/*/design-spec/{TICKET-ID}*.md`.
|
|
69
|
-
|
|
70
|
-
Khi một file khớp: đặt nó làm target **và** ghi lại `domain` + `prd_slug` từ path của nó (theo quy tắc trích xuất trong `context-loader.md` Bước 1 — `prd_slug` = segment đầu tiên sau `{specs_dir}/{domain}/`). Mọi path mà lệnh đọc/ghi về sau (BDD/tech-docs/design-spec/trace cùng cấp) đều dùng **`prd_slug` đã phân giải đó**, nên tất cả artifact nằm chung một feature package. Nếu nhiều file khớp (vd: nhiều platform), chọn theo platform/scope của lệnh hoặc liệt kê ra và hỏi.
|
|
71
|
-
3. Nếu `$ARGUMENTS` rỗng hoặc không tìm thấy file khớp:
|
|
72
|
-
- Liệt kê các file trong thư mục liên quan của lệnh này (vd: `specs/*/*/*.md` — file PRD ở gốc mỗi feature folder — cho lệnh PRD, `specs/*/*/bdd/**/*.feature` cho lệnh BDD).
|
|
73
|
-
- Hiển thị danh sách cho người dùng và hỏi: "Bạn muốn làm việc với file nào? (Nhập số thứ tự hoặc tên file)"
|
|
74
|
-
- Chờ người dùng chọn rồi mới tiếp tục.
|
|
75
|
-
|
|
76
|
-
## Bước 2 — Chạy Context Loader
|
|
77
|
-
|
|
78
|
-
Nạp toàn bộ context của dự án bằng cách làm theo quy trình trong `steps/context-loader.md`.
|
|
79
|
-
Lưu toàn bộ context đã nạp vào bộ nhớ để dùng xuyên suốt phiên làm việc của lệnh.
|
|
80
|
-
|
|
81
|
-
## Bước 3 — CHECKPOINT
|
|
82
|
-
|
|
83
|
-
Sau khi hoàn thành Bước 1 và 2, hiển thị bản tóm tắt và chờ xác nhận:
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
CHECKPOINT
|
|
87
|
-
-----------
|
|
88
|
-
Target : {resolved file path}
|
|
89
|
-
Project : {project.name từ project-context.yaml}
|
|
90
|
-
Tech stack : {language} / {framework}
|
|
91
|
-
Module : {module nếu có, else "not configured"}
|
|
92
|
-
Domains : {danh sách domain, ngăn cách bởi dấu phẩy}
|
|
93
|
-
|
|
94
|
-
Tiếp tục? (Y/N)
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Chờ người dùng trả lời rõ ràng "Y" hoặc "N" rồi mới tiếp tục.
|
|
98
|
-
- "Y" → tiếp tục sang các bước riêng của lệnh bên dưới.
|
|
99
|
-
- "N" → dừng lại và hỏi người dùng muốn thay đổi gì.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
*Lưu ý: Với lệnh này — **bỏ qua Gate Step 1, 2, và 3** (chưa có file input và chưa có project context). Chỉ chạy Step 0-B (model check). Project root là **thư mục làm việc hiện tại**. Đi thẳng tới Precondition Check bên dưới.*
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## Precondition Check
|
|
107
|
-
|
|
108
|
-
Kiểm tra đã setup chưa:
|
|
109
|
-
- Nếu cả `CLAUDE.md` **và** `.agent/project-context.yaml` đều tồn tại → hỏi: "Dự án này đã được khởi tạo. Chạy lại setup để regenerate file config? (Y/N)"
|
|
110
|
-
- N → dừng
|
|
111
|
-
- Y → tiếp tục (file có sẵn được giữ — mỗi bước sẽ đề nghị merge/skip)
|
|
112
|
-
- Nếu chỉ có `specs/` hoặc phát hiện setup một phần → tiếp tục bình thường (an toàn chạy lại)
|
|
113
|
-
|
|
114
|
-
## Step 0.5 — Loại dự án
|
|
115
|
-
|
|
116
|
-
Hỏi người dùng:
|
|
117
|
-
|
|
118
|
-
```
|
|
119
|
-
Dự án này thuộc loại nào?
|
|
120
|
-
1. Single-service — một codebase, một platform (setup chuẩn)
|
|
121
|
-
2. Umbrella repo — repo này chứa nhiều service submodule (microservices / multi-app)
|
|
122
|
-
3. PO Spec repo — chỉ docs, không có code chạy được (chỉ PRD + design-spec)
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
Lưu câu trả lời thành `project_type`. Mặc định `1` nếu user không trả lời.
|
|
126
|
-
|
|
127
|
-
Dựa trên câu trả lời:
|
|
128
|
-
|
|
129
|
-
**project_type = 1 (Single-service):** Tiếp tục setup chuẩn bên dưới.
|
|
130
|
-
|
|
131
|
-
**project_type = 2 (Umbrella):** Hỏi các câu follow-up:
|
|
132
|
-
- "Path tới spec submodule (vd `free-trial-spec`)? Nhấn Enter để skip."
|
|
133
|
-
- "Một business-domain được triển khai trên NHIỀU platform (BE + Web + App) không? (Y/N)"
|
|
134
|
-
- **N → dạng phẳng (FORM A):** "Liệt kê service dạng cặp `domain:module`, ngăn cách bởi dấu phẩy
|
|
135
|
-
(vd `user:java-spring,order:java-spring`). Nhấn Enter để skip."
|
|
136
|
-
- **Y → dạng map-theo-platform (FORM B):** "Liệt kê dạng bộ ba `domain:platform:module`
|
|
137
|
-
(platform ∈ system|web|app), ngăn cách bởi dấu phẩy — lặp lại domain cho từng platform
|
|
138
|
-
(vd `onboarding:system:java-spring,onboarding:web:nextjs,onboarding:app:flutter`). Nhấn Enter để skip."
|
|
139
|
-
context-loader route theo `@trace.platform` của target `.feature` → chọn đúng submodule.
|
|
140
|
-
**Giữ `@trace.domain` là business-domain** (KHÔNG bịa `onboarding-web`).
|
|
141
|
-
- "Có ô định tuyến nào ứng với NHIỀU repo không — tức cùng một domain (và cùng platform,
|
|
142
|
-
nếu có) nhưng mỗi feature nằm ở một repo riêng? (vd mỗi mini-game webview một repo) (Y/N)"
|
|
143
|
-
- **Y → dạng map-theo-prd_slug (FORM C):** "Liệt kê dạng `domain:platform:prd-slug:module`
|
|
144
|
-
— bỏ trống đoạn platform nếu domain không chia platform (`domain::prd-slug:module`) —
|
|
145
|
-
ngăn cách bởi dấu phẩy (vd
|
|
146
|
-
`learning:webview:dap-chuot:phaser-game,learning:webview:ban-cung:phaser-game`).
|
|
147
|
-
Nhấn Enter để skip."
|
|
148
|
-
`prd-slug` là **tên thư mục feature-package** dưới `specs/{domain}/`, phải khớp chính xác.
|
|
149
|
-
context-loader tra `@trace.platform` rồi tra tiếp `prd_slug` → chọn đúng repo.
|
|
150
|
-
Không khớp slug nào thì lệnh DỪNG (`unresolved`) chứ không đoán repo gần giống.
|
|
151
|
-
|
|
152
|
-
Rồi:
|
|
153
|
-
- Skip tạo bất kỳ artifact `specs/` nào (mọi spec — PRD, BDD, tech-docs, design-spec — sống trong spec submodule theo bố cục feature-package `specs/{domain}/{prd-slug}/`)
|
|
154
|
-
- Chỉ tạo: `.trace/`, `.agent/review/` ở cấp umbrella
|
|
155
|
-
*(Trừ khi user yêu cầu rõ tạo cấu trúc đầy đủ)*
|
|
156
|
-
- Sinh `.agent/project-context.yaml` ở umbrella mode với services (FORM A, B hoặc C — trộn được trong cùng một file) và spec_source đã cung cấp.
|
|
157
|
-
**Sau khi sinh, MỞ file kiểm tra:** mỗi `services.{domain}.path` (hoặc `.{platform}.path`, hoặc `.by_prd_slug.{slug}.path`) phải trỏ **đúng tên thư mục submodule thật** — generator để placeholder `TODO-…` vì tên dir thường khác tên domain. Sửa cho khớp trước khi chạy lệnh generate.
|
|
158
|
-
- Skip tạo `CLAUDE.md` root (umbrella không có một tech stack đơn) — nhưng nhắc mỗi submodule code cần overlay `{path}/CLAUDE.md` riêng (thiếu thì code-gen fallback về default + cờ ⚠️, có thể sai coding-standards).
|
|
159
|
-
- Sau setup, nhắc: "Mở từng service submodule riêng trong Claude Code để cài framework/overlay ở đó nếu cần."
|
|
160
|
-
|
|
161
|
-
**project_type = 3 (PO Spec repo):**
|
|
162
|
-
- Tạo base dir: `specs/product-definition/`, `specs/domain-knowledge/`, `feedback/`, `.agent/review/`
|
|
163
|
-
- Artifact theo từng feature (`specs/{domain}/{prd-slug}/{ {TICKET-ID}-{prd-slug}.md, bdd/, tech-docs/, design-spec/}`) được tạo on demand bởi các lệnh generate — ĐỪNG tạo trước
|
|
164
|
-
- Skip: `.trace/` (theo service, sống cạnh code trong mỗi service submodule)
|
|
165
|
-
- Sinh `CLAUDE.md` tối thiểu chỉ với §1 (project overview) và §7 (git conventions)
|
|
166
|
-
- Hỏi người dùng: **"Liệt kê các business domain của bạn (vd auth, payment, loyalty):"** — lưu thành domain list cho `project-context.yaml` và nhắc PO các tên này phải được dùng nhất quán ở row `| **Domain** |` của bảng Metadata trong mọi PRD
|
|
167
|
-
- Thông báo:
|
|
168
|
-
- Lệnh cho PO repo: `/define-product`, `/generate-prd`, `/review-context`, `/generate-design-spec`
|
|
169
|
-
- **Quan trọng cho handoff team dev:** Mọi PRD phải có row `| **Domain** | {domain} |` trong **bảng Metadata**. Team dev dùng nó để route BDD/code sinh ra tới đúng service submodule. Tên domain không nhất quán sẽ phá routing.
|
|
170
|
-
- Bảng Metadata PRD (do `/generate-prd` điền sẵn theo template):
|
|
171
|
-
```
|
|
172
|
-
| **Domain** | {domain} | ← phải khớp một key trong services config của team dev
|
|
173
|
-
| **Ticket** | {TICKET-ID} |
|
|
174
|
-
| **Status** | draft | approved |
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
## Step 1 — Tạo cấu trúc thư mục
|
|
178
|
-
|
|
179
|
-
Tạo các thư mục này (skip nếu đã tồn tại):
|
|
180
|
-
|
|
181
|
-
```
|
|
182
|
-
{project-root}/
|
|
183
|
-
├── specs/
|
|
184
|
-
│ ├── product-definition/ ← Output của /define-product
|
|
185
|
-
│ └── domain-knowledge/ ← business dictionary & domain context
|
|
186
|
-
├── .trace/ ← .trace/{domain}/{prd-slug}/{UC-ID}-{platform}.tsv
|
|
187
|
-
└── .agent/
|
|
188
|
-
└── review/
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
**Bố cục feature-package** — artifact spec theo từng feature KHÔNG được tạo trước. Mỗi lệnh generate
|
|
192
|
-
tự tạo folder của nó on demand dưới `specs/{domain}/{prd-slug}/`:
|
|
193
|
-
|
|
194
|
-
```
|
|
195
|
-
specs/{domain}/{prd-slug}/
|
|
196
|
-
├── {TICKET-ID}-{prd-slug}.md ← /generate-prd (vd SEG01-segment-scoring-service.md)
|
|
197
|
-
├── bdd/ ← /generate-bdd (file .feature)
|
|
198
|
-
├── tech-docs/ ← /generate-tech-docs
|
|
199
|
-
└── design-spec/ ← /generate-design-spec (chỉ platform FE/App)
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
*Tạo base dir nào tuỳ theo `project_type` set ở Step 0.5:*
|
|
203
|
-
|
|
204
|
-
| project_type | Tạo | Skip |
|
|
205
|
-
|---|---|---|
|
|
206
|
-
| **1 — Single-service** | Cấu trúc base ở trên (`specs/product-definition/`, `specs/domain-knowledge/`, `.trace/`, `.agent/review/`) | folder theo feature (tạo on demand) |
|
|
207
|
-
| **2 — Umbrella** | Chỉ `.trace/` + `.agent/review/` (ở umbrella root) | Mọi thứ khác — **toàn bộ spec sống trong spec submodule (`spec_source`)** dưới `specs/{domain}/{prd-slug}/`; service submodule chỉ chứa **code + `.trace/`** |
|
|
208
|
-
| **3 — PO Spec repo** | `specs/product-definition/`, `specs/domain-knowledge/`, **`feedback/`**, `.agent/review/` (folder `specs/{domain}/{prd-slug}/` theo feature tạo on demand) | `.trace/` (theo service, sống cạnh code trong mỗi service submodule) |
|
|
209
|
-
|
|
210
|
-
## Step 2 — Tạo CLAUDE.md
|
|
211
|
-
|
|
212
|
-
*Bỏ qua hoàn toàn step này nếu `project_type = 2` (Umbrella) — umbrella không có một tech stack đơn.*
|
|
213
|
-
*Với `project_type = 3` (PO Spec repo) — tạo CLAUDE.md tối thiểu chỉ với §1 (project overview) và §7 (git conventions). Skip §2–§6.*
|
|
214
|
-
|
|
215
|
-
Kiểm tra `CLAUDE.md` tồn tại chưa:
|
|
216
|
-
- Có → hỏi "Merge template hay skip?"
|
|
217
|
-
- Không → tạo từ template bên dưới
|
|
218
|
-
|
|
219
|
-
Sau khi tạo, hướng dẫn: "Mở CLAUDE.md và điền các giá trị `{{PLACEHOLDER}}` bằng thông tin dự án của bạn."
|
|
220
|
-
|
|
221
|
-
### CLAUDE.md Template
|
|
222
|
-
|
|
223
|
-
```
|
|
224
|
-
# §1. Project Overview
|
|
225
|
-
Project: {{PROJECT_NAME}}
|
|
226
|
-
Language: {{LANGUAGE}}
|
|
227
|
-
Framework: {{FRAMEWORK}}
|
|
228
|
-
Build: {{BUILD_COMMAND}}
|
|
229
|
-
Test: {{TEST_COMMAND}}
|
|
230
|
-
Domains: {{COMMA_SEPARATED_DOMAINS}}
|
|
231
|
-
|
|
232
|
-
# §2. Architecture
|
|
233
|
-
layers: "{{LAYER_STACK}}"
|
|
234
|
-
# Example: Controller → Facade → Service → Repository
|
|
235
|
-
rules:
|
|
236
|
-
- "Controllers must not contain business logic"
|
|
237
|
-
- "Services own transaction boundaries"
|
|
238
|
-
|
|
239
|
-
# §3. Coding Standards
|
|
240
|
-
naming:
|
|
241
|
-
classes: "{{NAMING_CONVENTION}}"
|
|
242
|
-
methods: "{{METHOD_CONVENTION}}"
|
|
243
|
-
response_wrapper: "{{WRAPPER}}"
|
|
244
|
-
forbidden:
|
|
245
|
-
- "Magic numbers"
|
|
246
|
-
- "Debug print statements"
|
|
247
|
-
|
|
248
|
-
# §4. Traceability
|
|
249
|
-
# Every entry-point method must carry the FULL block (repeat it per UC in a
|
|
250
|
-
# multi-UC file — the version tags are per-UC scalars, never merge them):
|
|
251
|
-
# @trace.implements={UC-ID}-SC{N}
|
|
252
|
-
# @trace.prd_version={PRD version} / @trace.bdd_version={BDD version} / @trace.tech_doc_revision={n}
|
|
253
|
-
# @trace.source=specs/{domain}/{prd-slug}/bdd/{platform}/{UC-ID}-{slug}.feature
|
|
254
|
-
# ({platform} = web|app|system · adjust the root if specs_dir differs in .agent/project-context.yaml)
|
|
255
|
-
# Tests must be tagged:
|
|
256
|
-
# @trace.verifies={UC-ID}-SC{N}
|
|
257
|
-
|
|
258
|
-
# §5. Error Handling
|
|
259
|
-
not_found: "{{NOT_FOUND_EXCEPTION}}"
|
|
260
|
-
http_codes: { get: 200, create: 201, not_found: 404, validation: 400 }
|
|
261
|
-
|
|
262
|
-
# §6. Build & Test
|
|
263
|
-
build_command: "{{BUILD_COMMAND}}"
|
|
264
|
-
test_command: "{{TEST_COMMAND}}"
|
|
265
|
-
run_command: "{{RUN_COMMAND}}"
|
|
266
|
-
|
|
267
|
-
# §7. Git Conventions
|
|
268
|
-
branch_feature: "feature/{{TICKET_PREFIX}}-{N}-{slug}"
|
|
269
|
-
commit_feature: "feat({{TICKET_PREFIX}}-{N}): {description}"
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
## Step 3 — Tạo project-context.yaml
|
|
273
|
-
|
|
274
|
-
*Với `project_type = 2` (Umbrella):*
|
|
275
|
-
- *Nếu `.agent/project-context.yaml` đã được sinh bởi `--init --umbrella` → mở nó và verify/sửa section `services` (domain key, path, module). Skip copy template bên dưới.*
|
|
276
|
-
- *Nếu chưa sinh → hỏi: "Path spec submodule?" và "Services (cặp domain:module)?" rồi sinh config umbrella (xem Step 0.5 cho format).*
|
|
277
|
-
|
|
278
|
-
Tạo `.agent/project-context.yaml` dùng `.agent/templates/project-context.yaml` làm template nguồn.
|
|
279
|
-
|
|
280
|
-
Copy template và hướng dẫn: "Mở `.agent/project-context.yaml` và điền mọi giá trị `{{PLACEHOLDER}}`. Section `paths` đã được cấu hình sẵn với default hợp lý — chỉnh nếu dự án dùng tên thư mục khác."
|
|
281
|
-
|
|
282
|
-
## Step 4 — Tạo business-dictionary.md
|
|
283
|
-
|
|
284
|
-
*Skip Step 4 và 5 nếu `project_type = 2` (Umbrella) — business dictionary và core entities sống trong spec submodule và do team PO quản lý. Team dev đọc chúng từ `{spec_source}/specs/domain-knowledge/`.*
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
Tạo `specs/domain-knowledge/business-dictionary.md` nếu chưa tồn tại:
|
|
288
|
-
|
|
289
|
-
```markdown
|
|
290
|
-
# Business Dictionary — {{PROJECT_NAME}}
|
|
291
|
-
|
|
292
|
-
> Thuật ngữ chuẩn cho dự án này. Mọi PRD, BDD spec, và code phải theo các thuật ngữ này.
|
|
293
|
-
> Managed by: PO / SA team.
|
|
294
|
-
|
|
295
|
-
## Canonical Terms
|
|
296
|
-
|
|
297
|
-
| Canonical Term | Description / Context |
|
|
298
|
-
|----------------|----------------------|
|
|
299
|
-
| {Term} | {Short description, usage scope} |
|
|
300
|
-
|
|
301
|
-
## Banned Terms
|
|
302
|
-
|
|
303
|
-
| ❌ Do NOT use | ✅ Use instead | Reason |
|
|
304
|
-
|---------------|-------------------|--------|
|
|
305
|
-
| {banned} | {canonical} | {why} |
|
|
306
|
-
|
|
307
|
-
## Status / Enum Registry
|
|
308
|
-
|
|
309
|
-
| Entity | Field | Allowed Values |
|
|
310
|
-
|--------|---------|--------------------|
|
|
311
|
-
| {Entity} | status | {value1, value2} |
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
Hướng dẫn: "Mở `specs/domain-knowledge/business-dictionary.md` và thêm thuật ngữ dự án của bạn. File này sẽ được mọi lệnh đọc để enforce naming nhất quán."
|
|
315
|
-
|
|
316
|
-
## Step 5 — Tạo core-entities.md
|
|
317
|
-
|
|
318
|
-
Tạo `specs/domain-knowledge/core-entities.md` nếu chưa tồn tại:
|
|
319
|
-
|
|
320
|
-
```markdown
|
|
321
|
-
# Core Entities — {{PROJECT_NAME}}
|
|
322
|
-
|
|
323
|
-
> Glossary entity máy-đọc-được cho phát triển có AI hỗ trợ.
|
|
324
|
-
> Được mọi lệnh nạp để AI biết domain model của bạn mà không cần đọc source code.
|
|
325
|
-
> Managed by: Tech Lead / Architect.
|
|
326
|
-
>
|
|
327
|
-
> HOW TO USE:
|
|
328
|
-
> - Add one `## Entity: {Name}` section per domain entity (aggregate root, value object, etc.)
|
|
329
|
-
> - Keep field descriptions concise — this is a REFERENCE, not API docs
|
|
330
|
-
> - Update this file whenever you add/rename fields or change business invariants
|
|
331
|
-
|
|
332
|
-
---
|
|
333
|
-
|
|
334
|
-
## Entity: {EntityName}
|
|
335
|
-
|
|
336
|
-
**Purpose**: {1-2 sentences — what this entity represents and why it exists in the domain}
|
|
337
|
-
**Domain**: {domain}
|
|
338
|
-
**Storage**: {e.g., `orders` table in PostgreSQL | `orders` collection in MongoDB}
|
|
339
|
-
**Owner service**: {service/module that owns this entity}
|
|
340
|
-
|
|
341
|
-
| Field | Type | Nullable | Description |
|
|
342
|
-
|--------------|---------|----------|-------------------------------------|
|
|
343
|
-
| id | UUID | No | Primary key |
|
|
344
|
-
| {field_name} | {type} | Yes/No | {short description} |
|
|
345
|
-
| status | Enum | No | See Status Registry in business-dictionary.md |
|
|
346
|
-
|
|
347
|
-
**Business invariants:**
|
|
348
|
-
- {Rule 1: e.g., "status can only transition: PENDING → ACTIVE → CLOSED"}
|
|
349
|
-
- {Rule 2: e.g., "total must equal sum of line items"}
|
|
350
|
-
|
|
351
|
-
**Relationships:**
|
|
352
|
-
- `{EntityA}` 1:N `{EntityB}` — {one sentence description}
|
|
353
|
-
- `{EntityA}` N:N `{EntityC}` via `{junction_table}` — {description}
|
|
354
|
-
|
|
355
|
-
---
|
|
356
|
-
|
|
357
|
-
## Entity: {AnotherEntity}
|
|
358
|
-
|
|
359
|
-
*(Add more entities following the same pattern above)*
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
Hướng dẫn: "Mở `specs/domain-knowledge/core-entities.md` và định nghĩa các domain entity chính. Bắt đầu với aggregate root. File này được mọi lệnh AI nạp — định nghĩa tốt ở đây tiết kiệm đáng kể qua-lại khi sinh code."
|
|
363
|
-
|
|
364
|
-
## Step 6 — Cài VS Code Extension (Khuyến nghị)
|
|
365
|
-
|
|
366
|
-
Khuyến nghị user cài extension VS Code **Spec Driven Docs Tools** — nó cung cấp panel Review Board + Living Documentation tích hợp với workflow này.
|
|
367
|
-
|
|
368
|
-
```bash
|
|
369
|
-
code --install-extension SpecDrivenDocsTools.spec-driven-docs-tool
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
Hoặc: VS Code → `Ctrl+Shift+P` → **"Extensions: Install from Marketplace"** → tìm **Spec Driven Docs Tools**.
|
|
373
|
-
|
|
374
|
-
**Nó làm gì:**
|
|
375
|
-
- 📋 **Review Board** — UI trực quan để review findings từ `/refine-prd`, `/review-context`, `/review-tech-docs`
|
|
376
|
-
- 📊 **Living Documentation** — dashboard traceability dựa trên `.trace/*.tsv`
|
|
377
|
-
|
|
378
|
-
## Step 7 — Verify
|
|
379
|
-
|
|
380
|
-
Checklist tuỳ theo `project_type`:
|
|
381
|
-
|
|
382
|
-
**project_type = 1 (Single-service):**
|
|
383
|
-
- [ ] `specs/` tồn tại
|
|
384
|
-
- [ ] `specs/product-definition/` tồn tại
|
|
385
|
-
- [ ] `specs/domain-knowledge/` tồn tại
|
|
386
|
-
- [ ] `.trace/` tồn tại
|
|
387
|
-
*(folder `specs/{domain}/{prd-slug}/` theo feature tạo on demand — không check ở đây)*
|
|
388
|
-
- [ ] `.agent/project-context.yaml` tồn tại
|
|
389
|
-
- [ ] `CLAUDE.md` tồn tại
|
|
390
|
-
- [ ] `specs/domain-knowledge/business-dictionary.md` tồn tại
|
|
391
|
-
- [ ] `specs/domain-knowledge/core-entities.md` tồn tại
|
|
392
|
-
|
|
393
|
-
**project_type = 2 (Umbrella):**
|
|
394
|
-
- [ ] `.agent/project-context.yaml` tồn tại với `setup.mode: umbrella`
|
|
395
|
-
- [ ] Section `services` có ít nhất một entry với đúng domain key
|
|
396
|
-
- [ ] Path `spec_source` tồn tại (vd thư mục `my-project-specs/` có mặt)
|
|
397
|
-
- [ ] `.agent/review/` tồn tại
|
|
398
|
-
- [ ] Spec submodule đã init: `git submodule status` không hiện prefix `-`
|
|
399
|
-
|
|
400
|
-
**project_type = 3 (PO Spec repo):**
|
|
401
|
-
- [ ] `specs/product-definition/` tồn tại
|
|
402
|
-
- [ ] `specs/domain-knowledge/` tồn tại
|
|
403
|
-
- [ ] `feedback/` tồn tại
|
|
404
|
-
*(folder `specs/{domain}/{prd-slug}/` theo feature tạo on demand — không check ở đây)*
|
|
405
|
-
- [ ] `.agent/review/` tồn tại
|
|
406
|
-
- [ ] `.agent/project-context.yaml` tồn tại
|
|
407
|
-
- [ ] `CLAUDE.md` tồn tại (tối thiểu)
|
|
408
|
-
- [ ] `specs/domain-knowledge/business-dictionary.md` tồn tại
|
|
409
|
-
- [ ] `specs/domain-knowledge/core-entities.md` tồn tại
|
|
410
|
-
|
|
411
|
-
## Output
|
|
412
|
-
|
|
413
|
-
# Report Footer — Định dạng output chuẩn cho mọi lệnh
|
|
414
|
-
|
|
415
|
-
Mọi report của lệnh phải kết thúc bằng section footer chuẩn này.
|
|
416
|
-
|
|
417
|
-
## Status Badge
|
|
418
|
-
|
|
419
|
-
Chọn một theo kết quả:
|
|
420
|
-
- `✅ Complete` — mọi bước thành công, không có vấn đề
|
|
421
|
-
- `❌ Failed` — lệnh không hoàn thành được do lỗi chặn
|
|
422
|
-
- `⚠️ Warnings` — hoàn thành nhưng có vấn đề không chặn, nên review lại
|
|
423
|
-
|
|
424
|
-
## Output Artifacts
|
|
425
|
-
|
|
426
|
-
Liệt kê mọi file được tạo hoặc sửa bởi lệnh này:
|
|
427
|
-
```
|
|
428
|
-
Output Artifacts:
|
|
429
|
-
{created|updated} {file-path} ({mô tả ngắn})
|
|
430
|
-
{created|updated} {file-path} ({mô tả ngắn})
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
Nếu không ghi file nào (vd: lệnh review hoặc phân tích) → ghi `Output Artifacts: none (read-only)`.
|
|
434
|
-
|
|
435
|
-
## Pipeline Position
|
|
436
|
-
|
|
437
|
-
In một sơ đồ pipeline một dòng, đánh dấu phase của lệnh HIỆN TẠI bằng `◀ bạn ở đây`,
|
|
438
|
-
để người dùng luôn thấy lệnh này nằm ở đâu trong luồng end-to-end:
|
|
439
|
-
|
|
440
|
-
```
|
|
441
|
-
Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
Tìm lệnh hiện tại trong bảng phase dưới đây và đánh dấu **phase của nó** trong sơ đồ trên:
|
|
445
|
-
|
|
446
|
-
| Phase | Commands |
|
|
447
|
-
|-------|----------|
|
|
448
|
-
| Discovery | `/define-product` |
|
|
449
|
-
| PRD | `/generate-prd` · `/extend-prd` · `/refine-prd` · `/review-context` (PRD) |
|
|
450
|
-
| Design Spec | `/generate-design-spec` |
|
|
451
|
-
| BDD | `/generate-bdd` · `/review-context` (BDD) |
|
|
452
|
-
| Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
|
|
453
|
-
| Code | `/generate-code` · `/review-code` |
|
|
454
|
-
| Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
|
|
455
|
-
| QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
|
|
456
|
-
| Trace Audit | `/validate-traces` |
|
|
457
|
-
|
|
458
|
-
Với **lệnh review**, thêm vòng review 3 bước và đánh dấu bước hiện tại, vd:
|
|
459
|
-
`Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
|
|
460
|
-
|
|
461
|
-
**Lệnh xuyên suốt** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
|
|
462
|
-
`/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) nằm ngoài pipeline tuyến tính —
|
|
463
|
-
**bỏ hẳn dòng Pipeline** cho các lệnh này (đừng cố nhét chúng vào sơ đồ).
|
|
464
|
-
|
|
465
|
-
## Gợi ý lệnh tiếp theo
|
|
466
|
-
|
|
467
|
-
Gợi ý lệnh kế tiếp hợp lý theo phase của workflow:
|
|
468
|
-
|
|
469
|
-
| Lệnh hiện tại | Gợi ý lệnh tiếp theo |
|
|
470
|
-
|-------------------------|-----------------------------------------------|
|
|
471
|
-
| /setup-ai-first | `/define-product` để bắt đầu feature đầu tiên |
|
|
472
|
-
| /define-product | `/generate-prd {product-definition-file}` |
|
|
473
|
-
| /generate-prd | `/refine-prd {prd-file}` rồi `/review-context {prd-file}` |
|
|
474
|
-
| /extend-prd | `/refine-prd {prd-file}` (soi phần vừa thêm) rồi `/review-context {prd-file}` → PO duyệt → `/generate-bdd` **chỉ cho UC MỚI**; UC cũ dùng `/validate-traces --realign-prd-version {UC-ID}` |
|
|
475
|
-
| /refine-prd | Mở Review Board → cập nhật PRD → `/review-context {prd-file}` |
|
|
476
|
-
| /review-context (PRD) | Khi 0 critical → PO đặt `Status: approved`, rồi FE/App: `/generate-design-spec {prd-file}` (→ design sign-off → BDD); BE: `/generate-bdd {prd-file}`. Còn critical/NEEDS_FIX → sửa PRD (giữ draft) |
|
|
477
|
-
| /generate-design-spec | Designer review → xác nhận link Figma → PO + Designer sign-off → `/generate-bdd {prd-file}` |
|
|
478
|
-
| /generate-bdd | `/review-context {feature-file}` để kiểm tra độ phủ |
|
|
479
|
-
| /review-context (BDD) | `/generate-tech-docs {UC-ID}` nếu APPROVED; sinh lại nếu NEEDS_FIX |
|
|
480
|
-
| /qc-analyze | `/qc-plan {UC-ID}` (xử lý các gap blocker 🔴 trước) |
|
|
481
|
-
| /qc-plan | `/qc-design-test {UC-ID}` |
|
|
482
|
-
| /qc-design-test | `/qc-review {UC-ID}` (review test-case) |
|
|
483
|
-
| /qc-review (test-case) | `/qc-run-test {UC-ID}` nếu APPROVED; sửa TC nếu NEEDS_FIX |
|
|
484
|
-
| /qc-run-test | `/qc-report {UC-ID}` rồi `/qc-review {UC-ID}` (review script) |
|
|
485
|
-
| /qc-review (script) | `/qc-report {UC-ID}` rồi tạo PR nếu APPROVED |
|
|
486
|
-
| /qc-report | `/validate-traces {UC-ID}` để làm mới Living Docs (qc_status) |
|
|
487
|
-
| /map-testids | `/qc-design-test {UC-ID}` (QC dựng Page Object từ contract §4.5.6 vừa ghi) |
|
|
488
|
-
| /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
|
|
489
|
-
| /review-tech-docs | `/generate-code {feature-file}` nếu APPROVED; sửa doc nếu NEEDS_FIX |
|
|
490
|
-
| /generate-code | Lần gen đầu → `/review-code {UC-ID}`; gen lại → `/dev-gen-test {UC-ID}` |
|
|
491
|
-
| /dev-gen-test | `/dev-run-test {UC-ID}` |
|
|
492
|
-
| /dev-run-test (passing) | `/review-code {UC-ID}` |
|
|
493
|
-
| /dev-run-test (failing) | `/fix-bug {ticket-id}` hoặc `/debug {error}` |
|
|
494
|
-
| /review-code | `/dev-smoke-test {UC-ID}` hoặc tạo PR |
|
|
495
|
-
| /dev-smoke-test | Tạo PR và link tới ticket |
|
|
496
|
-
| /validate-traces | **Cờ 🔴 trước (chặn PR):** SEAM_UNWIRED → nối binding sang class thật, xoá/thay stub · STUB_UNRESOLVED → `/generate-code {owner_uc}` (lấp logic tại chỗ + xoá hàm song song) · ORPHANED/TRACE_ORPHAN → quyết định thủ công (xoá code+test, đưa scenario trở lại `.feature`, hoặc sửa `sc_id` của tag). **Rồi:** DRIFT/UNTRACKED → `/generate-code {UC-ID}` · BDD_DRIFT → `/generate-code {feature-file}` · tech-doc lỗi thời vs BDD → `/generate-tech-docs` → `/review-tech-docs` · PRD drift → `/generate-bdd {prd-file}` · GAP → `/dev-gen-test {UC-ID}`. **Chỉ tạo PR khi mọi cờ 🔴 = 0** |
|
|
497
|
-
| /fix-bug | `/dev-run-test {UC-ID}` (dev_selftest vừa reset về not_run) → tạo PR; nếu fix một `{BUG-ID}` → QC chạy `/qc-run-test {UC-ID}` để verify + đóng bug |
|
|
498
|
-
| /debug | `/fix-bug {ticket-id}` nếu cần sửa |
|
|
499
|
-
| /report-bug | Gửi cho dev (`/fix-bug {BUG-ID}`); nếu thiếu coverage → `/propose-scenario {UC-ID}` |
|
|
500
|
-
| /propose-scenario | **Case A** (thiếu scenario cho AC có sẵn) → báo PO/Dev review trong `feedback/bdd-proposals/`; `/generate-bdd` tự chèn khi `Status: accepted`. **Case B** (requirement mới) → `feedback/prd-change-requests/` — PO phải đưa vào PRD trước, KHÔNG tự vào BDD được; `/validate-traces` nhắc lại kèm số ngày chờ chừng nào `Status: Open` |
|
|
501
|
-
| /learn | Tiếp tục làm việc — lesson áp dụng ở lệnh kế tiếp |
|
|
502
|
-
| /sync | `/validate-traces` để xem độ phủ đầy đủ; xử lý mọi `📥 tester feedback` được nêu |
|
|
503
|
-
| /update-framework | Review `git diff .agent/`, commit; `/sync` để đồng bộ nội dung dự án |
|
|
504
|
-
|
|
505
|
-
Định dạng footer như sau:
|
|
506
|
-
```
|
|
507
|
-
---
|
|
508
|
-
Status : {badge}
|
|
509
|
-
{khối Output Artifacts}
|
|
510
|
-
Pipeline : Discovery → PRD → [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
|
|
511
|
-
(lệnh review) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
|
|
512
|
-
Next : {lệnh gợi ý kèm ví dụ tham số}
|
|
513
|
-
```
|
|
514
|
-
*(Bỏ dòng `Pipeline` cho các lệnh xuyên suốt liệt kê ở trên.)*
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
```
|
|
518
|
-
/setup-ai-first Hoàn tất ✅
|
|
519
|
-
```
|
|
520
|
-
|
|
521
|
-
Output tuỳ theo `project_type`:
|
|
522
|
-
|
|
523
|
-
**Single-service:**
|
|
524
|
-
```
|
|
525
|
-
Next:
|
|
526
|
-
1. Điền CLAUDE.md (thay các giá trị {{PLACEHOLDER}})
|
|
527
|
-
2. Điền .agent/project-context.yaml
|
|
528
|
-
3. Điền specs/domain-knowledge/business-dictionary.md
|
|
529
|
-
4. Điền specs/domain-knowledge/core-entities.md
|
|
530
|
-
5. git add và commit 4 file đó
|
|
531
|
-
6. Cài VS Code extension:
|
|
532
|
-
code --install-extension SpecDrivenDocsTools.spec-driven-docs-tool
|
|
533
|
-
7. /define-product để bắt đầu feature đầu tiên
|
|
534
|
-
```
|
|
535
|
-
|
|
536
|
-
**Umbrella:**
|
|
537
|
-
```
|
|
538
|
-
Next:
|
|
539
|
-
1. Review .agent/project-context.yaml:
|
|
540
|
-
- Cập nhật services[].path khớp tên thư mục submodule thực tế
|
|
541
|
-
- Cập nhật domain key của services khớp row `Domain` (bảng Metadata) trong các file PRD
|
|
542
|
-
- Xác nhận path spec_source đúng
|
|
543
|
-
|
|
544
|
-
2. Chạy /sync — một lệnh lo mọi thứ còn lại:
|
|
545
|
-
/sync
|
|
546
|
-
→ git pull + submodule init + spec submodule update
|
|
547
|
-
→ Tự tạo .agent/project-context.yaml cho mỗi service submodule
|
|
548
|
-
(phát hiện module từ pom.xml / go.mod / package.json / pubspec.yaml v.v.)
|
|
549
|
-
→ Sync Living Docs panel
|
|
550
|
-
→ Refresh spec-manifest.yaml
|
|
551
|
-
|
|
552
|
-
3. Bắt đầu sinh:
|
|
553
|
-
/generate-bdd {spec_source}/specs/{domain}/{prd-slug}/{TICKET-ID}-{prd-slug}.md
|
|
554
|
-
```
|
|
555
|
-
|
|
556
|
-
**PO Spec repo:**
|
|
557
|
-
```
|
|
558
|
-
Next:
|
|
559
|
-
1. Điền .agent/project-context.yaml:
|
|
560
|
-
- domains: [liệt kê mọi business domain — chúng thành row `Domain` (bảng Metadata) trong PRD]
|
|
561
|
-
- project.name, project.description
|
|
562
|
-
2. Điền specs/domain-knowledge/business-dictionary.md ← canonical terms
|
|
563
|
-
3. Điền specs/domain-knowledge/core-entities.md ← entity glossary
|
|
564
|
-
4. git add và commit các file đó
|
|
565
|
-
5. Cài VS Code extension:
|
|
566
|
-
code --install-extension SpecDrivenDocsTools.spec-driven-docs-tool
|
|
567
|
-
6. /define-product để bắt đầu feature đầu tiên
|
|
568
|
-
|
|
569
|
-
⚠️ Nhắc handoff team dev:
|
|
570
|
-
- Mỗi PRD phải có row `Domain` (bảng Metadata) khớp một trong domains list của bạn
|
|
571
|
-
- Khi team dev setup umbrella repo của họ, họ map các tên domain này
|
|
572
|
-
tới path service submodule trong section services của project-context.yaml
|
|
573
|
-
- Chia sẻ tên domain với team dev trước khi họ cấu hình umbrella
|
|
574
|
-
```
|