spec-lite 1.0.2 → 1.1.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.
@@ -60,18 +60,24 @@ Nếu integration đã có `tech.md` → hỏi trước khi tiếp tục:
60
60
 
61
61
  Load các file sau:
62
62
 
63
- - `specs/integrations/{slug}/spec.md` — đọc toàn bộ: Problem Statement, Requirements, Acceptance Criteria, Out of Scope
63
+ - `specs/integrations/{slug}/spec.md` — đọc toàn bộ + frontmatter (`features`, `components`)
64
64
  - `specs/main/sad.md` — đọc Tech Stack và Architectural Guardrails
65
- - `specs/main/domain.md` — đọc EntitiesBusiness Rules
65
+ - `specs/main/domain.md` — đọc GlossaryShared Entities
66
+ - `specs/main/component/{C-XXX}-{slug}/cdd.md` — cho mỗi component trong frontmatter `components` (nếu cdd.md tồn tại)
67
+ - `specs/main/feature/{F-XXX}-{slug}/fdd.md` — cho mỗi feature trong frontmatter `features` (nếu fdd.md tồn tại)
66
68
 
67
69
  Tóm tắt context và surface assumptions:
68
70
 
69
71
  ```
70
72
  TỪ SPEC & SAD TÔI HIỂU:
71
73
  - Integration: {title}
74
+ - Features liên quan: {từ frontmatter — F-XXX, ...}
75
+ - Components bị touched: {từ frontmatter — C-XXX, ...}
72
76
  - Yêu cầu chính: {tóm tắt requirements từ spec.md}
73
77
  - Tech stack: {từ sad.md}
74
- - Entities liên quan: {từ domain.md}
78
+ - Shared entities liên quan: {từ domain.md}
79
+ - Component design hiện tại: {tóm tắt từ cdd.md(s) — bỏ qua nếu chưa tồn tại}
80
+ - Inter-component flow hiện tại: {tóm tắt từ fdd.md(s) — bỏ qua nếu chưa tồn tại}
75
81
  - Guardrails cần tuân theo: {list GUARD-XXX từ sad.md}
76
82
 
77
83
  ASSUMPTIONS TÔI ĐANG ĐẶT RA:
@@ -119,29 +125,56 @@ Tổng hợp và viết draft `tech.md`:
119
125
 
120
126
  **Cấu trúc file**: dùng `.claude/templates/integrations/tech-template.md` làm skeleton, điền nội dung từ interview vào.
121
127
 
122
- **Cascade Proposals** — điền theo hướng dẫn sau:
128
+ **Cascade Proposals** — agent đề xuất delta cho main artifacts theo các targets sau (chỉ điền nếu thực sự có thay đổi, không thì ghi "Không có thay đổi đề xuất."):
123
129
 
124
130
  ### sad.md
125
131
 
126
- {Đề xuất cập nhật nếu phát hiện quyết định kiến trúc mới, tech stack thay đổi, hoặc guardrail mới cần thêm. Hoặc "Không có thay đổi đề xuất."}
132
+ Đề xuất cập nhật nếu integration này:
133
+ - Thêm cross-cutting concern mới (logging strategy, caching, ...)
134
+ - Thay đổi tech stack
135
+ - Thêm guardrail mới
127
136
 
128
137
  ### domain.md
129
138
 
130
- {Đề xuất cập nhật nếu phát hiện entity hoặc business rule mới trong quá trình thiết kế. Hoặc "Không có thay đổi đề xuất."}
139
+ Đề xuất cập nhật nếu integration này:
140
+ - Thay đổi shared entity (entity được dùng bởi 2+ component)
141
+ - Thêm shared entity mới phát sinh từ thiết kế kỹ thuật
131
142
 
132
- ### fdd.md
143
+ ### component/{C-XXX}-{component-name}/cdd.md
133
144
 
134
- {Một trong hai:}
145
+ Liệt kê **tất cả** components bị touched trong frontmatter và đánh giá từng cái:
135
146
 
136
- **Tạo mới** `specs/main/features/{feature-id}-{feature-slug}/fdd.md`
137
- - Dùng khi feature chưa fdd.md
138
- - Thư mục theo convention: `{number}-{feature-slug}` (ví dụ: `001-authentication`)
139
- - Nội dung đề xuất: {tóm tắt Module Structure, Data Flow, Interfaces từ tech.md}
147
+ | Component | cdd.md | Đề xuất |
148
+ | --- | --- | --- |
149
+ | C-001 auth | tồn tại | **Cập nhật** — thêm module RateLimiter, đổi storage strategy cho session |
150
+ | C-003 payment | chưa | **Tạo mới** full cdd skeleton |
140
151
 
141
- **Cập nhật** `specs/main/features/{feature-id}-{feature-slug}/fdd.md`
142
- - Dùng khi fdd.md đã tồn tại, ghi rõ thay đổi cụ thể cần thêm/sửa
152
+ Với từng component có đề xuất:
143
153
 
144
- {Hoặc "Không liên quan" nếu integration không gắn với feature cụ thể nào trong prd.md.}
154
+ **Tạo mới** `specs/main/component/{C-XXX}-{component-slug}/cdd.md`
155
+ - Dùng khi component này được giới thiệu lần đầu trong integration (cascade từ spec.md đã đề xuất tạo crd, giờ tech.md đề xuất tạo cdd)
156
+ - Nội dung: Module Structure, Internal Data Flow, Storage & Persistence, Internal Interfaces, Technical Decisions
157
+
158
+ **Cập nhật** `specs/main/component/{C-XXX}-{component-slug}/cdd.md`
159
+ - Khi cdd.md đã tồn tại và integration thay đổi internal design
160
+
161
+ ### feature/{F-XXX}-{feature-name}/fdd.md
162
+
163
+ Liệt kê **tất cả** features liên quan trong frontmatter và đánh giá:
164
+
165
+ | Feature | fdd.md | Đề xuất |
166
+ | --- | --- | --- |
167
+ | F-001 — Checkout | tồn tại | **Cập nhật** — thêm sequence khi payment fail |
168
+ | F-002 — Refund | chưa có | **Tạo mới** |
169
+
170
+ **Tạo mới** `specs/main/feature/{F-XXX}-{feature-slug}/fdd.md`
171
+ - Khi feature gắn với integration nhưng chưa có fdd.md
172
+ - Nội dung: Inter-component data flow, Orchestration, Cross-component invariants — từ tech.md (chỉ phần inter-component, không lặp internal design của component)
173
+
174
+ **Cập nhật** `specs/main/feature/{F-XXX}-{feature-slug}/fdd.md`
175
+ - Khi fdd.md đã tồn tại, ghi rõ thay đổi flow nào
176
+
177
+ Bỏ block fdd.md nếu integration không gắn với feature nào (`features: []`).
145
178
  ```
