spec-lite 1.1.14 → 1.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-lite",
3
- "version": "1.1.14",
3
+ "version": "1.2.0",
4
4
  "description": "Spec-driven development kit for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
@@ -160,9 +160,7 @@ Output path: `specs/integrations/{NNN}-{slug}/spec.md`
160
160
 
161
161
  ### Bước 5: Write — sinh draft
162
162
 
163
- Tổng hợp và viết draft `spec.md`:
164
-
165
- **Cấu trúc file**: dùng `.claude/templates/integrations/spec-template.md` làm skeleton, điền nội dung từ interview vào.
163
+ Tổng hợp và viết draft `spec.md`. **spec.md = changeset patch** áp lên main artifacts. Cấu trúc theo `templates/integrations/spec-template.md`: Context, Problem Statement, **Changes** (per-artifact blocks), Out of Scope, Open Questions, Cascade Summary.
166
164
 
167
165
  **ADO references từ prd.md:** Với mỗi Feature heading (`### Feature: <name> (<ID>)`) trong spec.md, nếu feature đó đã có ADO ticket trong `prd.md` → thêm ngay dòng `**ADO:**` bên dưới heading:
168
166
 
@@ -173,62 +171,51 @@ Tổng hợp và viết draft `spec.md`:
173
171
 
174
172
  Điều này đảm bảo `/ado-create` nhận biết feature đã có ticket và không tạo duplicate.
175
173
 
176
- **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."):
177
-
178
- ### prd.md
174
+ #### Sinh `## Changes` section
179
175
 
180
- Đề xuất cập nhật nếu integration này:
181
- - Giới thiệu feature mới chưa có trong Feature Index → đề xuất thêm row vào Features (auto-pick `F-XXX` next ID, slug từ context)
182
- - Giới thiệu component mới chưa có trong Component Index → đề xuất thêm row vào Components (auto-pick `C-XXX` next ID)
183
- - Đổi status feature từ `TODO` sang `In Progress`
184
- - Có scope hoặc NFR thay đổi
176
+ Với mỗi main artifact bị touched (frd, crd, prd, domain, sad), tạo 1 block. Bỏ block nếu artifact không bị thay đổi.
185
177
 
186
- ### domain.md
178
+ **Xác định operation:**
179
+ - `create` — artifact chưa tồn tại
180
+ - `update` — artifact đã tồn tại
187
181
 
188
- Đề xuất cập nhật nếu integration này:
189
- - Giới thiệu glossary term mới → đề xuất thêm vào Glossary
190
- - Giới thiệu shared entity mới (entity sẽ được dùng bởi 2+ component) → đề xuất thêm vào Shared Entities với field `Owner: C-XXX`
182
+ **Diff against current state:**
191
183
 
192
- ### component/{C-XXX}-{component-name}/crd.md
184
+ Context đã load artifact hiện tại ở Bước 2. Agent so sánh nội dung mới với current state để gán marker per item:
193
185
 
194
- Liệt **tất cả** components bị touched trong integration và đánh giá từng cái:
186
+ | Marker | Khi nào dùng |
187
+ | --- | --- |
188
+ | `[NEW]` | Item chưa có trong artifact hiện tại |
189
+ | `[MODIFY {field}]` | Item đã có, đang đổi field cụ thể. Ghi rõ field nào: `[MODIFY priority]`, `[MODIFY rule]`, `[MODIFY status]` |
190
+ | `[REMOVE]` | Item đã có, sẽ bị xóa khỏi artifact |
195
191
 
196
- | Component | crd.md | Đề xuất |
197
- | --- | --- | --- |
198
- | C-001 — auth | tồn tại | **Cập nhật** — thêm responsibility "rate limiting", thêm endpoint `POST /auth/rate-check` |
199
- | C-003 — payment | chưa có | **Tạo mới** crd + cdd |
192
+ Operation=create không cần marker, mọi item implicit là [NEW].
200
193
 
