@edupia-tutor/spec-driven-docs 0.14.0 → 0.14.1
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/commands/debug.md +435 -435
- package/commands/debug.tmpl +111 -111
- package/commands/define-product.md +330 -327
- package/commands/define-product.tmpl +50 -47
- package/commands/dev-gen-test.md +364 -364
- package/commands/dev-gen-test.tmpl +63 -63
- package/commands/dev-run-test.md +375 -375
- package/commands/dev-run-test.tmpl +74 -74
- package/commands/dev-smoke-test.md +340 -340
- package/commands/dev-smoke-test.tmpl +60 -60
- package/commands/fix-bug.md +402 -402
- package/commands/fix-bug.tmpl +78 -78
- package/commands/generate-bdd.md +512 -512
- package/commands/generate-bdd.tmpl +211 -211
- package/commands/generate-code.md +480 -482
- package/commands/generate-code.tmpl +179 -181
- package/commands/generate-design-spec.md +495 -495
- package/commands/generate-design-spec.tmpl +219 -219
- package/commands/generate-prd.md +445 -396
- package/commands/generate-prd.tmpl +45 -198
- package/commands/generate-spec-manifest.md +337 -337
- package/commands/generate-spec-manifest.tmpl +57 -57
- package/commands/generate-tech-docs.md +364 -364
- package/commands/generate-tech-docs.tmpl +84 -84
- package/commands/learn.md +346 -346
- package/commands/learn.tmpl +22 -22
- package/commands/map-testids.md +321 -321
- package/commands/map-testids.tmpl +41 -41
- package/commands/propose-scenario.md +334 -334
- package/commands/propose-scenario.tmpl +54 -54
- package/commands/qc-analyze.md +322 -323
- package/commands/qc-analyze.tmpl +42 -43
- package/commands/qc-design-test.md +303 -303
- package/commands/qc-design-test.tmpl +23 -23
- package/commands/qc-plan.md +296 -296
- package/commands/qc-plan.tmpl +16 -16
- package/commands/qc-report.md +301 -301
- package/commands/qc-report.tmpl +21 -21
- package/commands/qc-review.md +297 -297
- package/commands/qc-review.tmpl +17 -17
- package/commands/qc-run-test.md +336 -336
- package/commands/qc-run-test.tmpl +35 -35
- package/commands/refine-prd.md +426 -428
- package/commands/refine-prd.tmpl +61 -61
- package/commands/report-bug.md +350 -350
- package/commands/report-bug.tmpl +70 -70
- package/commands/review-code.md +363 -363
- package/commands/review-code.tmpl +39 -39
- package/commands/review-context.md +577 -579
- package/commands/review-context.tmpl +212 -212
- package/commands/review-tech-docs.md +426 -426
- package/commands/review-tech-docs.tmpl +146 -146
- package/commands/setup-ai-first.md +237 -237
- package/commands/setup-ai-first.tmpl +131 -131
- package/commands/sync.md +145 -145
- package/commands/sync.tmpl +93 -93
- package/commands/update-framework.md +88 -88
- package/commands/update-framework.tmpl +36 -36
- package/commands/validate-traces.md +379 -379
- package/commands/validate-traces.tmpl +99 -99
- package/core/FRAMEWORK_VERSION +1 -1
- package/core/commands/debug.md +435 -435
- package/core/commands/define-product.md +330 -327
- package/core/commands/dev-gen-test.md +364 -364
- package/core/commands/dev-run-test.md +375 -375
- package/core/commands/dev-smoke-test.md +340 -340
- package/core/commands/fix-bug.md +402 -402
- package/core/commands/generate-bdd.md +512 -512
- package/core/commands/generate-code.md +480 -482
- package/core/commands/generate-design-spec.md +495 -495
- package/core/commands/generate-prd.md +445 -396
- package/core/commands/generate-spec-manifest.md +337 -337
- package/core/commands/generate-tech-docs.md +364 -364
- package/core/commands/learn.md +346 -346
- package/core/commands/map-testids.md +321 -321
- package/core/commands/propose-scenario.md +334 -334
- package/core/commands/qc-analyze.md +322 -323
- package/core/commands/qc-design-test.md +303 -303
- package/core/commands/qc-plan.md +296 -296
- package/core/commands/qc-report.md +301 -301
- package/core/commands/qc-review.md +297 -297
- package/core/commands/qc-run-test.md +336 -336
- package/core/commands/refine-prd.md +426 -428
- package/core/commands/report-bug.md +350 -350
- package/core/commands/review-code.md +363 -363
- package/core/commands/review-context.md +577 -579
- package/core/commands/review-tech-docs.md +426 -426
- package/core/commands/setup-ai-first.md +237 -237
- package/core/commands/sync.md +145 -145
- package/core/commands/update-framework.md +88 -88
- package/core/commands/validate-traces.md +379 -379
- package/core/skills/code/SKILL.md +388 -388
- package/core/skills/debug/SKILL.md +390 -390
- package/core/skills/design-spec/SKILL.md +316 -316
- package/core/skills/discovery/SKILL.md +7 -547
- package/core/skills/prd/SKILL.md +298 -394
- package/core/skills/setup-ai-first/SKILL.md +79 -79
- package/core/skills/spec/SKILL.md +176 -176
- package/core/skills/test/SKILL.md +602 -602
- package/core/steps/capture-lesson.md +44 -44
- package/core/steps/context-loader.md +174 -174
- package/core/steps/gate.md +54 -54
- package/core/steps/report-footer.md +52 -52
- package/core/steps/review-fanout.md +85 -87
- package/core/steps/spawn-agent.md +45 -45
- package/core/steps/trace-mirror.md +21 -21
- package/core/templates/architecture.template.md +37 -37
- package/core/templates/design-spec.template.md +77 -77
- package/core/templates/platform-guide.template.md +47 -47
- package/core/templates/prd.template.md +106 -231
- package/core/templates/product-definition.template.md +101 -88
- package/docs/04-operations/publishing.md +20 -3
- package/package.json +1 -1
- package/skills/code/SKILL.md +388 -388
- package/skills/code/SKILL.tmpl +56 -56
- package/skills/debug/SKILL.md +390 -390
- package/skills/debug/SKILL.tmpl +60 -60
- package/skills/design-spec/SKILL.md +316 -316
- package/skills/design-spec/SKILL.tmpl +36 -36
- package/skills/discovery/SKILL.md +7 -547
- package/skills/discovery/SKILL.tmpl +7 -140
- package/skills/prd/SKILL.md +298 -394
- package/skills/prd/SKILL.tmpl +40 -151
- package/skills/setup-ai-first/SKILL.md +79 -79
- package/skills/setup-ai-first/SKILL.tmpl +27 -27
- package/skills/spec/SKILL.md +176 -176
- package/skills/spec/SKILL.tmpl +18 -18
- package/skills/test/SKILL.md +602 -602
- package/skills/test/SKILL.tmpl +44 -44
- package/steps/capture-lesson.md +44 -44
- package/steps/context-loader.md +174 -174
- package/steps/gate.md +54 -54
- package/steps/report-footer.md +52 -52
- package/steps/review-fanout.md +85 -87
- package/steps/spawn-agent.md +45 -45
- package/steps/trace-mirror.md +21 -21
- package/templates/architecture.template.md +37 -37
- package/templates/design-spec.template.md +77 -77
- package/templates/platform-guide.template.md +47 -47
- package/templates/prd.template.md +106 -231
- package/templates/product-definition.template.md +101 -88
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
# Context Loader —
|
|
1
|
+
# Context Loader — Nạp toàn bộ context dự án
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Thực hiện các bước theo đúng thứ tự. Lưu mọi thứ vào bộ nhớ trong suốt phiên làm việc của lệnh.
|
|
4
4
|
|
|
5
|
-
**
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
5
|
+
**Hướng dẫn ưu tiên (chống lost-in-middle):**
|
|
6
|
+
- Bước 1–2 là PROJECT-CONFIG — nạp trước, phân giải mọi path và metadata.
|
|
7
|
+
- Bước 3 là CRITICAL — kiến trúc + coding standards, là các sự thật ưu tiên cao nhất khi sinh nội dung.
|
|
8
|
+
- Bước 4 là SAFETY — quy tắc bảo vệ dữ liệu, thực thi ngầm suốt cả phiên.
|
|
9
|
+
- Bước 5–6 là DOMAIN KNOWLEDGE — thuật ngữ và định nghĩa entity.
|
|
10
|
+
- Bước 7 là WORKING MEMORY RECAP — chốt các sự thật quan trọng lên đầu bộ nhớ làm việc.
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Bước 1 — [PROJECT-CONFIG] Nạp project-context.yaml
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Đọc `.agent/project-context.yaml`. Trích xuất và lưu:
|
|
17
17
|
|
|
18
18
|
**Tech Stack:**
|
|
19
|
-
- `tech_stack.language` →
|
|
20
|
-
- `tech_stack.framework` →
|
|
21
|
-
- `tech_stack.build_tool` → build tool (
|
|
22
|
-
- `tech_stack.test_framework` → test framework (
|
|
23
|
-
- `tech_stack.database` → database (
|
|
24
|
-
- `tech_stack.module` →
|
|
19
|
+
- `tech_stack.language` → ngôn ngữ đang dùng (vd: Java 17, TypeScript, C#, Go)
|
|
20
|
+
- `tech_stack.framework` → framework đang dùng (vd: Spring Boot 3.2, Angular 17, .NET 8)
|
|
21
|
+
- `tech_stack.build_tool` → build tool (vd: Maven, npm, dotnet, go)
|
|
22
|
+
- `tech_stack.test_framework` → test framework (vd: JUnit 5 + Mockito, Jest, xUnit)
|
|
23
|
+
- `tech_stack.database` → database (vd: PostgreSQL, MySQL, MongoDB)
|
|
24
|
+
- `tech_stack.module` → module profile đang dùng (vd: java-spring, angular, dotnet, golang, context-engineering)
|
|
25
25
|
|
|
26
26
|
**Conventions:**
|
|
27
|
-
- `conventions.build_command` →
|
|
28
|
-
- `conventions.test_command` →
|
|
29
|
-
- `conventions.service_run` →
|
|
30
|
-
- `conventions.ticket_prefix` → ticket ID
|
|
27
|
+
- `conventions.build_command` → cách compile/build
|
|
28
|
+
- `conventions.test_command` → cách chạy test
|
|
29
|
+
- `conventions.service_run` → cách khởi động service
|
|
30
|
+
- `conventions.ticket_prefix` → tiền tố ticket ID (vd: PROJ, FEAT, UC)
|
|
31
31
|
|
|
32
32
|
**Domains:**
|
|
33
|
-
- `domains` →
|
|
34
|
-
|
|
35
|
-
**Paths (
|
|
36
|
-
- `paths.specs_dir` → spec
|
|
37
|
-
- `paths.refinement_dir` → findings/review
|
|
38
|
-
- `paths.qc_dir` → QC automation
|
|
39
|
-
- `paths.qc_skills_dir` →
|
|
40
|
-
- `paths.product_definitions_dir` → product
|
|
41
|
-
- `paths.domain_knowledge_dir` → domain knowledge
|
|
42
|
-
- `paths.business_dictionary` → path
|
|
43
|
-
- `paths.core_entities` → path
|
|
44
|
-
- `paths.tech_docs_dir` →
|
|
45
|
-
- `paths.trace_dir` →
|
|
46
|
-
|
|
47
|
-
|
|
33
|
+
- `domains` → danh sách các business domain đang hoạt động
|
|
34
|
+
|
|
35
|
+
**Paths (nếu có):**
|
|
36
|
+
- `paths.specs_dir` → gốc của spec artifact — PRD, BDD, tech-docs, design-spec. Cấu trúc: `{specs_dir}/{domain}/{prd-slug}/{prd.md | bdd/ | tech-docs/ | design-spec/}`
|
|
37
|
+
- `paths.refinement_dir` → thư mục output cho findings/review
|
|
38
|
+
- `paths.qc_dir` → gốc artifact QC automation (hiện ở top-level, mỗi UC một thư mục con: `{qc_dir}/{UC-ID}/`)
|
|
39
|
+
- `paths.qc_skills_dir` → nơi các lệnh qc-* nạp QC skill (mặc định bundled `.agent/skills/qc`; override sang repo/submodule riêng của team QC để bản nâng cấp framework không ghi đè)
|
|
40
|
+
- `paths.product_definitions_dir` → gốc product definition
|
|
41
|
+
- `paths.domain_knowledge_dir` → gốc domain knowledge
|
|
42
|
+
- `paths.business_dictionary` → path tới business-dictionary.md
|
|
43
|
+
- `paths.core_entities` → path tới core-entities.md
|
|
44
|
+
- `paths.tech_docs_dir` → gốc tài liệu kỹ thuật (gộp với specs_dir trong bố cục feature-package — tech-docs nằm dưới `{specs_dir}/{domain}/{prd-slug}/tech-docs/`)
|
|
45
|
+
- `paths.trace_dir` → thư mục trạng thái trace; cấu trúc: `.trace/{domain}/{prd-slug}/{UC-ID}.tsv`
|
|
46
|
+
|
|
47
|
+
Nếu không có section `paths`, dùng các giá trị mặc định:
|
|
48
48
|
- `specs_dir` = `specs`
|
|
49
49
|
- `refinement_dir` = `.agent/review`
|
|
50
50
|
- `qc_dir` = `docs`
|
|
@@ -56,184 +56,184 @@ If `paths` section is absent, use these defaults:
|
|
|
56
56
|
- `tech_docs_dir` = `specs`
|
|
57
57
|
- `trace_dir` = `.trace`
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
Lưu ý: Trong bố cục feature-package, `specs_dir` là gốc thống nhất. Mọi loại spec artifact (PRD, BDD, tech-docs, design-spec) đều nằm dưới `{specs_dir}/{domain}/{prd-slug}/`. `prd-slug` là tên folder feature-package, không phải một biến config riêng.
|
|
60
60
|
|
|
61
|
-
**
|
|
61
|
+
**Cách trích xuất `prd_slug` (đúng cho MỌI target file, bất kể độ sâu lồng nhau):** với một path target dạng `{specs_dir}/{domain}/{prd-slug}/...`, lấy **segment path đầu tiên sau `{specs_dir}/{domain}/`** — tức vị trí `{prd-slug}`. KHÔNG dùng folder cha trực tiếp của file, vì artifact BDD/tech-docs/design-spec lồng sâu hơn một hoặc hai cấp bên trong package. Ví dụ:
|
|
62
62
|
- `specs/payment/create-invoice/prd.md` → `prd_slug = create-invoice`
|
|
63
|
-
- `specs/payment/create-invoice/bdd/system/PAY-UC1.feature` → `prd_slug = create-invoice` *(
|
|
64
|
-
- `specs/payment/create-invoice/bdd/web/PAY-UC1.feature` → `prd_slug = create-invoice` *(
|
|
65
|
-
- `specs/payment/create-invoice/tech-docs/PAY-UC1-tech-design.md` → `prd_slug = create-invoice` *(
|
|
63
|
+
- `specs/payment/create-invoice/bdd/system/PAY-UC1.feature` → `prd_slug = create-invoice` *(KHÔNG phải `system`)*
|
|
64
|
+
- `specs/payment/create-invoice/bdd/web/PAY-UC1.feature` → `prd_slug = create-invoice` *(KHÔNG phải `web`)*
|
|
65
|
+
- `specs/payment/create-invoice/tech-docs/PAY-UC1-tech-design.md` → `prd_slug = create-invoice` *(KHÔNG phải `tech-docs`)*
|
|
66
66
|
- `specs/payment/create-invoice/design-spec/PAY-design-spec-web.md` → `prd_slug = create-invoice`
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
Mọi artifact cùng cấp của một feature (PRD, BDD của từng platform, tech-docs BE + FE, design-spec, và trace TSV) đều phân giải về **cùng một `prd_slug`** — nên một BDD **system** hay tech-doc **system/BE** được tổng hợp sẽ nằm chung package `{specs_dir}/{domain}/{prd-slug}/` với các artifact web/app mà nó được suy ra từ đó.
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
Nếu `tech_stack.module` được đặt, đồng thời nạp `.agent/modules/{module}/stack-profile.yaml` nếu file tồn tại.
|
|
71
71
|
|
|
72
72
|
---
|
|
73
73
|
|
|
74
|
-
##
|
|
74
|
+
## Bước 1.5 — [SERVICE ROUTING] Phân giải path service (chế độ umbrella)
|
|
75
75
|
|
|
76
|
-
*
|
|
76
|
+
*Bỏ qua hoàn toàn bước này nếu `setup.mode` không phải `"umbrella"` và không có section `services` trong project-context.yaml.*
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
Nếu có section `services`:
|
|
79
79
|
|
|
80
|
-
**1.
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
*(
|
|
84
|
-
-
|
|
80
|
+
**1. Phát hiện active domain** (theo thứ tự ưu tiên):
|
|
81
|
+
- Đọc `@trace.domain` từ frontmatter của target file (nếu Gate đã nạp một target file)
|
|
82
|
+
- Trích xuất từ path target file: `domain` = segment đầu tiên sau base path `specs_dir`; `prd_slug` = segment kế tiếp (folder feature-package). Điều này đúng ở mọi độ sâu target — xem quy tắc trích xuất `prd_slug` ở Bước 1.
|
|
83
|
+
*(vd: `specs/user/create-account/prd.md` **và** `specs/user/create-account/bdd/system/UC1.feature` đều → domain = `user`, prd_slug = `create-account`)*
|
|
84
|
+
- Nếu `$ARGUMENTS` chứa một path, trích xuất segment domain sau `specs_dir`
|
|
85
85
|
|
|
86
|
-
**2. Route
|
|
87
|
-
- Override `paths.specs_dir` → `services.{domain}.specs_dir` — **
|
|
88
|
-
- Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
86
|
+
**2. Route tới service** — nếu active domain khớp với một key trong `services`:
|
|
87
|
+
- Override `paths.specs_dir` → `services.{domain}.specs_dir` — **chỉ khi `setup.spec_source` KHÔNG được đặt.** Khi `spec_source` ĐƯỢC đặt, MỌI BDD (web/app/**system**) là artifact dùng chung liên team → để bước 4 route sang spec repo; KHÔNG pin theo service ở đây.
|
|
88
|
+
- Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **chỉ khi `setup.spec_source` KHÔNG được đặt.** Khi `spec_source` ĐƯỢC đặt, tech-design (API contract) là artifact liên team và phải nằm trong spec repo dùng chung (xử lý ở bước 4), nên để bước 4 route `tech_docs_dir` — KHÔNG pin theo service ở đây.
|
|
89
|
+
- Lưu `active_service` = `services.{domain}.path`
|
|
90
|
+
- Lưu `active_service_module` = `services.{domain}.module`
|
|
91
|
+
- Nếu service có `module` riêng → dùng nó làm `active_module` (override `tech_stack.module`)
|
|
92
92
|
|
|
93
|
-
**3. Fallback** —
|
|
94
|
-
-
|
|
95
|
-
-
|
|
93
|
+
**3. Fallback** — nếu không phát hiện được domain hoặc không có service key khớp:
|
|
94
|
+
- Giữ path mặc định từ Bước 1
|
|
95
|
+
- Đặt `active_service = unresolved`
|
|
96
96
|
|
|
97
|
-
**4.
|
|
98
|
-
- Override `paths.specs_dir` → `{spec_source}/specs` — **
|
|
99
|
-
- Override `paths.tech_docs_dir` → `{spec_source}/specs` — **
|
|
97
|
+
**4. Tự động override theo spec source** — nếu `setup.spec_source` được đặt VÀ path tương ứng chưa được set tường minh trong `paths:`:
|
|
98
|
+
- Override `paths.specs_dir` → `{spec_source}/specs` — **luôn khi `spec_source` được đặt.** Mọi spec artifact (PRD, BDD, tech-docs, design-spec) nằm dưới gốc spec thống nhất trong spec repo dùng chung theo bố cục feature-package: `{spec_source}/specs/{domain}/{prd-slug}/`. Mọi umbrella (FE/App/BE) đều đọc từ đây. *(`specs/` theo service chỉ khi không có `spec_source`.)*
|
|
99
|
+
- Override `paths.tech_docs_dir` → `{spec_source}/specs` — **luôn khi `spec_source` được đặt** (bước 2 không còn pin tech-docs theo service trong trường hợp này). Tech-docs nằm tại `{spec_source}/specs/{domain}/{prd-slug}/tech-docs/`. Tech-design CHÍNH LÀ API contract liên team: BE viết ở đây, FE/App đọc nó từ cùng spec submodule tại `/generate-code --phase=integration`. *(tech-docs theo service chỉ xảy ra khi không có `spec_source` — repo BE thuần đa-service không có spec module dùng chung.)*
|
|
100
100
|
- Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
|
|
101
101
|
- Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
|
|
102
102
|
- Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
|
|
103
103
|
- Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
|
|
104
104
|
- Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
|
|
105
105
|
- Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
|
|
106
|
-
- Override `paths.trace_dir` → `{spec_source}/.trace` — **
|
|
106
|
+
- Override `paths.trace_dir` → `{spec_source}/.trace` — **luôn khi `spec_source` được đặt.** Trace TSV được gộp vào spec repo (một nơi authoritative duy nhất, không tách theo service) để PM/PO có một chỗ duy nhất quản lý trạng thái. Cấu trúc bên trong: `.trace/{domain}/{prd-slug}/{UC-ID}.tsv`. Các lệnh phía code (`/generate-code`, `/dev-run-test`, `/qc-run-test`) chạy từ `service_root` nhưng **ghi trace row của chúng vào `{spec_source}/.trace/{domain}/{prd-slug}/`** — giống như chúng đã push `feedback/` vào đó. *(`.trace` theo service chỉ khi không có `spec_source`.)*
|
|
107
107
|
|
|
108
|
-
> **
|
|
108
|
+
> **Vì sao đặt dưới `spec_source`:** PRD, BDD, tech-docs, design-spec, domain knowledge, feedback của tester, **và trạng thái coverage `.trace/`** đều là **artifact liên team** — chúng nằm trong **spec repo dùng chung** theo bố cục feature-package để mọi umbrella (FE/App/BE) và PM đọc từ một nguồn qua `/sync`. Trong bố cục feature-package, một folder `specs/{domain}/{prd-slug}/` gom tất cả loại artifact của một PRD, giúp spec repo tự đủ và dễ điều hướng theo feature. Service submodule chỉ chứa **code** (+ tooling build/test). `.trace/` và `feedback/` là khu vực **ghi** của dev/QC trong spec repo. Ở chế độ single-service (không có `spec_source`), mọi thứ mặc định dưới gốc repo — vẫn là một repo.
|
|
109
109
|
|
|
110
110
|
---
|
|
111
111
|
|
|
112
|
-
##
|
|
112
|
+
## Bước 1.6 — [SERVICE CONVENTIONS] Nạp convention riêng của service (chế độ umbrella)
|
|
113
113
|
|
|
114
|
-
*
|
|
114
|
+
*Bỏ qua hoàn toàn bước này nếu `active_service` là `"unresolved"` hoặc context ở chế độ single-service.*
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
Khi `active_service` đã được phân giải thành một path thật ở Bước 1.5 (vd: `user-service/`):
|
|
117
117
|
|
|
118
|
-
**1.
|
|
118
|
+
**1. Định vị config của service** — thử theo thứ tự ưu tiên:
|
|
119
119
|
- `{active_service}/.agent/project-context.yaml`
|
|
120
120
|
- `{active_service}/project-context.yaml`
|
|
121
121
|
|
|
122
|
-
**2.
|
|
122
|
+
**2. Nếu tìm thấy, override bằng giá trị riêng của service:**
|
|
123
123
|
|
|
124
|
-
|
|
|
124
|
+
| Biến | Nguồn |
|
|
125
125
|
|----------|--------|
|
|
126
|
-
| `conventions.test_command` |
|
|
127
|
-
| `conventions.build_command` |
|
|
128
|
-
| `paths.trace_dir` | **
|
|
129
|
-
| `paths.specs_dir` | **
|
|
126
|
+
| `conventions.test_command` | `conventions.test_command` của service |
|
|
127
|
+
| `conventions.build_command` | `conventions.build_command` của service |
|
|
128
|
+
| `paths.trace_dir` | **Nếu `spec_source` được đặt → giữ route spec-repo của bước 4 (`{spec_source}/.trace`); bỏ qua mọi `trace_dir` cấp service.** Chỉ khi không có `spec_source`: `{active_service}/{service paths.trace_dir}` (mặc định `{active_service}/.trace`). |
|
|
129
|
+
| `paths.specs_dir` | **Nếu `spec_source` được đặt → giữ route spec-repo của bước 4 (`{spec_source}/specs`); bỏ qua mọi `specs_dir` cấp service** (mọi spec artifact đều liên team, không bao giờ theo service ở chế độ này). Chỉ khi không có `spec_source`: `{active_service}/{service paths.specs_dir}` nếu được set, else dùng override ở Bước 1.5. |
|
|
130
130
|
|
|
131
|
-
**3.
|
|
132
|
-
-
|
|
133
|
-
- **
|
|
131
|
+
**3. Lưu** `service_root = {active_service}` làm mốc thư mục làm việc cho mọi lệnh phía sau:
|
|
132
|
+
- Các lệnh shell (`/dev-run-test`, `/dev-gen-test`) chạy **bên trong** `service_root`
|
|
133
|
+
- **File source/test** được ghi tương đối với `service_root`; **trace TSV** được ghi vào `{paths.trace_dir}` (là spec repo khi `spec_source` được đặt — một thao tác ghi liên-repo, commit/push vào spec submodule giống như `feedback/`).
|
|
134
134
|
|
|
135
|
-
**4.
|
|
135
|
+
**4. Nếu không tìm thấy config của service** — giữ mặc định umbrella, vẫn set `service_root = {active_service}` (luôn cần mốc path kể cả khi không có config override).
|
|
136
136
|
|
|
137
137
|
---
|
|
138
138
|
|
|
139
|
-
##
|
|
139
|
+
## Bước 2 — [PROJECT-CONFIG] Nạp module stack profile (có điều kiện)
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
Merge framework
|
|
143
|
-
|
|
141
|
+
Nếu `tech_stack.module` được đặt, đọc `.agent/modules/{module}/stack-profile.yaml`.
|
|
142
|
+
Merge các convention riêng của framework (layer pattern, test pattern, quy tắc đặt tên) vào context đã nạp.
|
|
143
|
+
Nếu file không tồn tại → bỏ qua âm thầm.
|
|
144
144
|
|
|
145
145
|
---
|
|
146
146
|
|
|
147
|
-
##
|
|
147
|
+
## Bước 3 — [CRITICAL] Nạp CLAUDE.md (phân tầng: root + service overlay)
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
*Đây là context ưu tiên cao nhất — nó định nghĩa CÁCH viết code và tài liệu cho dự án này.*
|
|
150
150
|
|
|
151
|
-
CLAUDE.md
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
CLAUDE.md được nạp theo **hai tầng** để các quy tắc toàn-umbrella và kiến trúc/coding standards
|
|
152
|
+
riêng của service kết hợp đúng cách. Agent luôn đứng ở gốc umbrella, nhưng code triển khai nằm
|
|
153
|
+
trong một service submodule với stack, kiến trúc, và convention RIÊNG của nó — nên CLAUDE.md của
|
|
154
|
+
service phải thắng khi sinh code.
|
|
155
155
|
|
|
156
|
-
**
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
**Tầng 1 — [BASE] Root CLAUDE.md (toàn umbrella).**
|
|
157
|
+
Đọc `CLAUDE.md` ở gốc repo. Coi nội dung của nó là **nền tảng dùng chung** cho cả umbrella —
|
|
158
|
+
git convention, tư thế bảo vệ dữ liệu, quy tắc xuyên suốt, và (ở chế độ single-service) là
|
|
159
|
+
kiến trúc + coding standards duy nhất của dự án.
|
|
160
160
|
|
|
161
|
-
**
|
|
162
|
-
*
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
Overlay
|
|
166
|
-
coding standards,
|
|
167
|
-
(
|
|
161
|
+
**Tầng 2 — [OVERLAY] Service CLAUDE.md (chỉ chế độ umbrella).**
|
|
162
|
+
*Chỉ chạy nếu `service_root` đã được set ở Bước 1.6 (tức đã route tới một service thật).*
|
|
163
|
+
Đọc `{service_root}/CLAUDE.md`. File này định nghĩa kiến trúc + coding standards của **stack
|
|
164
|
+
thực sự đang được triển khai** (vd: `user-service` = java-spring, `web` = nextjs).
|
|
165
|
+
Overlay nó lên trên Tầng 1: **khi có xung đột, giá trị của service THẮNG** cho kiến trúc,
|
|
166
|
+
coding standards, và error handling. Các giá trị Tầng 1 mà service không định nghĩa lại
|
|
167
|
+
(vd: git convention, banned pattern dùng chung toàn tổ chức) vẫn có hiệu lực.
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
Từ kết quả **đã merge**, trích xuất và lưu:
|
|
170
170
|
|
|
171
|
-
- **§1 Project Overview** →
|
|
172
|
-
- **§2 Architecture** → layer
|
|
173
|
-
- **§3 Coding Standards** →
|
|
174
|
-
- **§5 Error Handling** → exception
|
|
175
|
-
- **§7 Git Conventions** →
|
|
171
|
+
- **§1 Project Overview** → tên dự án, ngôn ngữ, framework, lệnh build/test, domains
|
|
172
|
+
- **§2 Architecture** → thứ tự layer (vd: Controller → Facade → Service → Repository), quy tắc kiến trúc — *service overlay thắng*
|
|
173
|
+
- **§3 Coding Standards** → quy tắc đặt tên (class, method), kiểu response wrapper, pattern bị cấm — *service overlay thắng*
|
|
174
|
+
- **§5 Error Handling** → kiểu exception, mapping HTTP status code, tên class not-found exception — *service overlay thắng*
|
|
175
|
+
- **§7 Git Conventions** → pattern đặt tên branch, format commit message — *lấy theo root trừ khi service định nghĩa lại*
|
|
176
176
|
|
|
177
|
-
**
|
|
178
|
-
-
|
|
179
|
-
-
|
|
180
|
-
-
|
|
181
|
-
-
|
|
177
|
+
**Quy tắc phân giải:**
|
|
178
|
+
- Nếu cả hai tầng tồn tại → merge như trên; ghi `claude_md_source = root + {service_root}`.
|
|
179
|
+
- Nếu chỉ có service overlay (không có root CLAUDE.md) → dùng file service một mình; `claude_md_source = {service_root}`.
|
|
180
|
+
- Nếu `service_root` được set nhưng `{service_root}/CLAUDE.md` **thiếu** → fallback về root CLAUDE.md và gắn cờ ⚠️ trong recap Bước 7 (service không có định nghĩa kiến trúc/coding-standards — việc sinh code sẽ dùng mặc định umbrella, có thể sai stack).
|
|
181
|
+
- Nếu cả hai đều không tồn tại → ghi nhận CLAUDE.md thiếu và tiếp tục chỉ với dữ liệu từ project-context.yaml.
|
|
182
182
|
|
|
183
183
|
---
|
|
184
184
|
|
|
185
|
-
##
|
|
185
|
+
## Bước 4 — [SAFETY] Nạp quy tắc bảo vệ dữ liệu
|
|
186
186
|
|
|
187
|
-
|
|
187
|
+
Đọc `.agent/rules/data-protection.md` (hoặc `rules/data-protection.md` từ bản cài đặt framework).
|
|
188
188
|
|
|
189
|
-
|
|
189
|
+
Lưu các pattern file nhạy cảm — bạn **tuyệt đối không** đọc, ghi, hiển thị, hay tham chiếu nội dung từ các file khớp những pattern đó trong suốt cả phiên.
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
Nếu cả hai file đều không tồn tại → áp dụng mặc định built-in: không bao giờ truy cập `.env*`, `*.key`, `*.pem`, `*secret*`, `*password*`, `*credential*`.
|
|
192
192
|
|
|
193
193
|
---
|
|
194
194
|
|
|
195
|
-
##
|
|
195
|
+
## Bước 5 — [DOMAIN] Nạp Business Dictionary (có điều kiện)
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
Kiểm tra file business dictionary có tồn tại không (dùng `paths.business_dictionary` đã phân giải ở Bước 1).
|
|
198
198
|
|
|
199
|
-
|
|
200
|
-
- **Canonical Terms** →
|
|
201
|
-
- **Banned Terms** →
|
|
202
|
-
- **Status / Enum Registry** →
|
|
199
|
+
Nếu tồn tại, đọc và trích xuất:
|
|
200
|
+
- **Canonical Terms** → danh sách đầy đủ các thuật ngữ chuẩn và định nghĩa
|
|
201
|
+
- **Banned Terms** → danh sách đầy đủ các thuật ngữ bị cấm và bản thay thế chuẩn
|
|
202
|
+
- **Status / Enum Registry** → các giá trị enum được phép theo từng entity
|
|
203
203
|
|
|
204
|
-
|
|
205
|
-
-
|
|
206
|
-
-
|
|
204
|
+
Lưu danh sách banned term để **thực thi chủ động** suốt phiên làm việc của lệnh:
|
|
205
|
+
- Khi sinh bất kỳ văn bản nào (PRD, BDD, comment code, tech docs), kiểm tra không có banned term nào xuất hiện
|
|
206
|
+
- Tự động thay banned term bằng bản chuẩn tương đương
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
Nếu file không tồn tại → bỏ qua âm thầm. Không cảnh báo hay chặn.
|
|
209
209
|
|
|
210
210
|
---
|
|
211
211
|
|
|
212
|
-
##
|
|
212
|
+
## Bước 6 — [DOMAIN] Nạp Core Entities (có điều kiện)
|
|
213
213
|
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
Kiểm tra file core entities có tồn tại tại `paths.core_entities` không (đã phân giải ở Bước 1).
|
|
215
|
+
Path mặc định: `specs/domain-knowledge/core-entities.md`.
|
|
216
216
|
|
|
217
|
-
|
|
218
|
-
- **Entity catalog** →
|
|
219
|
-
- **Field name registry** →
|
|
220
|
-
- **Relationship map** →
|
|
217
|
+
Nếu tồn tại, đọc và lưu:
|
|
218
|
+
- **Entity catalog** → với mỗi entity: tên, mục đích, service sở hữu, các field chính (tên + kiểu), business invariant, và quan hệ
|
|
219
|
+
- **Field name registry** → tên field chuẩn dùng trong code và tài liệu được sinh ra
|
|
220
|
+
- **Relationship map** → cách các entity liên hệ với nhau (1:N, N:N, embedded, v.v.)
|
|
221
221
|
|
|
222
|
-
**
|
|
223
|
-
-
|
|
224
|
-
-
|
|
225
|
-
-
|
|
222
|
+
**Cách dùng catalog này:**
|
|
223
|
+
- Khi sinh code: dùng tên field, kiểu, và quan hệ định nghĩa ở đây — KHÔNG suy đoán từ code có sẵn
|
|
224
|
+
- Khi sinh PRD/BDD: tham chiếu tên entity từ catalog này để nhất quán
|
|
225
|
+
- Khi sinh tech-docs: dùng catalog này làm nguồn chân lý cho định nghĩa entity
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
Nếu file không tồn tại → bỏ qua âm thầm.
|
|
228
228
|
|
|
229
229
|
---
|
|
230
230
|
|
|
231
|
-
##
|
|
231
|
+
## Bước 6.5 — [PLATFORM] Suy ra active_module và platform_type
|
|
232
232
|
|
|
233
|
-
|
|
233
|
+
Dùng `tech_stack.module` đã nạp ở Bước 1, suy ra và lưu hai biến để mọi lệnh phía sau dùng:
|
|
234
234
|
|
|
235
235
|
```
|
|
236
|
-
active_module = tech_stack.module (
|
|
236
|
+
active_module = tech_stack.module (vd: "java-spring", "react", "flutter")
|
|
237
237
|
```
|
|
238
238
|
|
|
239
239
|
| `platform_type` | Modules |
|
|
@@ -242,66 +242,66 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
|
|
|
242
242
|
| `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
|
|
243
243
|
| `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
|
|
244
244
|
|
|
245
|
-
|
|
245
|
+
Nếu `tech_stack.module` rỗng hoặc không nhận diện được → set `platform_type = "unknown"` và gắn cờ ⚠️ trong recap Bước 7.
|
|
246
246
|
|
|
247
|
-
|
|
247
|
+
Hai biến này (`active_module`, `platform_type`) là nguồn chuẩn cho mọi logic rẽ nhánh trong các lệnh cần hành vi riêng theo platform (dev-gen-test, debug, fix-bug, dev-smoke-test).
|
|
248
248
|
|
|
249
249
|
---
|
|
250
250
|
|
|
251
|
-
##
|
|
251
|
+
## Bước 6.7 — [GUARDRAILS] Nạp Project Lessons (có điều kiện)
|
|
252
252
|
|
|
253
|
-
*
|
|
254
|
-
|
|
253
|
+
*Các lỗi tích luỹ mà AI không được lặp lại trong dự án này. Chúng được bổ sung dần qua `/learn`
|
|
254
|
+
hoặc được chấp nhận trong `/review-code`, `/fix-bug`, `/debug`.*
|
|
255
255
|
|
|
256
|
-
|
|
257
|
-
-
|
|
258
|
-
- Else
|
|
259
|
-
-
|
|
256
|
+
Phân giải path file lessons:
|
|
257
|
+
- Dùng `paths.lessons_file` nếu được set (có thể bị service override ở chế độ umbrella, Bước 1.6)
|
|
258
|
+
- Else mặc định `specs/domain-knowledge/lessons-learned.md`
|
|
259
|
+
- Ở chế độ umbrella/service (khi `service_root` được set), nếu `paths.lessons_file` chưa set, mặc định `{service_root}/.agent/project-lessons.md`
|
|
260
260
|
|
|
261
|
-
|
|
262
|
-
-
|
|
263
|
-
-
|
|
264
|
-
-
|
|
261
|
+
Nếu file tồn tại, đọc và lưu TẤT CẢ lesson làm **GUARDRAIL ĐANG HOẠT ĐỘNG** cho phiên:
|
|
262
|
+
- Coi **Rule** của mỗi lesson là ràng buộc cứng — cùng mức ưu tiên với coding standards trong CLAUDE.md (Bước 3).
|
|
263
|
+
- Trước khi sinh hoặc sửa bất kỳ artifact nào (PRD, BDD, tech-doc, code, test), đối chiếu output với mọi lesson có `category` khớp lệnh hiện tại VÀ `scope` khớp target (domain / file).
|
|
264
|
+
- Nếu output sinh ra vi phạm một lesson → sửa **trước khi** trình bày, và ghi rõ lesson nào (`L-NNN`) đã được áp dụng.
|
|
265
265
|
|
|
266
|
-
|
|
266
|
+
Nếu file không tồn tại → bỏ qua âm thầm (chưa có lesson nào được ghi nhận).
|
|
267
267
|
|
|
268
268
|
---
|
|
269
269
|
|
|
270
|
-
##
|
|
270
|
+
## Bước 7 — [RECAP] Working Memory Recap (chống lost-in-middle)
|
|
271
271
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
(recency
|
|
272
|
+
Sau khi nạp toàn bộ context, tổng hợp và xuất một khối tóm tắt gọn.
|
|
273
|
+
Recap này đảm bảo các sự thật quan trọng nhất được nêu ở CUỐI quá trình nạp context
|
|
274
|
+
(hiệu ứng recency — tươi mới nhất trong bộ nhớ làm việc khi bắt đầu task).
|
|
275
275
|
|
|
276
|
-
|
|
276
|
+
Xuất đúng khối này:
|
|
277
277
|
```
|
|
278
278
|
[CTX LOADED]
|
|
279
279
|
Stack : {language} / {framework} / {database}
|
|
280
280
|
Platform : {active_module} ({platform_type})
|
|
281
|
-
Layers : {
|
|
282
|
-
CLAUDE.md : {root + {service_root} | {service_root}
|
|
281
|
+
Layers : {thứ tự layer từ CLAUDE.md §2 đã merge, vd: Controller → Facade → Service → Repository}
|
|
282
|
+
CLAUDE.md : {root + {service_root} | chỉ {service_root} | chỉ root | ⚠️ service overlay THIẾU — dùng root | missing}
|
|
283
283
|
Ticket : {ticket_prefix}-
|
|
284
284
|
Dict : {loaded — N canonical terms, M banned terms | missing}
|
|
285
285
|
Entities : {loaded — EntityA, EntityB, EntityC | missing}
|
|
286
|
-
Lessons : {loaded — N guardrails |
|
|
286
|
+
Lessons : {loaded — N guardrails | chưa có}
|
|
287
287
|
Service : {active_service} ({active_service_module}) | single-service
|
|
288
|
-
Svc Root : {service_root} — conventions + trace_dir
|
|
289
|
-
Status : {FULL | PARTIAL —
|
|
288
|
+
Svc Root : {service_root} — đã nạp conventions + trace_dir từ config service | —
|
|
289
|
+
Status : {FULL | PARTIAL — thiếu: CLAUDE.md / business-dict / core-entities | MINIMAL}
|
|
290
290
|
```
|
|
291
291
|
|
|
292
|
-
|
|
292
|
+
Nếu bất kỳ file CRITICAL nào thiếu (CLAUDE.md), gắn cờ rõ ràng để người dùng quyết định có tiếp tục hay không.
|
|
293
293
|
|
|
294
294
|
---
|
|
295
295
|
|
|
296
|
-
##
|
|
296
|
+
## Hoàn tất nạp Context
|
|
297
297
|
|
|
298
|
-
|
|
299
|
-
-
|
|
300
|
-
-
|
|
301
|
-
- Coding standards
|
|
302
|
-
-
|
|
303
|
-
-
|
|
304
|
-
- Entity catalog (field
|
|
305
|
-
-
|
|
298
|
+
Sau khi hoàn thành tất cả các bước, bạn đã nạp:
|
|
299
|
+
- Định danh dự án, tech stack, convention module
|
|
300
|
+
- Quy tắc kiến trúc và thứ tự layer ← **[CRITICAL — giữ trong bộ nhớ làm việc]**
|
|
301
|
+
- Coding standards và quy tắc đặt tên ← **[CRITICAL — giữ trong bộ nhớ làm việc]**
|
|
302
|
+
- Quy tắc bảo vệ dữ liệu (pattern file nhạy cảm không bao giờ truy cập)
|
|
303
|
+
- Quy tắc thuật ngữ kèm danh sách banned term ← **[DOMAIN — áp dụng cho mọi từ được sinh ra]**
|
|
304
|
+
- Entity catalog (tên field, kiểu, invariant) ← **[DOMAIN — dùng khi sinh code]**
|
|
305
|
+
- Toàn bộ path đã cấu hình
|
|
306
306
|
|
|
307
|
-
|
|
307
|
+
Tiếp tục sang bước kế tiếp của lệnh đang gọi.
|