146
179
 
147
180
  Hiển thị draft cho user xem — **chưa ghi file**.
@@ -167,10 +200,10 @@ Thông báo kết quả:
167
200
  ✓ specs/integrations/{slug}/tech.md đã được tạo (status: draft)
168
201
 
169
202
  Bước tiếp theo:
170
- - Review và approve tech.md
203
+ - Review tech.md apply Cascade Proposals (nếu có) vào main artifacts thủ công
204
+ - Approve tech.md (đổi status: draft → approved)
171
205
  - /plan → tạo plan.md và todo.md cho integration này
172
- - Sau khi done: đổi status F-XXX trong prd.md thành DONE
173
- - Nếu Cascade Proposals có thay đổi → chạy /spec-domain hoặc /spec-sad
206
+ - Sau khi tất cả tasks done: đổi status F-XXX trong prd.md thành DONE
174
207
  ```
175
208
 
176
209
  ---
@@ -3,6 +3,7 @@ id: "{id}"
3
3
  slug: "{slug}"
4
4
  title: "{title}"
5
5
  features: []
6
+ components: []
6
7
  status: draft
7
8
  created: {YYYY-MM-DD}
8
9
  referenced_by:
@@ -3,6 +3,7 @@ id: "{id}"
3
3
  slug: "{slug}"
4
4
  title: "{title}"
5
5
  features: []
6
+ components: []
6
7
  status: draft
7
8
  created: {YYYY-MM-DD}
8
9
  referenced_by:
@@ -12,36 +13,51 @@ referenced_by:
12
13
 
13
14
  ## Context
14
15
 
15
- <!-- Tóm tắt ngắn các thông tin quan trọng từ context đã load (prd.md, domain.md, frd.md), để file self-contained -->
16
+ <!-- Tóm tắt ngắn các thông tin quan trọng từ context đã load (prd.md, domain.md, frd.md, crd.md), để file self-contained -->
16
17
 
17
18
  ## Problem Statement
18
19
 
19
20
  <!-- Vấn đề cần giải quyết là gì, tại sao cần giải quyết -->
20
21
 
21
- ## Features
22
+ ## Acceptance Criteria
22
23
 
23
- <!-- Lặp lại block Feature bên dưới cho mỗi feature thuộc spec này -->
24
+ <!--
25
+ Agent tự chọn cách tổ chức phù hợp với bản chất integration. Có thể mix nếu integration vừa thêm feature, vừa thay đổi component.
24
26
 
25
- ### Feature: {feature-name}
27
+ AC ID format:
28
+ - AC liên quan feature: `AC-{F_ID}-{seq}` — feature-scoped, cascade vào frd.md
29
+ - AC liên quan component: `AC-{C_ID}-{seq}` — component-scoped, cascade vào responsibilities/interface/rules của crd.md
26
30
 
27
- **Feature-level Acceptance Criteria:**
31
+ Format Given/When/Then. Bỏ block không dùng.
32
+ -->
28
33
 
29
- - [ ] AC-F-001
34
+ ### Feature: {feature-name} *(bỏ nếu integration không touch feature; lặp lại block cho mỗi feature)*
35
+
36
+ **Feature-level AC:**
37
+
38
+ - [ ] `AC-{F_ID}-{seq}`
30
39
  - **Given** {precondition}
31
40
  - **When** {action}
32
41
  - **Then** {expected outcome}
33
42
 
34
- <!-- Lặp lại block Story bên dưới cho mỗi user story thuộc feature này -->
35
-
36
- #### US-001: {Story title}
43
+ #### US-{F_ID}-{seq}: {Story title}
37
44
 
38
45
  **{Persona}** muốn **{hành động}** để **{mục tiêu}**.
39
46
 
40
47
  **Priority:** Must / Should / Could
41
48
 
42
- **Acceptance Criteria:**
49
+ **Story AC:**
43
50
 
44
- - [ ] AC-S-001
51
+ - [ ] `AC-{F_ID}-{seq}`
52
+ - **Given** {precondition}
53
+ - **When** {action}
54
+ - **Then** {expected outcome}
55
+
56
+ ### Component: `{C-XXX}-{component-name}` *(bỏ nếu integration không touch component; lặp lại block cho mỗi component)*
57
+
58
+ **AC theo responsibility / interface / rule:**
59
+
60
+ - [ ] `AC-{C_ID}-{seq}` — {responsibility / interface / rule mô tả}
45
61
  - **Given** {precondition}
46
62
  - **When** {action}
47
63
  - **Then** {expected outcome}
@@ -67,8 +83,14 @@ Không có thay đổi đề xuất.
67
83
 
68
84
  Không có thay đổi đề xuất.
69
85
 
86
+ ### component/{C-XXX}-{component-name}/crd.md
87
+
88
+ <!-- Lặp lại section này cho mỗi component liên quan đến spec. Bỏ nếu integration không touch component nào. -->
89
+
90
+ Không có thay đổi đề xuất.
91
+
70
92
  ### feature/{F-XXX}-{feature-name}/frd.md
71
93
 
72
- <!-- Lặp lại section này cho mỗi feature liên quan đến spec -->
94
+ <!-- Lặp lại section này cho mỗi feature liên quan đến spec. Bỏ nếu integration không gắn với feature nào. -->
73
95
 
74
96
  Không có thay đổi đề xuất.
@@ -3,6 +3,7 @@ id: "{id}"
3
3
  slug: "{slug}"
4
4
  title: "{title}"
5
5
  features: []
6
+ components: []
6
7
  status: draft
7
8
  created: {YYYY-MM-DD}
8
9
  referenced_by:
@@ -12,7 +13,7 @@ referenced_by:
12
13
 
13
14
  ## Context
14
15
 
15
- <!-- Tóm tắt ngắn các thông tin quan trọng từ context đã load (sad.md, domain.md, fdd.md, spec.md) -->
16
+ <!-- Tóm tắt ngắn các thông tin quan trọng từ context đã load (sad.md, domain.md, cdd.md, fdd.md, spec.md) -->
16
17
 
17
18
  ## Solution Overview
18
19
 
@@ -54,6 +55,14 @@ Không có thay đổi đề xuất.
54
55
 
55
56
  Không có thay đổi đề xuất.
56
57
 
58
+ ### component/{C-XXX}-{component-name}/cdd.md
59
+
60
+ <!-- Lặp lại section này cho mỗi component bị touched. Bỏ nếu integration không touch component nào. -->
61
+
62
+ Không có thay đổi đề xuất.
63
+
57
64
  ### feature/{F-XXX}-{feature-name}/fdd.md
58
65
 
66
+ <!-- Lặp lại section này cho mỗi feature liên quan. Bỏ nếu integration không gắn feature nào. -->
67
+
59
68
  Không có thay đổi đề xuất.
@@ -3,6 +3,7 @@ id: "{id}"
3
3
  slug: "{slug}"
4
4
  title: "{title}"
5
5
  features: []
6
+ components: []
6
7
  created: {YYYY-MM-DD}
7
8
  referenced_by:
8
9
  - conventions.md > 4. Integration Artifacts > 4.6 todo.md > Cấu trúc
@@ -0,0 +1,63 @@
1
+ ---
2
+ id: cdd-{component}
3
+ type: cdd
4
+ status: draft
5
+ owner: "{Tech Lead / Senior Dev}"
6
+ component_id: "{Component ID, ví dụ C-001}"
7
+ referenced_by:
8
+ - conventions.md > 3. Main Artifacts > 3.2 Component level > cdd.md > Cấu trúc
9
+ - skills/spec-tech/SKILL.md > Process > Cascade Proposals > component cdd.md
10
+ ---
11
+
12
+ # Component Design: {Component Name}
13
+
14
+ > File này mô tả **internal design** của component — cách nó được tổ chức bên trong.
15
+ >
16
+ > Vai trò, public interface, business rules nằm trong `crd.md`. Cross-cutting concerns (auth, logging, ...) nằm trong `sad.md`.
17
+
18
+ ## Module Structure
19
+
20
+ Các module/sub-component bên trong component và responsibility của từng module.
21
+
22
+ | Module | Responsibility |
23
+ | --- | --- |
24
+ | {module} | {mô tả} |
25
+
26
+ ## Internal Data Flow
27
+
28
+ Luồng dữ liệu nội bộ component — từ input đến output, qua những module nào.
29
+
30
+ ```mermaid
31
+ sequenceDiagram
32
+ ...
33
+ ```
34
+
35
+ ## Storage & Persistence
36
+
37
+ Cách component lưu trữ data. Bỏ section nếu component stateless.
38
+
39
+ ### Tables / Collections
40
+
41
+ | Name | Mục đích | Key columns / Indexes |
42
+ | --- | --- | --- |
43
+ | {table_name} | {mục đích} | PK: {cols}, Index: {cols} |
44
+
45
+ ### Cache Strategy *(bỏ nếu dùng global strategy từ SAD)*
46
+
47
+ {Mô tả cache strategy nội bộ component nếu khác SAD.}
48
+
49
+ ## Internal Interfaces
50
+
51
+ Contract giữa các module bên trong component. Public interface (ra ngoài) đã được mô tả trong `crd.md`.
52
+
53
+ | Caller | Callee | Purpose |
54
+ | --- | --- | --- |
55
+ | {module A} | {module B} | {gọi để làm gì} |
56
+
57
+ ## Technical Decisions
58
+
59
+ Các quyết định kỹ thuật đặc thù của component và lý do.
60
+
61
+ | Quyết định | Lý do | Alternatives đã cân nhắc |
62
+ | --- | --- | --- |
63
+ | {decision} | {lý do cụ thể} | {option A vs B} |
@@ -0,0 +1,88 @@
1
+ ---
2
+ id: crd-{component}
3
+ type: crd
4
+ status: draft
5
+ owner: "{BA / Tech Lead}"
6
+ component_id: "{Component ID từ PRD Component Index, ví dụ C-001}"
7
+ referenced_by:
8
+ - conventions.md > 3. Main Artifacts > 3.2 Component level > crd.md > Cấu trúc
9
+ - skills/spec-new/SKILL.md > Process > Cascade Proposals > component crd.md
10
+ ---
11
+
12
+ # Component: {Component Name}
13
+
14
+ ## Role
15
+
16
+ {1-2 câu mô tả vai trò của component trong hệ thống. Component này là "nơi chịu trách nhiệm" cho cái gì?}
17
+
18
+ ## Responsibilities
19
+
20
+ Trách nhiệm cụ thể của component — phải làm gì, **không** làm gì.
21
+
22
+ ### Does
23
+
24
+ - {responsibility 1}
25
+ - {responsibility 2}
26
+
27
+ ### Does NOT
28
+
29
+ - {responsibility thuộc component khác — ghi rõ component nào sở hữu}
30
+ - {responsibility nằm ngoài scope}
31
+
32
+ ## Owned Entities
33
+
34
+ Entities mà component này sở hữu canonical definition. Nếu entity được dùng bởi 2+ component, định nghĩa chính sẽ ở `domain.md` (Shared Entities) thay vì ở đây — chỉ ghi reference.
35
+
36
+ ### {Entity Name}
37
+
38
+ {Mô tả entity này đại diện cho cái gì.}
39
+
40
+ **Attributes:**
41
+
42
+ | Attribute | Type | Required | Validation |
43
+ | --- | --- | --- | --- |
44
+ | {tên} | {business type} | Yes/No | {rule} |
45
+
46
+ **State Machine:** *(bỏ nếu entity không có lifecycle)*
47
+
48
+ | From | To | Trigger | Guard |
49
+ | --- | --- | --- | --- |
50
+ | {state} | {state} | {sự kiện} | {điều kiện} |
51
+
52
+ ## Public Interface
53
+
54
+ Các interface mà component expose ra ngoài — signature level, không bao gồm implementation.
55
+
56
+ ### API Endpoints *(bỏ nếu component không expose HTTP API)*
57
+
58
+ | Method | Path | Purpose | Auth |
59
+ | --- | --- | --- | --- |
60
+ | {GET/POST/...} | {/path} | {mục đích} | required/public |
61
+
62
+ ### Events Published *(bỏ nếu không emit event)*
63
+
64
+ | Event | Trigger | Payload chính |
65
+ | --- | --- | --- |
66
+ | {EventName} | {khi nào emit} | {fields chính} |
67
+
68
+ ### Events Consumed *(bỏ nếu không consume event)*
69
+
70
+ | Event | Source Component | Action |
71
+ | --- | --- | --- |
72
+ | {EventName} | {C-XXX} | {component này làm gì khi nhận event} |
73
+
74
+ ## Business Rules
75
+
76
+ Các quy tắc nghiệp vụ thuộc về component này. Rule cross-component thuộc về `fdd.md` của feature liên quan.
77
+
78
+ | ID | Rule | Condition | Exception |
79
+ | --- | --- | --- | --- |
80
+ | {C-XXX-R01} | {mô tả rule} | {khi nào apply} | {ngoại lệ nếu có} |
81
+
82
+ ## Dependencies
83
+
84
+ Các component khác mà component này phụ thuộc.
85
+
86
+ | Component | Loại dependency | Cách dùng |
87
+ | --- | --- | --- |
88
+ | `{C-XXX}-{name}` | sync call / event subscription / shared entity | {cụ thể: gọi API nào, subscribe event nào} |
@@ -5,22 +5,35 @@ status: draft
5
5
  owner: "{BA/Domain Expert}"
6
6
  referenced_by:
7
7
  - conventions.md > 3. Main Artifacts > 3.1 Product level > domain.md > Cấu trúc
8
- - skills/spec-domain/SKILL.md > Process > Bước 1: Kiểm tra preconditions
9
- - skills/spec-domain/SKILL.md > Process > Bước 3: Write — sinh draft
8
+ - skills/spec-prd/SKILL.md > Process > Bước 5: Save (scaffold domain.md skeleton)
9
+ - skills/spec-new/SKILL.md > Process > Cascade Proposals > domain.md
10
+ - skills/spec-tech/SKILL.md > Process > Cascade Proposals > domain.md
10
11
  ---
11
12
 
12
13
  # Domain
13
14
 
14
- ## Terminology
15
+ > File này mỏng — chỉ chứa **shared vocabulary** và **shared entities** (entities được dùng bởi 2+ component).
16
+ >
17
+ > Business rules, domain events, internal entities thuộc về component sở hữu — xem `specs/main/component/{C-XXX}-{component-name}/crd.md`.
15
18
 
16
- | Term | Definition |
17
- | --- | --- |
18
- | {term} | {definition chính xác, không mơ hồ} |
19
+ ## Glossary
19
20
 
20
- ## Entities
21
+ Định nghĩa các thuật ngữ business — đây là **nơi duy nhất** chứa glossary trong toàn dự án.
22
+
23
+ | Term | Definition | Example / Context |
24
+ | --- | --- | --- |
25
+ | {term} | {định nghĩa chính xác, không mơ hồ} | {context hoặc ví dụ minh họa nếu cần} |
26
+
27
+ ## Shared Entities
28
+
29
+ Chỉ liệt kê entity được dùng bởi **2 hoặc nhiều component**. Entity nội bộ một component không vào đây — chúng nằm trong `crd.md` của component đó.
21
30
 
22
31
  ### {Entity Name}
23
32
 
33
+ **Owner:** `{C-XXX}-{component-name}` *(component sở hữu canonical definition)*
34
+
35
+ **Used by:** `{C-XXX}`, `{C-YYY}` *(các component reference entity này)*
36
+
24
37
  {Mô tả entity này đại diện cho cái gì trong business context.}
25
38
 
26
39
  **Attributes:**
@@ -39,22 +52,10 @@ Type là business type (text, number, money, date, email, phone) — không ph
39
52
 
40
53
  ## Entity Relationships
41
54
 
55
+ Quan hệ giữa các shared entities. Quan hệ giữa entity nội bộ component thuộc về `cdd.md` của component đó.
56
+
42
57
  ```mermaid