201
- Với từng component có đề xuất:
194
+ **ID assignment:**
202
195
 
203
- **Tạo mới** `specs/main/component/{C-XXX}-{component-slug}/crd.md` *(và `cdd.md` cascade spec-tech)*
204
- - Dùng khi integration này là lần đầu tiên giới thiệu component này
205
- - Auto-pick C-XXX (next available) và slug kebab-case từ context
206
- - Đề xuất nội dung crd: Role, Responsibilities, Owned Entities, Public Interface, Business Rules, Dependencies — dựa trên spec.md
196
+ Đọc artifact hiện tại để lấy `max(seq)` cho mỗi loại ID:
197
+ - `US-F{NNN}-{seq}`, `AC-F{NNN}-{seq}`, `VR-F{NNN}-{seq}` trong frd.md
198
+ - `AC-C{NNN}-{seq}` trong crd.md
207
199
 
208
- **Cập nhật** `specs/main/component/{C-XXX}-{component-slug}/crd.md`
209
- - Dùng khi crd.md đã tồn tại và integration bổ sung thêm responsibility, interface, hoặc business rule
210
- - Ghi rõ section nào bị touched và delta cụ thể
200
+ ID mới = `max(seq) + 1`, format 3 chữ số. ID **stable** — không tái sử dụng khi [REMOVE], không renumber khi [MODIFY]. Khi tạo mới artifact (operation=create), bắt đầu từ `001`.
211
201
 
212
- ### feature/{F-XXX}-{feature-name}/frd.md
202
+ **Format reference:** Mỗi Changes block dùng đúng format của template gốc:
203
+ - `feature/{F-XXX}/frd.md` → [frd-template.md](../../templates/main/feature/frd-template.md)
204
+ - `component/{C-XXX}/crd.md` → [crd-template.md](../../templates/main/component/crd-template.md)
205
+ - `prd.md` → [prd-template.md](../../templates/main/prd-template.md)
206
+ - `domain.md` → [domain-template.md](../../templates/main/domain-template.md)
207
+ - `sad.md` → [sad-template.md](../../templates/main/sad-template.md)
213
208
 
214
- Liệt **tất cả** features liên quan đến integration đánh giá từng cái:
209
+ Template gốc single source of truth cho format. KHÔNG duplicate skeleton vào spec.md.
215
210
 
216
- | Feature | Status | frd.md | Đề xuất |
217
- | --- | --- | --- | --- |
218
- | F-001 — Authentication | In Progress | tồn tại | **Cập nhật** — bổ sung US-003, AC mới về rate limiting |
219
- | F-002 — User Profile | TODO | chưa có | **Tạo mới** |
211
+ #### Per-artifact guidance
220
212
 
221
- Với từng feature có đề xuất thay đổi:
213
+ **`feature/{F-XXX}-{feature-slug}/frd.md`**
222
214
 
223
- **Tạo mới** `specs/main/feature/{F-XXX}-{feature-slug}/frd.md`
224
- - Dùng khi integration này là lần đầu tiên implement feature này
225
- - Thư mục đặt tên: `{F-XXX}-{feature-slug}` (ví dụ: `F-001-authentication`)
226
- - Nội dung đề xuất: User Flows, Feature-level AC, User Stories, **Verification Rules**, Scope, Components consumed (reference C-XXX) — từ spec.md
227
- - **Verification Rules**: xem hướng dẫn ở mục "Verification Rules — quy ước sinh" bên dưới
215
+ Liệt **tất cả** features liên quan đến integration và đánh giá từng cái. Không được bỏ qua feature nào — kể cả feature `Done` vẫn phải đánh giá xem spec mới có làm thay đổi scope không.
228
216
 
