spec-lite 1.0.1 → 1.1.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/README.md +21 -22
- package/package.json +1 -1
- package/skills/build/SKILL.md +27 -2
- package/skills/plan/SKILL.md +17 -88
- package/skills/planning-and-task-breakdown/SKILL.md +12 -8
- package/skills/spec-new/SKILL.md +64 -32
- package/skills/spec-prd/SKILL.md +33 -14
- package/skills/spec-sad/SKILL.md +3 -3
- package/skills/spec-tech/SKILL.md +64 -25
- package/templates/integrations/plan-template.md +62 -12
- package/templates/integrations/spec-template.md +42 -14
- package/templates/integrations/tech-template.md +10 -1
- package/templates/integrations/todo-template.md +1 -0
- package/templates/main/component/cdd-template.md +63 -0
- package/templates/main/component/crd-template.md +88 -0
- package/templates/main/domain-template.md +22 -21
- package/templates/main/feature/fdd-template.md +27 -30
- package/templates/main/feature/frd-template.md +32 -17
- package/templates/main/prd-template.md +8 -0
- package/skills/spec-domain/SKILL.md +0 -176
|
@@ -28,14 +28,22 @@ Tạo `tech.md` cho một integration trong `specs/integrations/{slug}/`.
|
|
|
28
28
|
|
|
29
29
|
### Bước 1: Xác định integration
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
**Nếu có ARGUMENT:**
|
|
32
|
+
- Parse argument: có thể là số thứ tự (`2`, `002`) hoặc slug (`002-implement-todo`)
|
|
33
|
+
- Quét `specs/integrations/*/spec.md`, tìm integration khớp với argument
|
|
34
|
+
- Nếu không tìm thấy → báo lỗi:
|
|
35
|
+
> Không tìm thấy integration khớp với "{argument}". Kiểm tra lại tên hoặc số thứ tự.
|
|
36
|
+
- Nếu tìm thấy → dùng integration đó, bắt đầu luôn
|
|
37
|
+
|
|
38
|
+
**Nếu không có ARGUMENT:**
|
|
39
|
+
|
|
40
|
+
Quét `specs/integrations/`. Liệt kê **tất cả** integrations có `spec.md`, đánh dấu những cái đã có `tech.md`:
|
|
32
41
|
|
|
33
42
|
```
|
|
34
43
|
Integrations:
|
|
35
44
|
|
|
36
|
-
[1]
|
|
37
|
-
[2]
|
|
38
|
-
[3] f004-credit-system — Credit System
|
|
45
|
+
[1] 001-implement-auth — Implement Auth spec✓ tech✓
|
|
46
|
+
[2] 002-implement-todo — Implement Todo Management spec✓ tech—
|
|
39
47
|
|
|
40
48
|
Chọn số integration:
|
|
41
49
|
```
|
|
@@ -43,8 +51,6 @@ Chọn số integration:
|
|
|
43
51
|
Nếu không có integration nào → thông báo:
|
|
44
52
|
> Chưa có integration nào. Hãy chạy `/spec-new` trước.
|
|
45
53
|
|
|
46
|
-
**Nếu có ARGUMENT** → đây là số thứ tự trong danh sách trên (ví dụ `1`, `2`, hoặc `001`). Parse thành số nguyên, bỏ qua leading zeros, map vào integration tương ứng — không cần hiển thị danh sách, chọn luôn.
|
|
47
|
-
|
|
48
54
|
Nếu integration đã có `tech.md` → hỏi trước khi tiếp tục:
|
|
49
55
|
> `tech.md` đã tồn tại cho integration này. Tiếp tục sẽ ghi đè. Tiếp tục không?
|
|
50
56
|
|
|
@@ -54,18 +60,24 @@ Nếu integration đã có `tech.md` → hỏi trước khi tiếp tục:
|
|
|
54
60
|
|
|
55
61
|
Load các file sau:
|
|
56
62
|
|
|
57
|
-
- `specs/integrations/{slug}/spec.md` — đọc toàn
|
|
63
|
+
- `specs/integrations/{slug}/spec.md` — đọc toàn bộ + frontmatter (`features`, `components`)
|
|
58
64
|
- `specs/main/sad.md` — đọc Tech Stack và Architectural Guardrails
|
|
59
|
-
- `specs/main/domain.md` — đọc
|
|
65
|
+
- `specs/main/domain.md` — đọc Glossary và Shared 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)
|
|
60
68
|
|
|
61
69
|
Tóm tắt context và surface assumptions:
|
|
62
70
|
|
|
63
71
|
```
|
|
64
72
|
TỪ SPEC & SAD TÔI HIỂU:
|
|
65
73
|
- Integration: {title}
|
|
74
|
+
- Features liên quan: {từ frontmatter — F-XXX, ...}
|
|
75
|
+
- Components bị touched: {từ frontmatter — C-XXX, ...}
|
|
66
76
|
- Yêu cầu chính: {tóm tắt requirements từ spec.md}
|
|
67
77
|
- Tech stack: {từ sad.md}
|
|
68
|
-
-
|
|
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}
|
|
69
81
|
- Guardrails cần tuân theo: {list GUARD-XXX từ sad.md}
|
|
70
82
|
|
|
71
83
|
ASSUMPTIONS TÔI ĐANG ĐẶT RA:
|
|
@@ -113,29 +125,56 @@ Tổng hợp và viết draft `tech.md`:
|
|
|
113
125
|
|
|
114
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.
|
|
115
127
|
|
|
116
|
-
**Cascade Proposals** —
|
|
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."):
|
|
117
129
|
|
|
118
130
|
### sad.md
|
|
119
131
|
|
|
120
|
-
|
|
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
|
|
121
136
|
|
|
122
137
|
### domain.md
|
|
123
138
|
|
|
124
|
-
|
|
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
|
|
142
|
+
|
|
143
|
+
### component/{C-XXX}-{component-name}/cdd.md
|
|
144
|
+
|
|
145
|
+
Liệt kê **tất cả** components bị touched trong frontmatter và đánh giá từng cái:
|
|
146
|
+
|
|
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 có | **Tạo mới** — full cdd skeleton |
|
|
151
|
+
|
|
152
|
+
Với từng component có đề xuất:
|
|
153
|
+
|
|
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
|
|
125
162
|
|
|
126
|
-
|
|
163
|
+
Liệt kê **tất cả** features liên quan trong frontmatter và đánh giá:
|
|
127
164
|
|
|
128
|
-
|
|
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** |
|
|
129
169
|
|
|
130
|
-
**Tạo mới** `specs/main/
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
- Nội dung đề xuất: {tóm tắt Module Structure, Data Flow, Interfaces từ tech.md}
|
|
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)
|
|
134
173
|
|
|
135
|
-
**Cập nhật** `specs/main/
|
|
136
|
-
-
|
|
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
|
|
137
176
|
|
|
138
|
-
|
|
177
|
+
Bỏ block fdd.md nếu integration không gắn với feature nào (`features: []`).
|
|
139
178
|
```
|
|
140
179
|
|
|
141
180
|
Hiển thị draft cho user xem — **chưa ghi file**.
|
|
@@ -161,10 +200,10 @@ Thông báo kết quả:
|
|
|
161
200
|
✓ specs/integrations/{slug}/tech.md đã được tạo (status: draft)
|
|
162
201
|
|
|
163
202
|
Bước tiếp theo:
|
|
164
|
-
- Review và
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
203
|
+
- Review tech.md và apply Cascade Proposals (nếu có) vào main artifacts thủ công
|
|
204
|
+
- Approve tech.md (đổi status: draft → approved)
|
|
205
|
+
- /plan → tạo plan.md và todo.md cho integration này
|
|
206
|
+
- Sau khi tất cả tasks done: đổi status F-XXX trong prd.md thành DONE
|
|
168
207
|
```
|
|
169
208
|
|
|
170
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:
|
|
@@ -14,25 +15,74 @@ referenced_by:
|
|
|
14
15
|
|
|
15
16
|
<!-- Mô tả ngắn những gì sẽ được implement trong integration này -->
|
|
16
17
|
|
|
18
|
+
## Dependency Graph
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
<!-- ASCII diagram — bottom = foundations, top = UI. Ví dụ:
|
|
22
|
+
|
|
23
|
+
Database schema
|
|
24
|
+
│
|
|
25
|
+
├── Domain models
|
|
26
|
+
│ │
|
|
27
|
+
│ └── Services
|
|
28
|
+
│ │
|
|
29
|
+
│ └── API endpoints
|
|
30
|
+
│ │
|
|
31
|
+
│ └── UI components
|
|
32
|
+
-->
|
|
33
|
+
```
|
|
34
|
+
|
|
17
35
|
## Tasks
|
|
18
36
|
|
|
19
37
|
### Phase 1: {tên phase}
|
|
20
38
|
|
|
21
|
-
|
|
22
|
-
- [ ] T002 — {mô tả task}
|
|
23
|
-
- [ ] T003 — {mô tả task} (depends: T001)
|
|
39
|
+
#### T001 · {task title — bắt đầu bằng động từ}
|
|
24
40
|
|
|
25
|
-
|
|
41
|
+
**Mục tiêu:** {One sentence: what this task delivers}
|
|
26
42
|
|
|
27
|
-
|
|
28
|
-
- [ ] T005 — {mô tả task}
|
|
43
|
+
**depends:** —
|
|
29
44
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
45
|
+
**Các bước:**
|
|
46
|
+
1. {Concrete implementation step}
|
|
47
|
+
2. {Concrete implementation step}
|
|
48
|
+
|
|
49
|
+
**Verification:**
|
|
50
|
+
- [ ] {specific test case hoặc observable result}
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
#### T002 · {task title}
|
|
55
|
+
|
|
56
|
+
**Mục tiêu:** {One sentence}
|
|
57
|
+
|
|
58
|
+
**depends:** T001
|
|
59
|
+
|
|
60
|
+
**Các bước:**
|
|
61
|
+
1. {Concrete implementation step}
|
|
62
|
+
|
|
63
|
+
**Verification:**
|
|
64
|
+
- [ ] {specific test case hoặc observable result}
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
### Phase N: Verification
|
|
69
|
+
|
|
70
|
+
#### T00N · Integration tests — {flow name}
|
|
71
|
+
|
|
72
|
+
**Mục tiêu:** {End-to-end flow being tested}
|
|
73
|
+
|
|
74
|
+
**depends:** T001, T002, ...
|
|
75
|
+
|
|
76
|
+
**Các bước:**
|
|
77
|
+
1. {Test setup / seed data}
|
|
78
|
+
2. {Execute happy path}
|
|
79
|
+
3. {Execute error cases}
|
|
80
|
+
|
|
81
|
+
**Verification:**
|
|
82
|
+
- [ ] Happy path: {description}
|
|
83
|
+
- [ ] Error case: {description}
|
|
84
|
+
|
|
85
|
+
---
|
|
36
86
|
|
|
37
87
|
## Definition of Done
|
|
38
88
|
|
|
@@ -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,33 +13,54 @@ 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
|
-
##
|
|
22
|
+
## Acceptance Criteria
|
|
22
23
|
|
|
23
|
-
<!--
|
|
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
|
-
|
|
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
|
|
30
|
+
|
|
31
|
+
Format Given/When/Then. Bỏ block không dùng.
|
|
32
|
+
-->
|
|
33
|
+
|
|
34
|
+
### Feature: {feature-name} *(bỏ nếu integration không touch feature; lặp lại block cho mỗi feature)*
|
|
26
35
|
|
|
27
36
|
**Feature-level AC:**
|
|
28
37
|
|
|
29
|
-
- [ ] AC-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
- [ ] `AC-{F_ID}-{seq}`
|
|
39
|
+
- **Given** {precondition}
|
|
40
|
+
- **When** {action}
|
|
41
|
+
- **Then** {expected outcome}
|
|
42
|
+
|
|
43
|
+
#### US-{F_ID}-{seq}: {Story title}
|
|
44
|
+
|
|
45
|
+
**{Persona}** muốn **{hành động}** để **{mục tiêu}**.
|
|
46
|
+
|
|
47
|
+
**Priority:** Must / Should / Could
|
|
32
48
|
|
|
33
|
-
|
|
49
|
+
**Story AC:**
|
|
34
50
|
|
|
35
|
-
|
|
51
|
+
- [ ] `AC-{F_ID}-{seq}`
|
|
52
|
+
- **Given** {precondition}
|
|
53
|
+
- **When** {action}
|
|
54
|
+
- **Then** {expected outcome}
|
|
36
55
|
|
|
37
|
-
|
|
56
|
+
### Component: `{C-XXX}-{component-name}` *(bỏ nếu integration không touch component; lặp lại block cho mỗi component)*
|
|
38
57
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
58
|
+
**AC theo responsibility / interface / rule:**
|
|
59
|
+
|
|
60
|
+
- [ ] `AC-{C_ID}-{seq}` — {responsibility / interface / rule mô tả}
|
|
61
|
+
- **Given** {precondition}
|
|
62
|
+
- **When** {action}
|
|
63
|
+
- **Then** {expected outcome}
|
|
42
64
|
|
|
43
65
|
## Out of Scope
|
|
44
66
|
|
|
@@ -61,8 +83,14 @@ Không có thay đổi đề xuất.
|
|
|
61
83
|
|
|
62
84
|
Không có thay đổi đề xuất.
|
|
63
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
|
+
|
|
64
92
|
### feature/{F-XXX}-{feature-name}/frd.md
|
|
65
93
|
|
|
66
|
-
<!-- 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. -->
|
|
67
95
|
|
|
68
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.
|
|
@@ -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-
|
|
9
|
-
- skills/spec-
|
|
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
|
-
|
|
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
|
-
|
|
17
|
-
| --- | --- |
|
|
18
|
-
| {term} | {definition chính xác, không mơ hồ} |
|
|
19
|
+
## Glossary
|
|
19
20
|
|
|
20
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
18
|
+
## Inter-Component Data Flow
|
|
17
19
|
|
|
18
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
### API Endpoints
|
|
34
|
+
{Mô tả ngắn các bước nếu sequence diagram chưa đủ rõ.}
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
| --- | --- | --- | --- |
|
|
37
|
-
| {GET/POST/...} | {/path} | {mục đích} | required/public |
|
|
36
|
+
## Orchestration
|
|
38
37
|
|
|
39
|
-
|
|
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
|
-
|
|
|
42
|
-
| --- | --- |
|
|
43
|
-
|
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
47
|
+
## Cross-Component Invariants
|
|
50
48
|
|
|
51
|
-
|
|
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
|
-
|
|
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}
|