43
58
  erDiagram
44
59
  EntityA ||--o{ EntityB : ""
45
60
  EntityB }o--|| EntityC : ""
46
61
  ```
47
-
48
- ## Business Rules
49
-
50
- | ID | Rule | Condition | Exception |
51
- | --- | --- | --- | --- |
52
- | {DOMAIN-R01} | {mô tả rule} | {khi nào apply} | {ngoại lệ nếu có} |
53
-
54
- ## Domain Events
55
-
56
- *(Bỏ nếu không có event-driven behavior)*
57
-
58
- | Event | Trigger | Payload |
59
- | --- | --- | --- |
60
- | {EventName} | {khi nào xảy ra} | {data đi kèm} |
@@ -5,51 +5,48 @@ status: draft
5
5
  owner: "{Tech Lead / Senior Dev}"
6
6
  feature_id: "{Feature ID}"
7
7
  referenced_by:
8
- - conventions.md > 3. Main Artifacts > 3.2 Feature level > fdd.md > Cấu trúc
8
+ - conventions.md > 3. Main Artifacts > 3.3 Feature level > fdd.md > Cấu trúc
9
9
  - skills/spec-tech/SKILL.md > Process > Bước 4: Write — sinh draft > Cascade Proposals > fdd.md
10
10
  ---
11
11
 
12
12
  # Feature Design: {Feature Name}
13
13
 
14
- ## Module Structure
14
+ > File này mỏng — chỉ mô tả **cách các component tương tác với nhau** để thực hiện feature.
15
+ >
16
+ > Internal design của từng component nằm trong `cdd.md` của component đó. Cross-cutting concerns nằm trong `sad.md`.
15
17
 
16
- {Mô tả các module/layer trong feature này và responsibility của từng module.}
18
+ ## Inter-Component Data Flow
17
19
 
18
- | Module | Responsibility |
19
- | --- | --- |
20
- | {module} | {mô tả} |
21
-
22
- ## Data Flow
23
-
24
- {Mô tả data flow nội bộ feature — từ input đến output, qua những bước nào.}
20
+ Luồng dữ liệu đi qua các component — sequence diagram là form chính, có thể bổ sung mô tả prose.
25
21
 
26
22
  ```mermaid