229
- **Cập nhật** `specs/main/feature/{F-XXX}-{feature-slug}/frd.md`
230
- - Dùng khi frd.md đã tồn tại integration này bổ sung thêm stories hoặc criteria
231
- - Đọc file frd.md hiện tại, liệt kê các sections và hỏi user muốn update section nào:
217
+ - Operation=create khi frd.md chưa tồn tại → nội dung đầy đủ tất cả 7 sections: Overview, User Flows, Feature-level AC, User Stories, Verification Rules, Scope, Dependencies.
218
+ - Operation=update khi frd.md đã tồn tại hỏi user chọn section cần update:
232
219
 
233
220
  ```
234
221
  frd.md — F-001 Authentication đã tồn tại.
@@ -246,10 +233,40 @@ Sections hiện có:
246
233
  Chọn section cần cập nhật (có thể chọn nhiều, ví dụ: 2 3):
247
234
  ```
248
235
 
249
- Sau khi user chọn → chỉ sinh nội dung cho section đó. Nếu chọn `A` → sinh lại toàn bộ frd.md như tạo mới.
236
+ Chỉ sinh nội dung cho section đã chọn. Nếu chọn `A` → operation=update với toàn bộ 7 sections.
250
237
 
251
- Không được bỏ qua feature nào kể cả feature `Done` vẫn phải đánh giá xem spec mới có làm thay đổi scope không.
252
- ```
238
+ **Verification Rules** trong frd.md changes block: xem mục "Verification Rules quy ước sinh" bên dưới.
239
+
240
+ **`component/{C-XXX}-{component-slug}/crd.md`**
241
+
242
+ Liệt kê **tất cả** components bị touched.
243
+
244
+ - Operation=create khi crd.md chưa tồn tại → auto-pick `C-XXX` next available + slug kebab-case, nội dung đầy đủ: Role, Responsibilities, Owned Entities, Public Interface, Business Rules, Dependencies.
245
+ - Operation=update khi crd.md đã tồn tại → chỉ section bị ảnh hưởng, có markers.
246
+
247
+ Component-level AC dùng ID `AC-C{NNN}-{seq}`, gắn vào responsibility/interface/rule liên quan.
248
+
249
+ **`prd.md`**
250
+
251
+ Tạo block nếu integration:
252
+ - Giới thiệu feature mới chưa có trong Feature Index → row [NEW] (auto-pick `F-XXX` next available)
253
+ - Giới thiệu component mới chưa có trong Component Index → row [NEW] (auto-pick `C-XXX` next available)
254
+ - Đổi status feature → row [MODIFY status]: `TODO → In Progress`
255
+ - Có scope hoặc NFR thay đổi
256
+
257
+ **`domain.md`**
258
+
259
+ Tạo block nếu integration:
260
+ - Giới thiệu glossary term mới → row [NEW] trong Glossary
261
+ - Giới thiệu shared entity mới (entity sẽ được dùng bởi 2+ component) → entity [NEW] với `Owner: C-XXX`
262
+ - Sửa định nghĩa entity hiện có → entity [MODIFY ...]
263
+
264
+ **`sad.md`**
265
+
266
+ Hiếm khi thay đổi per integration. Tạo block chỉ khi:
267
+ - Có cross-cutting concern mới
268
+ - Có guardrail mới
269
+ - Có thay đổi tech stack
253
270
 
254
271
  #### Verification Rules — quy ước sinh
255
272
 
@@ -302,39 +319,68 @@ Không được bỏ qua feature nào — kể cả feature `Done` vẫn phải
302
319
  - ❌ Đưa regex, validator code, hoặc error message vào bảng (regex/validator là HOW thuộc `fdd.md`; error/hint message là UI copy ở artifact khác).
303
320
  - ❌ Dùng tech type (`varchar(255)`, `int32`...) — phải dùng semantic type (`string`, `integer`, `email`, `enum<...>`...).
304
321
 
305
- Hiển thị draft cho user xem — **chưa ghi file**.
322
+ Cuối Bước 5: tổng hợp **Cascade Summary** table — mỗi row 1 artifact với operation + summary ngắn (vd `+1 US, +2 VR, modify VR-F001-003`). Hiển thị **toàn bộ draft** (Context, Problem, Changes, Out of Scope, Open Questions, Cascade Summary) cho user xem — **chưa ghi file, chưa cascade**.
306
323
 
307
324
  ---
308
325
 
309
326
  ### Bước 6: Review — xác nhận với user
310
327
 
311
328
  > Draft trên đã đúng chưa?
329
+ > - Mỗi Changes block (frd / crd / prd / domain / sad) có đúng operation và markers chưa?
312
330
  > - Acceptance Criteria có đủ và đo được không?
313
- > - Cascade Proposals (nếu có) cần approve trước khi tiến hành.
331
+ > - Verification Rules đã confirm với BA chưa?
332
+ > - Cascade Summary có khớp với Changes blocks không?
333
+ >
334
+ > **Sau khi confirm, agent sẽ auto-apply tất cả Changes blocks lên main artifacts.**
314
335
 
315
- Chỉ ghi file sau khi user confirm. Nếu user yêu cầu chỉnh sửa → cập nhật draft → hỏi lại.
336
+ Chỉ tiến hành Bước 7 sau khi user confirm. Nếu user yêu cầu chỉnh sửa → cập nhật draft → hỏi lại.
316
337
 
317
338
  ---
318
339
 
319
- ### Bước 7: Save
340
+ ### Bước 7: Save + Auto-cascade
320
341
 
321
342
  Tạo thư mục `specs/integrations/{NNN}-{slug}/` nếu chưa có.
322
343
 
323
- Ghi nội dung đã confirm vào `specs/integrations/{NNN}-{slug}/spec.md`. Frontmatter `features` và `components` phải được điền theo những gì đã nhận diện ở Bước 2.
344
+ **[7.1] Ghi spec.md** với status `approved` (không phải `draft` — human đã confirm Bước 6 chính là approval). Frontmatter `features` và `components` phải được điền theo những gì đã nhận diện ở Bước 2.
345
+
346
+ **[7.2] Auto-apply mỗi Changes block** vào main artifact tương ứng. Thứ tự apply (để tránh forward reference): `prd.md` → `domain.md` → `sad.md` → `component/*/crd.md` → `feature/*/frd.md`.
347
+
348
+ Cho từng block:
349
+
350
+ - **Operation=create:**
351
+ - Tạo file mới tại path tương ứng
352
+ - Nội dung = nội dung của Changes block (theo format của template gốc)
353
+ - Frontmatter của artifact mới: lấy từ template (status `draft` cho artifact mới — separate lifecycle với spec.md)
354
+
355
+ - **Operation=update:**
356
+ - Đọc artifact hiện tại
357
+ - Với mỗi item trong Changes block:
358
+ - `[NEW]` → append/insert vào section tương ứng (giữ thứ tự numeric của ID)
359
+ - `[MODIFY {field}]` → tìm item bằng ID, update field đã chỉ định, giữ nguyên các field khác
360
+ - `[REMOVE]` → xóa item khỏi artifact (ID không tái sử dụng — không renumber các ID khác)
361
+ - Ghi lại artifact
324
362
 
325
- Nếu integration này gắn với feature từ prd.md, cập nhật `specs/main/prd.md`: đổi Status của feature từ `TODO` → `In Progress`.
363
+ **[7.3] Side-effects bổ sung:**
364
+
365
+ - Nếu integration gắn với feature từ prd.md và prd.md Changes block không tự đổi status → tự động đổi `TODO` → `In Progress` cho feature đó trong prd.md.
366
+
367
+ **[7.4] Thông báo kết quả:**
326
368
 
327
- Thông báo kết quả:
328
369
  ```
