spec-lite 1.1.0 → 1.1.2

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.
@@ -0,0 +1,239 @@
1
+ ---
2
+ name: spec-brownfield-feature
3
+ description: Discover features từ code, generate frd.md + fdd.md cho từng feature, điền Feature Index vào prd.md. Phải chạy /spec-brownfield-component trước vì fdd.md tham chiếu C-XXX từ Component Index.
4
+ ---
5
+
6
+ # spec-brownfield-feature
7
+
8
+ ## Overview
9
+
10
+ Tạo `specs/main/feature/{F-XXX}-{feature-name}/frd.md` và `fdd.md` cho các features trong brownfield project.
11
+
12
+ Skill này **tự discover** features từ routes, use cases, và test files, sau đó scan sâu để extract user stories, AC, và inter-component flows. Khi hoàn thành, **điền Feature Index vào prd.md**.
13
+
14
+ **Phải chạy sau `/spec-brownfield-component`** vì fdd.md mô tả inter-component interaction và cần tham chiếu C-XXX IDs từ Component Index đã được điền.
15
+
16
+ ## When to Use
17
+
18
+ - Sau khi `/spec-brownfield-component` đã chạy xong
19
+ - prd.md có Component Index (C-XXX IDs đã có)
20
+ - Cần generate feature artifacts cho brownfield project
21
+
22
+ ## When NOT to Use
23
+
24
+ - `/spec-brownfield-component` chưa chạy → chạy component skill trước
25
+ - Greenfield project → feature artifacts mọc dần qua cascade từ integrations (`/spec-new`)
26
+
27
+ ---
28
+
29
+ ## Process
30
+
31
+ ### Bước 1: Load context và xác định path
32
+
33
+ **Path:** Nếu có ARGUMENT là path → dùng làm root. Nếu không → CWD.
34
+
35
+ **Load:**
36
+ - `specs/main/prd.md` — kiểm tra Component Index đã được điền
37
+ - `specs/main/domain.md` — đọc Glossary và Shared Entities
38
+ - `specs/main/component/*/crd.md` — đọc Public Interface của từng component (để cross-reference trong fdd.md)
39
+
40
+ **Kiểm tra preconditions:**
41
+
42
+ Nếu `prd.md` không tồn tại → dừng:
43
+ > `prd.md` chưa có nội dung. Hãy chạy `/spec-brownfield-init` trước.
44
+
45
+ Nếu `prd.md` Component Index còn trống (không có C-XXX entries) → dừng:
46
+ > Component Index chưa có entries. Hãy chạy `/spec-brownfield-component` trước.
47
+ > fdd.md cần tham chiếu C-XXX để mô tả inter-component flows.
48
+
49
+ Nếu `specs/main/component/` không có crd.md nào → cảnh báo tương tự và dừng.
50
+
51
+ **Attachments:**
52
+ > Bạn có tài liệu bổ sung nào không? (user stories, test plans, wireframes, existing specs)
53
+ > Nhập `không` để bỏ qua.
54
+
55
+ ---
56
+
57
+ ### Bước 2: Discover feature boundaries
58
+
59
+ Scan codebase để tìm feature candidates. Tìm theo thứ tự ưu tiên:
60
+
61
+ 1. **Use case / interactor files**: `*UseCase.{ts,js}`, `*Interactor.{ts,js}`, `*Handler.{ts,js}`, thư mục `application/*/`
62
+ 2. **Route groups**: controller files grouped by path prefix (`/auth/*`, `/payment/*`, `/orders/*`)
63
+ 3. **Test describe blocks**: `describe('User Registration', ...)`, `describe('Checkout Flow', ...)`
64
+ 4. **Page / screen directories**: `pages/{feature}/`, `screens/{feature}/`, `views/{feature}/`
65
+
66
+ Với mỗi candidate, ghi lại:
67
+ - Entry point file(s)
68
+ - Route paths liên quan
69
+ - Test files có hay không
70
+ - Components được call (từ import statements) → map sang C-XXX IDs
71
+
72
+ ---
73
+
74
+ ### Bước 3: Confirm feature list
75
+
76
+ ```
77
+ Tôi phát hiện {N} features từ codebase:
78
+ [F-001] user-registration → RegisterUseCase + POST /auth/register (5 tests)
79
+ [F-002] authentication → POST /auth/login, /auth/refresh (3 tests)
80
+ [F-003] checkout-flow → CheckoutUseCase + /checkout/* (8 tests)
81
+ [F-004] order-history → GET /orders/* (no tests)
82
+
83
+ Điều chỉnh nếu cần:
84
+ - Đổi tên: "F-003 → place-order"
85
+ - Bỏ feature: "bỏ F-004"
86
+ - Thêm feature: "thêm password-reset"
87
+ - Merge: "merge F-001 và F-002 thành auth-flow"
88
+
89
+ Confirm danh sách? [y] hoặc nhập điều chỉnh:
90
+ ```
91
+
92
+ Sau khi confirm, assign F-XXX IDs theo thứ tự tăng dần.
93
+
94
+ ---
95
+
96
+ ### Bước 4: Scan sâu từng feature
97
+
98
+ **4a. User stories — infer từ:**
99
+ - Use case class names và public methods → action descriptions
100
+ - Route names + HTTP methods → "As a user, I want to POST /auth/register..."
101
+ - Test `describe` / `it` blocks → `it('should register a new user', ...)` → user story
102
+
103
+ Đánh dấu source: `(inferred from routes)` hoặc `(from tests)`.
104
+
105
+ **4b. Acceptance criteria — extract từ:**
106
+ - Test assertions: `expect(response.status).toBe(201)`, `expect(user.email).toBe(...)`
107
+ - Input validation rules từ DTO / request validators
108
+ - Expected error codes / messages từ error handling code
109
+
110
+ Nếu không có tests → AC section sẽ là NEEDS_CLARIFY.
111
+
112
+ **4c. Components consumed — extract từ:**
113
+ - Import statements trong feature's controllers / use cases → map sang C-XXX IDs (đã có từ Component Index)
114
+ - Cross-reference với crd.md Public Interface để confirm
115
+
116
+ **4d. Inter-component flow cho fdd.md — extract từ:**
117
+ - Call chain trong use case file: `authService → userRepo → notificationService`
118
+ - Event publications và subscriptions trong flow
119
+ - Transaction boundaries nếu explicit (`@Transaction`, `queryRunner`)
120
+ - Retry / timeout config nếu detect được
121
+
122
+ ---
123
+
124
+ ### Bước 5: Hỏi clarification — batch
125
+
126
+ Sau khi scan xong tất cả, hỏi một lần — tối đa **5 câu tổng cộng**:
127
+
128
+ ```
129
+ Cần làm rõ {N} điểm:
130
+
131
+ [F-001 user-registration]
132
+ Q1. Flow này chỉ register bằng email/password, hay còn OAuth nữa?
133
+ (Tôi detect email/password flow nhưng thấy OAuth client được import)
134
+ [email/password only / cả hai / skip]
135
+
136
+ [F-003 checkout-flow]
137
+ Q2. Sau khi place order, payment được xử lý sync hay async?
138
+ (Tôi thấy PaymentService được call nhưng không rõ transaction boundary)
139
+ [sync / async / skip]
140
+
141
+ Trả lời hoặc "skip all":
142
+ ```
143
+
144
+ ---
145
+
146
+ ### Bước 6: Generate artifacts
147
+
148
+ Với mỗi feature, generate 2 files dùng templates tương ứng:
149
+
150
+ **`frd.md`** — WHAT (dùng `.claude/templates/main/feature/frd-template.md`):
151
+ - Description và business goal (infer từ feature name + use case, NEEDS_CLARIFY nếu không rõ)
152
+ - User stories (đánh dấu source)
153
+ - Acceptance criteria (extract từ tests nếu có, NEEDS_CLARIFY nếu không)
154
+ - Scope: In scope từ detected routes/actions; Out of scope → NEEDS_CLARIFY
155
+ - Components consumed: list C-XXX từ Component Index
156
+ - Dependencies: feature-to-feature dependencies nếu detect được
157
+
158
+ **`fdd.md`** — HOW / inter-component (dùng `.claude/templates/main/feature/fdd-template.md`):
159
+ - Inter-component data flow: sequence diagram từ detected call chain (Mermaid hoặc ASCII)
160
+ - Orchestration: retry / timeout / fallback nếu detect được
161
+ - Cross-component invariants: transaction boundaries nếu detect được
162
+
163
+ **Nguyên tắc:**
164
+ - fdd.md là **file mỏng** — chỉ mô tả tương tác giữa components, không lặp nội dung từ crd.md / cdd.md
165
+ - Mọi phần không detect được → NEEDS_CLARIFY, không bịa
166
+
167
+ ---
168
+
169
+ ### Bước 7: Review và save artifacts
170
+
171
+ ```
172
+ Sẽ tạo {N} features ({2N} files):
173
+ ✓ specs/main/feature/F-001-user-registration/frd.md (4 NEEDS_CLARIFY)
174
+ ✓ specs/main/feature/F-001-user-registration/fdd.md (2 NEEDS_CLARIFY)
175
+ ✓ specs/main/feature/F-002-authentication/frd.md (1 NEEDS_CLARIFY)
176
+ ✓ specs/main/feature/F-002-authentication/fdd.md (0 NEEDS_CLARIFY)
177
+ ...
178
+
179
+ Ghi tất cả? [y] hoặc review từng file trước [r]:
180
+ ```
181
+
182
+ ---
183
+
184
+ ### Bước 8: Điền Feature Index vào prd.md
185
+
186
+ Sau khi artifacts đã được ghi, update `specs/main/prd.md` Feature Index:
187
+
188
+ ```
189
+ Sẽ điền Feature Index vào prd.md:
190
+ F-001 | user-registration | Đăng ký tài khoản mới qua email/password | Must | TODO
191
+ F-002 | authentication | Đăng nhập và refresh token | Must | TODO
192
+ F-003 | checkout-flow | Đặt hàng và thanh toán | Must | TODO
193
+ F-004 | order-history | Xem lịch sử đơn hàng | Should | TODO
194
+
195
+ Apply? [y/n]
196
+ ```
197
+
198
+ ---
199
+
200
+ ### Bước 9: Summary
201
+
202
+ ```
203
+ ✓ Generated {N} features:
204
+ specs/main/feature/F-001-user-registration/ (frd.md + fdd.md)
205
+ specs/main/feature/F-002-authentication/ (frd.md + fdd.md)
206
+ ...
207
+
208
+ ✓ prd.md Feature Index: {N} entries đã được điền
209
+
210
+ NEEDS_CLARIFY summary — {total} items:
211
+ F-001: {n} — [business goal, out of scope, AC, ...]
212
+ F-002: {n} — [...]
213
+ ...
214
+
215
+ Brownfield init hoàn tất! Main artifacts:
216
+ specs/main/
217
+ ├── prd.md (Component Index: {N} | Feature Index: {N})
218
+ ├── domain.md (Glossary: {N} terms | Shared Entities: {N})
219
+ ├── sad.md
220
+ ├── component/ ({N} components, mỗi cái có crd.md + cdd.md)
221
+ └── feature/ ({N} features, mỗi cái có frd.md + fdd.md)
222
+
223
+ Để bắt đầu implement, dùng /spec-new để tạo integration đầu tiên.
224
+ grep "NEEDS_CLARIFY" để tìm và fill in khi có thêm context.
225
+ ```
226
+
227
+ ---
228
+
229
+ ## Verification
230
+
231
+ - [ ] Chạy sau `/spec-brownfield-component` — Component Index đã có entries
232
+ - [ ] Mỗi feature có đủ frd.md + fdd.md
233
+ - [ ] frd.md có ít nhất 1 user story hoặc NEEDS_CLARIFY rõ ràng
234
+ - [ ] fdd.md chỉ mô tả inter-component interaction — không lặp nội dung từ crd.md / cdd.md
235
+ - [ ] Components consumed list reference đúng C-XXX IDs từ Component Index
236
+ - [ ] User stories và AC detect được đánh dấu source `(inferred)` hoặc `(from tests)`
237
+ - [ ] Feature không có tests → AC section có NEEDS_CLARIFY rõ ràng
238
+ - [ ] prd.md Feature Index đã được update
239
+ - [ ] NEEDS_CLARIFY items được list đầy đủ trong summary
@@ -0,0 +1,312 @@
1
+ ---
2
+ name: spec-brownfield-init
3
+ description: Khởi tạo main artifacts (prd.md, domain.md, sad.md) cho brownfield project bằng cách scan codebase và interview với pre-filled options. Dùng khi onboarding một project đã chạy vào SDD workflow.
4
+ ---
5
+
6
+ # spec-brownfield-init
7
+
8
+ ## Overview
9
+
10
+ Tạo `specs/main/prd.md`, `specs/main/domain.md`, và `specs/main/sad.md` cho một project đã tồn tại.
11
+
12
+ Skill này chỉ tập trung vào **product và architecture level** — những gì có thể extract từ README, docs, config, và kiến trúc tổng thể. Component Index và Feature Index trong prd.md sẽ **để trống** — chúng sẽ được điền bởi `/spec-brownfield-component` và `/spec-brownfield-feature` sau khi scan code chuyên sâu.
13
+
14
+ ## Templates
15
+
16
+ Mỗi file output được sinh ra từ template tương ứng — đọc template trước khi điền nội dung:
17
+
18
+ | Output file | Template |
19
+ | --- | --- |
20
+ | `specs/main/prd.md` | `templates/main/prd-template.md` |
21
+ | `specs/main/domain.md` | `templates/main/domain-template.md` |
22
+ | `specs/main/sad.md` | `templates/main/sad-template.md` |
23
+
24
+ Giữ nguyên cấu trúc section và frontmatter từ template. Điền nội dung thu thập được từ scan và interview vào đúng vị trí.
25
+
26
+ Thông tin không thể detect từ code được đánh dấu nhất quán:
27
+
28
+ ```
29
+ **[NEEDS_CLARIFY]** <mô tả điều chưa rõ và câu hỏi cần trả lời>
30
+ ```
31
+
32
+ ## When to Use
33
+
34
+ - Onboarding một brownfield project vào SDD workflow
35
+ - `specs/main/prd.md` chưa có hoặc còn trống
36
+
37
+ ## When NOT to Use
38
+
39
+ - Greenfield project chưa có code → dùng `/spec-prd` + `/spec-sad`
40
+ - `prd.md` đã có nội dung đầy đủ → dùng `/spec-prd` hoặc `/spec-sad` để update từng phần
41
+
42
+ ---
43
+
44
+ ## Process
45
+
46
+ ### Bước 1: Xác định target path và load attachments
47
+
48
+ **Path:**
49
+ - Nếu có ARGUMENT là path → đây là root của project cần scan.
50
+ - Nếu không có → mặc định dùng current working directory.
51
+
52
+ Thông báo: `Sẽ scan: {path}`
53
+
54
+ **Attachments:**
55
+ Hỏi ngay đầu — không hỏi lại sau:
56
+
57
+ > Bạn có tài liệu bổ sung nào không? (README, API spec, wiki, ADR, existing docs)
58
+ > Paste nội dung hoặc cung cấp file path. Nhập `không` để bỏ qua.
59
+
60
+ Load tất cả attachments trước khi scan. Dùng làm context bổ sung trong mọi bước tiếp theo.
61
+
62
+ ---
63
+
64
+ ### Bước 2: Kiểm tra existing specs
65
+
66
+ Kiểm tra `specs/main/prd.md`, `specs/main/domain.md`, `specs/main/sad.md`:
67
+
68
+ Nếu một trong ba đã có nội dung thực → cảnh báo:
69
+
70
+ ```
71
+ ⚠ File đã có nội dung:
72
+ - specs/main/prd.md
73
+ - specs/main/sad.md
74
+
75
+ Skill này sẽ overwrite các file trên. Tiếp tục? [y/n]
76
+ ```
77
+
78
+ Nếu user chọn `n` → dừng.
79
+
80
+ ---
81
+
82
+ ### Bước 3: Scan codebase
83
+
84
+ Scan tuần tự. **Không hỏi user trong bước này** — chỉ thu thập thông tin.
85
+
86
+ **3a. Package & tech stack:**
87
+ Đọc (nếu tồn tại): `package.json`, `yarn.lock`, `pnpm-lock.yaml`, `requirements.txt`, `pyproject.toml`, `go.mod`, `Cargo.toml`, `pom.xml`, `build.gradle`, `composer.json`, `Gemfile`, `pubspec.yaml`
88
+
89
+ Extract: ngôn ngữ, framework chính, major dependencies, build/test scripts.
90
+
91
+ **3b. README và existing docs:**
92
+ Đọc (nếu tồn tại): `README.md`, `README.*`, `docs/`, `ARCHITECTURE.md`, `DESIGN.md`
93
+
94
+ Extract: mô tả project, target users được nhắc đến, business context.
95
+
96
+ **3c. Directory structure — top level:**
97
+ List 1-2 levels từ root — không đọc nội dung file source.
98
+
99
+ Detect: architecture pattern (monolith / microservices / monorepo). Không cần lấy tên từng module — đó là việc của `/spec-brownfield-component`.
100
+
101
+ **3d. Auth & middleware:**
102
+ Tìm files liên quan: auth, middleware, interceptor, guard, rate-limit, logging config.
103
+
104
+ Infer: auth strategy, cross-cutting patterns đang dùng.
105
+
106
+ **3e. Infrastructure:**
107
+ Đọc (nếu tồn tại): `docker-compose.yml`, `Dockerfile`, `.github/workflows/`, `k8s/`, `terraform/`, `serverless.yml`, `.env.example`
108
+
109
+ Extract: deployment target, số services (để confirm architecture pattern), số môi trường.
110
+
111
+ ---
112
+
113
+ ### Bước 4: Tóm tắt scan và xác nhận tiếp tục
114
+
115
+ ```
116
+ SCAN RESULTS — {path}
117
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
118
+ Tech stack: {e.g. TypeScript / NestJS / PostgreSQL / Redis}
119
+ Architecture: {e.g. Modular Monolith}
120
+ Auth pattern: {e.g. JWT Bearer / Session / không detect được}
121
+ Docs loaded: {list files đọc được}
122
+
123
+ Tiếp tục với brownfield init? [y/n]
124
+ ```
125
+
126
+ Nếu `n` → dừng.
127
+
128
+ ---
129
+
130
+ ### Bước 5: Interview — prd.md
131
+
132
+ Hỏi tuần tự từng phần. Mỗi câu hỏi có options pre-filled từ scan. Luôn có `[0] Chưa rõ → NEEDS_CLARIFY`. Khi user chọn `[0]` → đánh dấu và tiếp tục, không dừng lại.
133
+
134
+ **Phần 1 — Problem Statement:**
135
+
136
+ ```
137
+ ❓ Hệ thống này giải quyết vấn đề gì?
138
+ [1] {Trích từ README: "..."}
139
+ [2] Nhập mô tả khác
140
+ [0] Chưa rõ → NEEDS_CLARIFY
141
+ ```
142
+
143
+ **Phần 2 — Target Users:**
144
+
145
+ ```
146
+ ❓ Ai là người dùng chính?
147
+ [1] {Detected từ auth guards / README: e.g. "admin, user, guest"}
148
+ [2] Nhập personas khác
149
+ [0] Chưa rõ → NEEDS_CLARIFY
150
+ ```
151
+
152
+ Nếu user chọn [1] → hỏi thêm một câu: "Bạn muốn mô tả thêm mục tiêu / pain point cho từng role không? [y/n]"
153
+
154
+ **Phần 3 — Scope:**
155
+
156
+ ```
157
+ ❓ In scope — những gì hệ thống có:
158
+ [1] {Infer từ README/docs: "..."}
159
+ [2] Nhập danh sách khác
160
+ [0] Chưa rõ → NEEDS_CLARIFY
161
+
162
+ ❓ Out of scope — những gì hệ thống KHÔNG làm:
163
+ [1] Nhập nội dung
164
+ [0] Chưa rõ → NEEDS_CLARIFY
165
+ ```
166
+
167
+ **Phần 4 — NFRs:**
168
+
169
+ ```
170
+ ❓ Non-Functional Requirements:
171
+ Detected từ config / code:
172
+ {e.g. Rate limit: 100 req/min (từ rate-limit config)}
173
+ {e.g. DB pool: max 10 connections (từ DB config)}
174
+
175
+ Có thêm NFR nào không? (performance targets, availability SLA, security compliance, scalability)
176
+ [1] Dùng detected + nhập thêm nếu có
177
+ [2] Nhập lại từ đầu
178
+ [0] Chưa rõ → NEEDS_CLARIFY tất cả
179
+ ```
180
+
181
+ **Phần 5 — Business Constraints:**
182
+
183
+ ```
184
+ ❓ Business constraints và assumptions:
185
+ (deadline, budget, compliance, vendor lock-in, team constraints)
186
+ [1] Nhập nội dung
187
+ [0] Chưa rõ → NEEDS_CLARIFY
188
+ ```
189
+
190
+ **Lưu ý:** prd.md sẽ có Component Index và Feature Index **để trống** với placeholder. Chúng sẽ được điền bởi `/spec-brownfield-component` và `/spec-brownfield-feature`.
191
+
192
+ ---
193
+
194
+ ### Bước 6: Tạo domain.md — Glossary
195
+
196
+ domain.md ở bước này chỉ có **Glossary** — Shared Entities để trống, sẽ được mọc qua cascade proposals từ `/spec-brownfield-component` khi nó phát hiện cross-component entities.
197
+
198
+ Extract glossary terms từ: README/docs (business terms được nhắc đến), tên các key concepts trong problem statement vừa thu thập.
199
+
200
+ Hỏi:
201
+ ```
202
+ ❓ Glossary terms cần define:
203
+ Tôi nhận diện được các terms sau từ docs:
204
+ - {term 1}: {định nghĩa inferred hoặc NEEDS_CLARIFY}
205
+ - {term 2}: {định nghĩa inferred hoặc NEEDS_CLARIFY}
206
+
207
+ [1] Dùng list này — có thể thêm/sửa/xóa
208
+ [2] Nhập danh sách mới
209
+ [0] Chưa rõ / bỏ qua → để trống, điền sau
210
+ ```
211
+
212
+ ---
213
+
214
+ ### Bước 7: Auto-generate — sad.md
215
+
216
+ Phần lớn auto từ scan. Chỉ hỏi 2 câu.
217
+
218
+ **7a. Auto-fill từ scan:**
219
+ - Tech stack: từ package files
220
+ - Architecture style: infer từ directory structure top-level + docker-compose
221
+ - Cross-cutting concerns: infer từ middleware / interceptors / guards detected
222
+ - Inter-service communication: infer từ message queue / HTTP client usage
223
+ - Infrastructure: infer từ docker-compose, cloud configs
224
+
225
+ **7b. Hỏi Guardrails:**
226
+
227
+ ```
228
+ ❓ Architectural Guardrails:
229
+ Dựa trên {stack}, tôi đề xuất:
230
+ GUARD-001: {rule cụ thể}
231
+ GUARD-002: {rule cụ thể}
232
+ ...
233
+
234
+ [1] Dùng set này — có thể thêm/bớt
235
+ [2] Nhập guardrails khác
236
+ [0] Chưa rõ → NEEDS_CLARIFY tất cả
237
+ ```
238
+
239
+ **7c. Hỏi additional constraints:**
240
+
241
+ ```
242
+ ❓ Có architectural decision nào quan trọng chưa detect được không?
243
+ (patterns bắt buộc dùng, patterns bị cấm, third-party services phải dùng)
244
+ [1] Nhập thêm
245
+ [0] Không có thêm
246
+ ```
247
+
248
+ ---
249
+
250
+ ### Bước 8: Review drafts
251
+
252
+ Hiển thị draft từng file lần lượt. Với mỗi file:
253
+
254
+ ```
255
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
256
+ DRAFT: specs/main/{file}
257
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
258
+ {nội dung draft}
259
+
260
+ [NEEDS_CLARIFY trong file này: {count} items]
261
+
262
+ Confirm? [y] Bỏ qua [n] Chỉnh sửa [e]:
263
+ ```
264
+
265
+ - `y` → ghi file, chuyển sang file tiếp theo
266
+ - `n` → bỏ qua file này
267
+ - `e` → hỏi chỉnh sửa cụ thể, show lại draft, hỏi confirm lần nữa
268
+
269
+ ---
270
+
271
+ ### Bước 9: Save
272
+
273
+ Tạo `specs/main/` nếu chưa có. Ghi các files đã được confirm.
274
+
275
+ ```
276
+ ✓ specs/main/prd.md (Component Index và Feature Index: placeholder — chưa có)
277
+ ✓ specs/main/domain.md (Glossary: {n} terms | Shared Entities: trống — sẽ mọc qua cascade)
278
+ ✓ specs/main/sad.md
279
+
280
+ NEEDS_CLARIFY summary — {total} items cần làm rõ:
281
+ prd.md: {n} — [Problem Statement, Business Constraints, ...]
282
+ domain.md: {n} — [glossary terms, ...]
283
+ sad.md: {n} — [guardrails, ...]
284
+
285
+ Bước tiếp theo:
286
+ /spec-brownfield-component → scan code, generate crd.md + cdd.md, điền Component Index
287
+ /spec-brownfield-feature → scan code, generate frd.md + fdd.md, điền Feature Index
288
+ (chạy component trước — feature phụ thuộc vào component)
289
+ ```
290
+
291
+ ---
292
+
293
+ ## NEEDS_CLARIFY Convention
294
+
295
+ Format chuẩn — dùng nhất quán trong tất cả artifacts:
296
+
297
+ ```markdown
298
+ **[NEEDS_CLARIFY]** Mô tả ngắn điều chưa rõ. Câu hỏi cần trả lời để fill in.
299
+ ```
300
+
301
+ ---
302
+
303
+ ## Verification
304
+
305
+ - [ ] Scan results đã được hiển thị và user confirm trước khi interview
306
+ - [ ] Mọi section có ít nhất một trong ba: nội dung thực / pre-filled option / NEEDS_CLARIFY
307
+ - [ ] prd.md có Component Index placeholder (chưa có entries — sẽ điền sau)
308
+ - [ ] prd.md có Feature Index placeholder (chưa có entries — sẽ điền sau)
309
+ - [ ] domain.md có Glossary (ít nhất skeleton) và Shared Entities trống
310
+ - [ ] sad.md có Architectural Guardrails section
311
+ - [ ] NEEDS_CLARIFY items được list đầy đủ trong summary cuối
312
+ - [ ] User đã confirm từng file trước khi ghi