27
23
  sequenceDiagram
28
- ...
24
+ participant User
25
+ participant {C-XXX} as ComponentA
26
+ participant {C-YYY} as ComponentB
27
+
28
+ User->>ComponentA: {request}
29
+ ComponentA->>ComponentB: {call}
30
+ ComponentB-->>ComponentA: {response}
31
+ ComponentA-->>User: {result}
29
32
  ```
30
33
 
31
- ## Interfaces
32
-
33
- ### API Endpoints
34
+ {Mô tả ngắn các bước nếu sequence diagram chưa đủ rõ.}
34
35
 
35
- | Method | Path | Purpose | Auth |
36
- | --- | --- | --- | --- |
37
- | {GET/POST/...} | {/path} | {mục đích} | required/public |
36
+ ## Orchestration
38
37
 
39
- ### Events *(bỏ nếu không dùng)*
38
+ Logic cấp feature — không thuộc component nào riêng lẻ. Bỏ section nếu feature đơn giản (1-2 component, không cần retry/fallback đặc biệt).
40
39
 
41
- | Event | Direction | Payload chính |
42
- | --- | --- | --- |
43
- | {EventName} | emit/consume | {fields} |
44
-
45
- ## Caching & Queue Strategy
46
-
47
- *(Bỏ nếu dùng global strategy từ SAD)*
40
+ | Concern | Handling |
41
+ | --- | --- |
42
+ | Retry policy | {ví dụ: retry 3 lần với exponential backoff khi gọi component X} |
43
+ | Timeout | {ví dụ: timeout tổng feature 5s; per-component 2s} |
44
+ | Fallback | {ví dụ: nếu component X fail, dùng cached data} |
45
+ | Error propagation | {ví dụ: lỗi từ component Y được map thành 503 cho user} |
48
46
 
49
- {Mô tả strategy riêng của feature nếu khác SAD.}
47
+ ## Cross-Component Invariants
50
48
 
51
- ## Technical Decisions
49
+ Các invariant cần đảm bảo xuyên component — consistency, transactional boundary, ordering. Bỏ section nếu không có.
52
50
 
53
- | Quyết định | do | Alternatives đã cân nhắc |
54
- | --- | --- | --- |
55
- | {decision} | {lý do cụ thể} | {option A vs B} |
51
+ - {ví dụ: Order chỉ được đánh dấu `paid` sau khi Payment component confirm thành công}
52
+ - {ví dụ: Inventory phải được reserve trước khi Order được tạo, rollback nếu Payment fail}
@@ -5,7 +5,7 @@ status: draft
5
5
  owner: "{BA}"
6
6
  feature_id: "{Feature ID từ PRD Feature Index}"
7
7
  referenced_by:
8
- - conventions.md > 3. Main Artifacts > 3.2 Feature level > frd.md > Cấu trúc
8
+ - conventions.md > 3. Main Artifacts > 3.3 Feature level > frd.md > Cấu trúc
9
9
  - skills/spec-new/SKILL.md > Process > Bước 5: Write — sinh draft > Cascade Proposals > frd.md
10
10
  ---
11
11
 
@@ -15,18 +15,29 @@ referenced_by:
15
15
 
16
16
  {Mô tả feature này giải quyết vấn đề gì cho user nào, trong 2-3 câu.}
17
17
 
18
+ ## Components Consumed
19
+
20
+ Các component mà feature này dùng — tham chiếu đến `specs/main/component/{C-XXX}-...`.
21
+
22
+ | Component | Vai trò trong feature |
23
+ | --- | --- |
24
+ | `{C-XXX}-{component-name}` | {component này phục vụ cái gì cho feature này} |
25
+
18
26
  ## Feature-level Acceptance Criteria
19
27
 
20
28
  Criteria áp dụng cho toàn bộ feature — không gắn với story cụ thể (ví dụ: performance, security, accessibility).
29
+ AC ID format: `AC-F{NNN}-{seq}` — đánh số tăng dần toàn feature (không reset giữa sections).
21
30
 
22
- - [ ]
31
+ - `AC-{F_ID}-001`
23
32
  - **Given** {precondition}
24
33
  - **When** {action}
25
34
  - **Then** {expected outcome}
26
35
 
27
36
  ## User Stories
28
37
 
29
- ### US-001: {Story title}
38
+ US ID format: `US-F{NNN}-{seq}` — đánh số tăng dần toàn feature.
39
+
40
+ ### US-{F_ID}-001: {Story title}
30
41
 
31
42
  **{Persona}** muốn **{hành động}** để **{mục tiêu}**.
32
43
 
@@ -34,18 +45,18 @@ Criteria áp dụng cho toàn bộ feature — không gắn với story cụ th
34
45
 
35
46
  **Acceptance Criteria:**
36
47
 
37
- - [ ]
48
+ - `AC-{F_ID}-{seq}`
38
49
  - **Given** {precondition}
39
50
  - **When** {action}
40
51
  - **Then** {expected outcome}
41
- - [ ]
52
+ - `AC-{F_ID}-{seq}`
42
53
  - **Given** {precondition}
43
54
  - **When** {action}
44
55
  - **Then** {expected outcome}
45
56
 
46
57
  ---
47
58
 
48
- ### US-002: {Story title}
59
+ ### US-{F_ID}-002: {Story title}
49
60
 
50
61
  **{Persona}** muốn **{hành động}** để **{mục tiêu}**.
51
62
 
@@ -53,7 +64,7 @@ Criteria áp dụng cho toàn bộ feature — không gắn với story cụ th
53
64
 
54
65
  **Acceptance Criteria:**
55
66
 
56
- - [ ]
67
+ - `AC-{F_ID}-{seq}`
57
68
  - **Given** {precondition}
58
69
  - **When** {action}
59
70
  - **Then** {expected outcome}
@@ -39,6 +39,14 @@ Tại sao cần giải quyết bây giờ.
39
39
  | --- | --- | --- | --- | --- |
40
40
  | F-001 | {tên feature} | {mô tả ngắn — feature làm gì, cho ai} | High/Medium/Low | TODO/DONE |
41
41
 
42
+ ## Components
43
+
44
+ Các thành phần kỹ thuật của hệ thống — chi tiết về vai trò và thiết kế nằm trong `specs/main/component/{C-XXX}-{component-name}/`.
45
+
46
+ | ID | Component | Mô tả ngắn | Status |
47
+ | --- | --- | --- | --- |
48
+ | C-001 | {tên component} | {1 câu — component này chịu trách nhiệm gì} | TODO/DONE |
49
+
42
50
  ## Non-Functional Requirements
43
51
 
44
52
  | ID | Category | Requirement | Target | Priority |