329
- ✓ specs/integrations/{NNN}-{slug}/spec.md đã được tạo (status: draft)
330
- {nếu có} ✓ prd.md — F-XXX status cập nhật: TODO → In Progress
370
+ ✓ specs/integrations/{NNN}-{slug}/spec.md đã được tạo (status: approved)
371
+
372
+ Auto-cascade applied:
373
+ ✓ prd.md — {summary}
374
+ ✓ domain.md — {summary}
375
+ ✓ component/C-XXX-{slug}/crd.md — {created | updated: summary}
376
+ ✓ feature/F-XXX-{slug}/frd.md — {created | updated: summary}
331
377
 
332
378
  Bước tiếp theo:
333
- - Review spec.md và apply Cascade Proposals (nếu có) vào main artifacts thủ công
334
- - Approve spec.md (đổi status: draft → approved)
335
379
  - /spec-tech → thiết kế technical design dựa trên spec.md này
336
380
  ```
337
381
 
382
+ **Nếu apply fail** (ví dụ markers reference ID không tồn tại trong artifact hiện tại) → dừng, báo lỗi cụ thể, **không** ghi spec.md. Yêu cầu user fix draft hoặc check artifact hiện tại.
383
+
338
384
  ---
339
385
 
340
386
  ## Common Rationalizations
@@ -343,21 +389,30 @@ Bước tiếp theo:
343
389
  | --- | --- |
344
390
  | "Requirement rõ rồi, bỏ qua spec.md" | Acceptance Criteria chưa viết = không biết khi nào là done. Code xong vẫn có thể sai. |
345
391
  | "Out of scope thì ai cũng hiểu rồi" | Không ghi = scope creep không kiểm soát được. DEV sẽ tự quyết định implement hay không. |
346
- | "Cascade Proposals thì sau cập nhật cũng được" | Domain shared context. Cập nhật trễ = các spec sau dùng context sai. |
392
+ | "Skip Changes blocks, sửa main artifacts tay sau" | Mất single source of truth. spec.md PR record phải reflect đúng patch đã apply. |
347
393
 
348
394
  ## Red Flags
349
395
 
350
396
  - Acceptance Criteria dùng từ không đo được: "hoạt động đúng", "hiển thị đẹp", "nhanh"
351
397
  - Out of Scope trống — mọi integration đều có thứ liên quan nhưng không làm
352
398
  - Open Questions để trống nhưng vẫn còn điểm mơ hồ trong requirements
353
- - Cascade Proposals không được review trước khi approve
399
+ - Changes blocks không được review trước khi confirm (cascade là irreversible — không có undo)
400
+ - Marker không khớp current state: `[NEW]` cho item đã tồn tại, hoặc `[MODIFY]/[REMOVE]` cho ID không có
354
401
 
355
402
  ## Verification
356
403
 
357
- Trước khi ghi file, kiểm tra:
404
+ Trước khi user confirm (Bước 6), kiểm tra:
358
405
 
359
406
  - [ ] Problem Statement từ góc nhìn user/business, không mention tech
360
407
  - [ ] Mỗi Acceptance Criterion dùng cú pháp GIVEN / WHEN / THEN, có thể test được
361
408
  - [ ] Out of Scope có ít nhất 1 item
362
- - [ ] Cascade Proposals đã được user review
363
- - [ ] User đã confirm draft trước khi ghi file
409
+ - [ ] Mỗi Changes block Operation rõ ràng (create | update)
410
+ - [ ] Mỗi item trong update block marker đúng ([NEW]/[MODIFY {field}]/[REMOVE])
411
+ - [ ] ID assignment dựa trên max(seq)+1 đọc từ artifact hiện tại, không tái sử dụng
412
+ - [ ] Verification Rules đã confirm với BA (không tự assert)
413
+ - [ ] Cascade Summary table khớp với các Changes blocks
414
+
415
+ Sau khi user confirm (Bước 7):
416
+
417
+ - [ ] Auto-apply chạy theo thứ tự prd → domain → sad → crd → frd
418
+ - [ ] Fail-safe: nếu apply fail thì không ghi spec.md
@@ -13,84 +13,140 @@ referenced_by:
13
13
 
14
14
  ## Context
15
15
 
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
+ <!-- Tóm tắt thông tin quan trọng từ context đã load (prd.md, domain.md, frd.md, crd.md), để file self-contained -->
17
17
 
18
18
  ## Problem Statement
19
19
 
20
20
  <!-- Vấn đề cần giải quyết là gì, tại sao cần giải quyết -->
21
21
 
22
- ## Acceptance Criteria
22
+ ## Changes
23
23
 
24
24
  <!--
25
- Agent tự chọn cách tổ chức phù hợp với bản chất integration. thể mix nếu integration vừa thêm feature, vừa thay đổi component.
25
+ spec.md = changeset patch áp lên main artifacts. Mỗi block dưới đây tương ứng 1 main artifact bị thay đổi.
26
+ Bỏ block nếu artifact không bị thay đổi. Lặp block cho mỗi feature/component bị touched.
26
27
 
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
28
+ **Operation:**
29
+ - `create` artifact chưa tồn tại. Liệt kê đầy đủ tất cả sections theo template gốc, mọi item implicit [NEW] (không cần marker).
30
+ - `update` artifact đã tồn tại. Chỉ liệt sections bị ảnh hưởng. Mỗi item có marker:
31
+ - `[NEW]` — item chưa có trong artifact hiện tại
32
+ - `[MODIFY {field}]` — item đã có, đang đổi field cụ thể (ví dụ `[MODIFY priority]`, `[MODIFY rule]`)
33
+ - `[REMOVE]` — item đã có, sẽ bị xóa khỏi artifact
30
34
 
31
- Format Given/When/Then. Bỏ block không dùng.
35
+ **Format reference:** dùng đúng format của template gốc — KHÔNG duplicate skeleton ở đây. Template gốc single source of truth cho format.
36
+
37
+ **ID assignment:** agent đọc artifact hiện tại để xác định next ID:
38
+ - `US-F{NNN}-{seq}`, `AC-F{NNN}-{seq}`, `VR-F{NNN}-{seq}` cho frd.md
39
+ - `AC-C{NNN}-{seq}` cho crd.md
40
+ - ID stable — không tái sử dụng khi xóa, không renumber.
41
+
42
+ **Auto-cascade:** sau khi human approve spec.md, agent tự apply tất cả Changes blocks vào main artifacts. spec.md được archive như PR record.
32
43
  -->
33
44
 
34
- ### Feature: {feature-name} *(bỏ nếu integration không touch feature; lặp lại block cho mỗi feature)*
45
+ ### feature/{F-XXX}-{feature-slug}/frd.md *(lặp block cho mỗi feature; bỏ nếu không touch feature)*
35
46
 
36
- **Feature-level AC:**
47
+ **Operation:** create | update
48
+ **Format reference:** [frd-template.md](../../templates/main/feature/frd-template.md)
37
49
 
38
- - [ ] `AC-{F_ID}-{seq}`
39
- - **Given** {precondition}
40
- - **When** {action}
41
- - **Then** {expected outcome}
50
+ <!--
51
+ operation=create → nội dung đầy đủ theo frd-template.md (Overview, User Flows, Feature-level AC, User Stories, Verification Rules, Scope, Dependencies).
52
+ operation=update chỉ liệt kê section bị ảnh hưởng, mỗi item có marker.
42
53
 
43
- #### US-{F_ID}-{seq}: {Story title}
54
+ dụ operation=update:
44
55
 
45
- **{Persona}** muốn **{hành động}** để **{mục tiêu}**.
56
+ #### User Stories
46
57
 
47
- **Priority:** Must / Should / Could
58
+ ##### US-F001-005 [NEW]: {Story title}
59
+ **{Persona}** muốn **{action}** để **{goal}**.
60
+ **Priority:** Must
61
+ **Acceptance Criteria:**
62
+ - `AC-F001-012` [NEW]
63
+ - **Given** ...
64
+ - **When** ...
65
+ - **Then** ...
48
66
 
49
- **Story AC:**
67
+ ##### US-F001-002 [MODIFY priority]
68
+ - Priority: Should → Must
50
69
 
51
- - [ ] `AC-{F_ID}-{seq}`
52
- - **Given** {precondition}
53
- - **When** {action}
54
- - **Then** {expected outcome}
70
+ ##### US-F001-004 [REMOVE]
71
+ - do: superseded by US-F001-005
55
72
 
56
- ### Component: `{C-XXX}-{component-name}` *(bỏ nếu integration không touch component; lặp lại block cho mỗi component)*
73
+ #### Verification Rules
57
74
 
58
- **AC theo responsibility / interface / rule:**
75
+ | ID | Field | Type | Required | Rule | Refs | Op |
76
+ | --- | --- | --- | --- | --- | --- | --- |
77
+ | `VR-F001-008` | email | email | yes | must be unique | US-F001-005 | NEW |
78
+ | `VR-F001-003` | password | string | yes | min length 12 (was 8) | US-F001-001 | MODIFY rule |
79
+ -->
59
80
 
60
- - [ ] `AC-{C_ID}-{seq}` {responsibility / interface / rule tả}
61
- - **Given** {precondition}
62
- - **When** {action}
63
- - **Then** {expected outcome}
81
+ ### component/{C-XXX}-{component-slug}/crd.md *(lặp block cho mỗi component; bỏ nếu không touch component)*
64
82
 
65
- ## Out of Scope
83
+ **Operation:** create | update
84
+ **Format reference:** [crd-template.md](../../templates/main/component/crd-template.md)
66
85
 
67
- <!-- Những gì KHÔNG thuộc phạm vi của integration này -->
86
+ <!--
87
+ operation=create → nội dung đầy đủ theo crd-template.md (Role, Responsibilities, Owned Entities, Public Interface, Business Rules, Dependencies).
88
+ operation=update → chỉ liệt kê section bị ảnh hưởng, mỗi item có marker (xem ví dụ ở block frd.md).
68
89
 
69
- ## Open Questions
90
+ Component-level AC dùng ID `AC-C{NNN}-{seq}`, gắn vào responsibility/interface/rule liên quan.
91
+ -->
70
92
 
71
- <!-- Các điểm còn mơ hồ cần clarify trước khi proceed. Xóa section nếu không có. -->
93
+ ### prd.md *(bỏ nếu không thay đổi)*
72
94
 
73
- ## Cascade Proposals
95
+ **Operation:** update
96
+ **Format reference:** [prd-template.md](../../templates/main/prd-template.md)
74
97
 
75
- <!-- Agent điền vào nếu phát hiện main artifacts cần cập nhật -->
76
- <!-- Human review section này TRƯỚC khi approve spec.md -->
98
+ <!--
99
+ Thường update thêm row vào Feature Index / Component Index, đổi status feature, thêm NFR, thêm business constraint, thêm glossary reference.
100
+ Mỗi delta dùng marker, ví dụ:
77
101
 
78
- ### prd.md
102
+ #### Features (Feature Index)
103
+ - Row [NEW]: `F-007 — Refund | Cho phép user refund order | Medium | TODO`
104
+ - Row [MODIFY status]: `F-001` TODO → In Progress
79
105
 
80
- Không thay đổi đề xuất.
106
+ #### Components (Component Index)
107
+ - Row [NEW]: `C-005 — refund-processor | Xử lý refund workflow | TODO`
108
+ -->
81
109
 
82
- ### domain.md
110
+ ### domain.md *(bỏ nếu không có thay đổi)*
83
111
 
84
- Không có thay đổi đề xuất.
112
+ **Operation:** update
113
+ **Format reference:** [domain-template.md](../../templates/main/domain-template.md)
85
114
 
86
- ### component/{C-XXX}-{component-name}/crd.md
115
+ <!--
116
+ Thường là update — thêm glossary term, thêm shared entity, sửa entity definition.
87
117
 
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. -->
118
+ #### Glossary
119
+ - Row [NEW]: `Refund — số tiền hoàn lại cho user sau khi order bị hủy`
89
120
 
90
- Không thay đổi đề xuất.
121
+ #### Shared Entities
122
+ - Entity [NEW]: `Refund (Owner: C-005-refund-processor)` — { fields, relationships }
123
+ -->
124
+
125
+ ### sad.md *(bỏ nếu không có thay đổi)*
126
+
127
+ **Operation:** update
128
+ **Format reference:** [sad-template.md](../../templates/main/sad-template.md)
129
+
130
+ <!--
131
+ Thường là update — thêm tech stack item, thêm cross-cutting concern, thêm guardrail. Hiếm khi thay đổi per integration.
132
+ -->
133
+
134
+ ## Out of Scope
135
+
136
+ <!-- Những gì KHÔNG thuộc phạm vi của integration này -->
137
+
138
+ ## Open Questions
139
+
140
+ <!-- Các điểm còn mơ hồ cần clarify trước khi proceed. Xóa section nếu không có. -->
91
141
 
92
- ### feature/{F-XXX}-{feature-name}/frd.md
142
+ ## Cascade Summary
93
143
 
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. -->
144
+ <!-- Bảng tóm tắt để reviewer scan nhanh trước khi approve. Auto-generated từ các Changes blocks trên. -->
95
145
 
96
- Không thay đổi đề xuất.
146
+ | Artifact | Operation | Summary |
147
+ | --- | --- | --- |
148
+ | `feature/F-XXX-{slug}/frd.md` | create / update | {ngắn: +N US, +M VR, modify AC-X} |
149
+ | `component/C-XXX-{slug}/crd.md` | create / update | {ngắn} |
150
+ | `prd.md` | update | {ngắn} |
151
+ | `domain.md` | update | {ngắn} |
152
+ | `sad.md` | update / no-op | {ngắn} |
@@ -6,9 +6,16 @@ owner: "{BA / Tech Lead}"
6
6
  component_id: "{Component ID từ PRD Component Index, ví dụ C-001}"
7
7
  referenced_by:
8
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
9
+ - skills/spec-new/SKILL.md > Process > Bước 5: Write — sinh draft > component/{C-XXX}/crd.md
10
+ - templates/integrations/spec-template.md > Changes > component/{C-XXX}/crd.md
10
11
  ---
11
12
 
13
+ <!--
14
+ Canonical format cho component/{C-XXX}-{slug}/crd.md.
15
+ spec.md và tech.md REFERENCE template này khi sinh Changes block — KHÔNG duplicate skeleton.
16
+ Mọi thay đổi structure ở file này tự động propagate qua Changes blocks vì chúng dùng đây làm format gốc.
17
+ -->
18
+
12
19
  # Component: {Component Name}
13
20
 
14
21
  ## Role
@@ -6,9 +6,16 @@ owner: "{BA}"
6
6
  feature_id: "{Feature ID từ PRD Feature Index}"
7
7
  referenced_by:
8
8
  - conventions.md > 3. Main Artifacts > 3.3 Feature level > frd.md > Cấu trúc
9
- - skills/spec-new/SKILL.md > Process > Bước 5: Write — sinh draft > Cascade Proposals > frd.md
9
+ - skills/spec-new/SKILL.md > Process > Bước 5: Write — sinh draft > feature/{F-XXX}/frd.md
10
+ - templates/integrations/spec-template.md > Changes > feature/{F-XXX}/frd.md
10
11
  ---
11
12
 
13
+ <!--
14
+ Canonical format cho feature/{F-XXX}-{slug}/frd.md.
15
+ spec.md và tech.md REFERENCE template này khi sinh Changes block — KHÔNG duplicate skeleton.
16
+ Mọi thay đổi structure ở file này tự động propagate qua Changes blocks vì chúng dùng đây làm format gốc.
17
+ -->
18
+
12
19
  # Feature: {Feature Name}
13
20
 
14
21
  ## Overview