spec-lite 1.5.2 → 1.6.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 CHANGED
@@ -45,7 +45,7 @@ BA author `.specs/main/feature/{F-XXX}-*/frd.md` trực tiếp qua interview, **
45
45
 
46
46
  Phạm vi hẹp: **chủ yếu frd.md** (+ tối đa một feature row vào prd nếu register). Reference component frd phụ thuộc (Components Used); component cần-nhưng-chưa-có ghi như *candidate* để `/spec-sad`/architect chốt boundary. **KHÔNG** tạo `crd.md`/`cdd.md` — component artifacts sinh ở integration time qua `/spec-new` cascade. Change History operation = `manual`. Nếu bỏ qua bước này, `/spec-new` vẫn tự tạo frd làm fallback.
47
47
 
48
- Sections: Overview · User Flows · Feature Acceptance Criteria · User Stories · Verification Rules · Scope · Dependencies
48
+ Sections: Overview · User Flows · Feature Acceptance Criteria (end-to-end) · Non-Functional Requirements · Data & Migration *(nếu có)* · User Stories · Verification Rules · Scope · Dependencies
49
49
 
50
50
  ---
51
51
 
@@ -63,7 +63,7 @@ Scan codebase để extract main artifacts, sau đó vào Integration Pipeline.
63
63
  /spec-brownfield-feature
64
64
 
65
65
 
66
- /spec-tsd [F-XXX] (tùy chọn — bootstrap tsd.md cho từng feature)
66
+ /spec-test-design [F-XXX] (tùy chọn — bootstrap test-design.md cho từng feature)
67
67
 
68
68
 
69
69
  (fill in NEEDS_CLARIFY khi có thêm context)
@@ -81,8 +81,8 @@ Scan module dirs, tạo `crd.md` + `cdd.md` cho từng component, điền Compon
81
81
  #### `/spec-brownfield-feature [path]`
82
82
  Scan routes/use cases/tests, tạo `frd.md` + `fdd.md` cho từng feature, điền Feature Index vào `prd.md`. Yêu cầu `component` đã chạy (fdd.md cần C-XXX IDs từ Component Index).
83
83
 
84
- #### `/spec-tsd [F-XXX]`
85
- Bootstrap `feature/{F-XXX}/tsd.md` (Test Spec Document) trực tiếp từ `frd.md` — mechanical derive Test Scenarios + Test Cases (mỗi Flow → TS, mỗi US/AC → Functional TC, mỗi VR → ≥1 positive + 1+ negative, mỗi FAC → Feature AC TC). Không interview, không cần integration. Dùng sau `/spec-brownfield-feature` để có test coverage tracking từ ngày 1, hoặc khi tsd drift khỏi frd cần regenerate fresh.
84
+ #### `/spec-test-design [F-XXX]`
85
+ Bootstrap `feature/{F-XXX}/test-design.md` (Test Design Document) trực tiếp từ `frd.md` — mechanical derive Test Scenarios + Test Cases (mỗi Flow → TS, mỗi US/AC → Functional TC, mỗi VR → ≥1 positive + 1+ negative, mỗi FAC → E2E TC, mỗi NFR → Non-functional TC, mỗi DM → Data & Migration TC). Không interview, không cần integration. Dùng sau `/spec-brownfield-feature` để có test coverage tracking từ ngày 1, hoặc khi test-design drift khỏi frd cần regenerate fresh.
86
86
 
87
87
  > **NEEDS_CLARIFY:** Các mục chưa rõ khi scan được đánh dấu `[NEEDS_CLARIFY]` — không block workflow, fill in dần khi có thêm context.
88
88
 
@@ -99,7 +99,7 @@ Mỗi requirement mới đều đi qua pipeline này.
99
99
  ├─────────────────┐
100
100
  ▼ ▼
101
101
  /spec-tech /spec-test (song song — cả hai chỉ phụ thuộc spec.md)
102
- (DEV approve) (QC approve, cascade lên feature/*/tsd.md)
102
+ (DEV approve) (QC approve, cascade lên feature/*/test-design.md)
103
103
  │ │
104
104
  └────────┬────────┘
105
105
 
@@ -126,7 +126,7 @@ Tạo `.specs/integrations/{slug}/tech.md` sau khi `spec.md` được approve. C
126
126
  - Không có argument → hiển thị danh sách tất cả integrations
127
127
 
128
128
  #### `/spec-test [number]`
129
- Tạo `.specs/integrations/{slug}/test.md` sau khi `spec.md` được approve. Chạy bởi **QC**, **song song / độc lập** với `/spec-tech` — cả hai chỉ phụ thuộc `spec.md`. Mechanical derive Test Scenarios + Test Cases từ frd.md (Flow → TS, US/AC → Functional TC, VR → positive + negative, FAC → Feature AC TC), priority deterministic. Cascade lên `feature/{F-XXX}/tsd.md` qua Changes blocks. Gate: integration phải có `features:` non-empty (component-thuần không áp dụng).
129
+ Tạo `.specs/integrations/{slug}/test.md` sau khi `spec.md` được approve. Chạy bởi **QC**, **song song / độc lập** với `/spec-tech` — cả hai chỉ phụ thuộc `spec.md`. Mechanical derive Test Scenarios + Test Cases từ frd.md (Flow → TS, US/AC → Functional TC, VR → positive + negative, FAC → E2E TC, NFR → Non-functional TC, DM → Data & Migration TC), priority deterministic. Cascade lên `feature/{F-XXX}/test-design.md` qua Changes blocks. Gate: integration phải có `features:` non-empty (component-thuần không áp dụng).
130
130
 
131
131
  #### `/plan`
132
132
  Tạo `plan.md` và `todo.md` từ `spec.md` + `tech.md`.
@@ -171,12 +171,12 @@ Migrate **main artifact** lỗi thời lên structure mới (mọi main type). T
171
171
  | `/spec-brownfield-init` | `.specs/main/prd.md`, `.specs/main/domain.md`, `.specs/main/sad.md` |
172
172
  | `/spec-brownfield-component` | `.specs/main/component/{C-XXX}-*/crd.md + cdd.md` |
173
173
  | `/spec-brownfield-feature` | `.specs/main/feature/{F-XXX}-*/frd.md + fdd.md` |
174
- | `/spec-tsd` | `.specs/main/feature/{F-XXX}-*/tsd.md` |
174
+ | `/spec-test-design` | `.specs/main/feature/{F-XXX}-*/test-design.md` |
175
175
  | `/artifact-audit` | *(báo cáo out-dated; + stamp `template_version` cho main artifact legacy conform)* |
176
176
  | `/artifact-migrate` | *(modify in-place main artifact lỗi thời lên structure mới + set `template_version`)* |
177
177
  | `/spec-new` | `.specs/integrations/{slug}/spec.md` |
178
178
  | `/spec-tech` | `.specs/integrations/{slug}/tech.md` |
179
- | `/spec-test` | `.specs/integrations/{slug}/test.md`, cascade: `feature/{F-XXX}/tsd.md` |
179
+ | `/spec-test` | `.specs/integrations/{slug}/test.md`, cascade: `feature/{F-XXX}/test-design.md` |
180
180
  | `/plan` | `.specs/integrations/{slug}/plan.md`, `todo.md` |
181
181
  | `/build` | *(implements tasks từ `plan.md`/`todo.md`)* |
182
182
  | `/review-integration` | *(findings report — không tạo file)* |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-lite",
3
- "version": "1.5.2",
3
+ "version": "1.6.0",
4
4
  "description": "Spec-driven development kit for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
@@ -216,7 +216,7 @@ Sau khi tất cả tickets đã được tạo, cập nhật `spec.md`:
216
216
  ### Feature: Đăng ký / Đăng nhập (F-001)
217
217
  **ADO:** [#12345 — [SDLC-TEST] Đăng ký / Đăng nhập](https://dev.azure.com/...)
218
218
 
219
- **Feature-level Acceptance Criteria:**
219
+ **Feature Acceptance Criteria:**
220
220
  ```
221
221
 
222
222
  **Với User Story ticket thành công:** Thêm dòng `**ADO:**` ngay sau heading user story:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: artifact-audit
3
- description: Audit MAIN artifacts trong .specs/main/ xem có lỗi thời so với template không (chỉ main artifacts — prd/domain/sad/frd/fdd/tsd/crd/cdd; integration artifacts ngoài scope). So `template_version` của artifact với `template_version` hiện tại đọc thẳng từ template (.claude/templates/). Versioned khớp → up-to-date, lệch → out-dated (in vX → vY). Artifact thiếu version (sinh trước versioning) → đối chiếu structure với template: khớp thì stamp version, lệch thì flag out-dated. KHÔNG tự migrate — chỉ stamp khi chắc chắn khớp + báo cáo. Nhận tùy chọn 1 hay nhiều main type làm scope (vd `frd`, `frd,crd`); không có arg → audit mọi main type.
3
+ description: Audit MAIN artifacts trong .specs/main/ xem có lỗi thời so với template không (chỉ main artifacts — prd/domain/sad/frd/fdd/test-design/crd/cdd; integration artifacts ngoài scope). So `template_version` của artifact với `template_version` hiện tại đọc thẳng từ template (.claude/templates/). Versioned khớp → up-to-date, lệch → out-dated (in vX → vY). Artifact thiếu version (sinh trước versioning) → đối chiếu structure với template: khớp thì stamp version, lệch thì flag out-dated. KHÔNG tự migrate — chỉ stamp khi chắc chắn khớp + báo cáo. Nhận tùy chọn 1 hay nhiều main type làm scope (vd `frd`, `frd,crd`); không có arg → audit mọi main type.
4
4
  ---
5
5
 
6
6
  # artifact-audit
@@ -9,7 +9,7 @@ description: Audit MAIN artifacts trong .specs/main/ xem có lỗi thời so v
9
9
 
10
10
  Trả lời một câu hỏi: **main artifact nào trong `.specs/main/` đã lỗi thời so với template mới nhất?**
11
11
 
12
- > **Scope = chỉ main artifacts** (`prd`, `domain`, `sad`, `frd`, `fdd`, `tsd`, `crd`, `cdd` — đều nằm dưới `.specs/main/`). Integration artifacts (`spec`, `tech`, `test`, `plan`, `todo`, `techdebt` dưới `.specs/integrations/`) **không** thuộc scope của skill này — chúng là ephemeral và immutable sau khi `done`, không audit/migrate theo version.
12
+ > **Scope = chỉ main artifacts** (`prd`, `domain`, `sad`, `frd`, `fdd`, `test-design`, `crd`, `cdd` — đều nằm dưới `.specs/main/`). Integration artifacts (`spec`, `tech`, `test`, `plan`, `todo`, `techdebt` dưới `.specs/integrations/`) **không** thuộc scope của skill này — chúng là ephemeral và immutable sau khi `done`, không audit/migrate theo version.
13
13
 
14
14
  Cơ chế (xem `conventions.md` §7 Template Versioning):
15
15
  - **Nguồn sự thật** = `template_version` trong frontmatter template đang cài (`.claude/templates/...`). Đọc thẳng lúc chạy — không manifest, không cache.
@@ -43,7 +43,7 @@ Type của main artifact resolve theo **filename**. Mỗi type map tới đúng
43
43
  | `sad.md` | sad | `main/sad-template.md` |
44
44
  | `frd.md` | frd | `main/feature/frd-template.md` |
45
45
  | `fdd.md` | fdd | `main/feature/fdd-template.md` |
46
- | `tsd.md` | tsd | `main/feature/tsd-template.md` |
46
+ | `test-design.md` | test-design | `main/feature/test-design-template.md` |
47
47
  | `crd.md` | crd | `main/component/crd-template.md` |
48
48
  | `cdd.md` | cdd | `main/component/cdd-template.md` |
49
49
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: artifact-migrate
3
- description: Migrate MAIN artifact trong .specs/main/ lên structure template mới nhất (chỉ main artifacts — prd/domain/sad/frd/fdd/tsd/crd/cdd; integration artifacts ngoài scope). Tự chạy /artifact-audit (classify-only, scoped) để phát hiện out-dated, rồi áp delta từ block `migrations` của template — add section thiếu, remove section deprecated, update format section (vd ASCII→Mermaid) — set template_version = current. Tương tác: confirm add/remove/update, hỏi carry-over khi rename, section nội dung mới thì interview hoặc NEEDS_CLARIFY (không bịa). Single-artifact, KHÔNG cascade. Nhận tùy chọn 1 main artifact (path); không có arg → quét mọi main artifact, migrate từng cái có confirm + skip.
3
+ description: Migrate MAIN artifact trong .specs/main/ lên structure template mới nhất (chỉ main artifacts — prd/domain/sad/frd/fdd/test-design/crd/cdd; integration artifacts ngoài scope). Tự chạy /artifact-audit (classify-only, scoped) để phát hiện out-dated, rồi áp delta từ block `migrations` của template — add section thiếu, remove section deprecated, update format section (vd ASCII→Mermaid) — set template_version = current. Tương tác: confirm add/remove/update, hỏi carry-over khi rename, section nội dung mới thì interview hoặc NEEDS_CLARIFY (không bịa). Single-artifact, KHÔNG cascade. Nhận tùy chọn 1 main artifact (path); không có arg → quét mọi main artifact, migrate từng cái có confirm + skip.
4
4
  ---
5
5
 
6
6
  # artifact-migrate
@@ -9,7 +9,7 @@ description: Migrate MAIN artifact trong .specs/main/ lên structure template m
9
9
 
10
10
  Đưa một main artifact (hoặc toàn bộ main artifacts) **lỗi thời** lên đúng structure của template mới nhất, rồi cập nhật `template_version`. Đây là vế **fix** đối xứng với `/artifact-audit` (vế **detect**).
11
11
 
12
- > **Scope = chỉ main artifacts** (`prd`, `domain`, `sad`, `frd`, `fdd`, `tsd`, `crd`, `cdd` — đều dưới `.specs/main/`). Integration artifacts (`spec`, `tech`, `test`, `plan`, `todo`, `techdebt`) **không** thuộc scope — ephemeral + immutable sau `done`, không migrate theo version.
12
+ > **Scope = chỉ main artifacts** (`prd`, `domain`, `sad`, `frd`, `fdd`, `test-design`, `crd`, `cdd` — đều dưới `.specs/main/`). Integration artifacts (`spec`, `tech`, `test`, `plan`, `todo`, `techdebt`) **không** thuộc scope — ephemeral + immutable sau `done`, không migrate theo version.
13
13
 
14
14
  Cơ chế (xem `conventions.md` §7 Template Versioning):
15
15
  - **Required section hiện tại** = body `##` headings của template (deterministic theo level; `###` = instance).
@@ -34,7 +34,7 @@ Cơ chế (xem `conventions.md` §7 Template Versioning):
34
34
 
35
35
  Resolve type của main artifact theo **filename** (giống `/artifact-audit`). Mỗi type map tới đúng một template tại `.claude/templates/...`:
36
36
 
37
- `prd.md`→`main/prd-template.md` · `domain.md`→`main/domain-template.md` · `sad.md`→`main/sad-template.md` · `frd.md`→`main/feature/frd-template.md` · `fdd.md`→`main/feature/fdd-template.md` · `tsd.md`→`main/feature/tsd-template.md` · `crd.md`→`main/component/crd-template.md` · `cdd.md`→`main/component/cdd-template.md`
37
+ `prd.md`→`main/prd-template.md` · `domain.md`→`main/domain-template.md` · `sad.md`→`main/sad-template.md` · `frd.md`→`main/feature/frd-template.md` · `fdd.md`→`main/feature/fdd-template.md` · `test-design.md`→`main/feature/test-design-template.md` · `crd.md`→`main/component/crd-template.md` · `cdd.md`→`main/component/cdd-template.md`
38
38
 
39
39
  **Chỉ main artifacts.** Integration artifacts (`spec`/`tech`/`test`/`plan`/`todo`/`techdebt`) ngoài scope → bỏ qua. File không khớp map → cũng bỏ qua.
40
40
 
@@ -289,7 +289,7 @@ Brownfield init hoàn tất! Main artifacts:
289
289
  └── feature/ ({N} features, mỗi cái có frd.md + fdd.md)
290
290
 
291
291
  Bước tiếp theo (tùy chọn):
292
- /spec-tsd [F-XXX] → bootstrap tsd.md (Test Spec Document) cho từng feature
292
+ /spec-test-design [F-XXX] → bootstrap test-design.md (Test Design Document) cho từng feature
293
293
  — derive 1:1 từ frd.md, có test coverage tracking từ ngày 1.
294
294
 
295
295
  Để bắt đầu implement, dùng /spec-new để tạo integration đầu tiên.
@@ -9,7 +9,7 @@ description: Author MỚI frd.md (Feature Requirements Document) trực tiếp
9
9
 
10
10
  Author `.specs/main/feature/{F-XXX}-{feature-slug}/frd.md` trực tiếp qua interview — **spec-first ở feature level**, do **BA** chạy trước khi bất kỳ integration nào bắt đầu.
11
11
 
12
- `frd.md` là **what to build** của một feature: Overview, User Flows, Feature AC, User Stories, Verification Rules, Scope, Dependencies. Đây là baseline ổn định, **author một lần** — mọi thay đổi sau đó đi qua `/spec-new` (delta cascade).
12
+ `frd.md` là **what to build** của một feature: Overview, User Flows, Feature AC (end-to-end), Non-Functional Requirements, Data & Migration, User Stories, Verification Rules, Scope, Dependencies. Đây là baseline ổn định, **author một lần** — mọi thay đổi sau đó đi qua `/spec-new` (delta cascade).
13
13
 
14
14
  Skill này là cặp greenfield đối xứng với `/spec-brownfield-feature` (vốn reverse-engineer frd từ code). Khác biệt: `/spec-frd` author *forward* từ interview, không scan code.
15
15
 
@@ -23,7 +23,7 @@ Skill này là cặp greenfield đối xứng với `/spec-brownfield-feature` (
23
23
  - ✅ Nếu feature mục tiêu là feature mới chưa có trong Index → **register một row vào `prd.md > Features`** (side-effect hợp lệ lên prd).
24
24
  - ✅ **Cascade vocabulary lên `domain.md`** (Bước 4b — pha *mô tả hệ thống*/WHAT): glossary term + **định nghĩa entity đầy đủ** (attributes). `Owner` của entity để `TBD` cho `/spec-sad` điền ở pha *thiết kế hệ thống* (HOW). BA duyệt trước khi ghi. Đây là điểm khác với phiên bản trước (`/spec-frd` từng không đụng domain) — vocabulary sinh ra ở feature-authoring time nên seed luôn, thay vì để domain rỗng tới integration đầu tiên.
25
25
  - ❌ KHÔNG tạo/sửa `crd.md`/`cdd.md` — component artifacts ra đời ở integration time qua `/spec-new` cascade.
26
- - ❌ KHÔNG tạo `fdd.md` (inter-component design) hay `tsd.md` (test) — để skill/role khác lo.
26
+ - ❌ KHÔNG tạo `fdd.md` (inter-component design) hay `test-design.md` (test) — để skill/role khác lo.
27
27
  - ❌ KHÔNG carve component / quyết `Owner` của shared entity (để `/spec-sad`/`/spec-new`); KHÔNG đổi status feature đã có; KHÔNG đụng sad.
28
28
 
29
29
  ## When to Use
@@ -180,9 +180,14 @@ Hỏi tuần tự, từng phần — không hỏi tất cả cùng lúc. Nếu B
180
180
  **Phần 3 — User Stories:**
181
181
  > Liệt kê các stories ở cấp feature: "{Persona} muốn {hành động} để {mục tiêu}". Mỗi story có priority (Must/Should/Could) và acceptance criteria (Given/When/Then).
182
182
 
183
- **Phần 4 — Feature Acceptance Criteria:**
184
- > Có criteria nào áp cho *toàn* feature mà story lẻ không cover? (e2e liên story, cross-story consistency, NFR như performance/accessibility, data & migration)
185
- > Mỗi cái Given/When/Then, **Then phải đo được**.
183
+ **Phần 4 — Feature Acceptance Criteria (end-to-end):**
184
+ > Có criteria **end-to-end** nào áp cho *toàn* feature mà story lẻ không cover? 3 shape: journey (tuần tự liên story) + consistency (đa màn) + integrity (bất biến liên story, không tuần tự — vd cascade delete, đối soát khớp). Mỗi cái Given/When/Then, **Then phải đo được**. (NFR và data/migration hỏi riêng ở Phần 4b / 4c.)
185
+
186
+ **Phần 4b — Non-Functional Requirements:**
187
+ > Feature có yêu cầu non-functional riêng không? (performance, accessibility, security, browser, i18n). Mỗi cái **tham chiếu `NFR-*` của PRD nếu có** (refine bar chung) hoặc đặc thù-feature. G/W/T, Then đo được. Không có → để section trống (required-emptyable, giữ heading).
188
+
189
+ **Phần 4c — Data & Migration:**
190
+ > Feature có đụng migration / backfill data cũ không? Nếu có: G/W/T, Then đo được (đếm bản ghi / so khớp). Không có → giữ heading, để section trống (required-emptyable).
186
191
 
187
192
  **Phần 5 — Verification Rules:**
188
193
  > Với mỗi input field trong các stories, mình sẽ suggest 2-4 phương án validation để BA chọn (xem "Verification Rules — quy ước sinh" bên dưới). BA là người quyết định.
@@ -246,7 +251,7 @@ BA quyết **định nghĩa entity** (WHAT); `Owner` để `/spec-sad` cascade b
246
251
 
247
252
  Dùng `.claude/templates/main/feature/frd-template.md` làm skeleton, điền nội dung từ interview.
248
253
 
249
- **ID assignment** (luôn là create — frd mới): US `US-F{NNN}-001+`, Story AC `AC-F{NNN}-001+`, Feature AC `FAC-F{NNN}-001+` (counter độc lập với Story AC), VR `VR-F{NNN}-001+`. `NNN` = số của F-XXX. Flow đánh số từ 1.
254
+ **ID assignment** (luôn là create — frd mới): US `US-F{NNN}-001+`, Story AC `AC-F{NNN}-001+`, Feature AC `FAC-F{NNN}-001+` (counter độc lập với Story AC), NFR `NFR-F{NNN}-001+` (counter độc lập), DM `DM-F{NNN}-001+` (counter độc lập, chỉ khi có Data & Migration), VR `VR-F{NNN}-001+`. `NNN` = số của F-XXX. Flow đánh số từ 1.
250
255
 
251
256
  **Frontmatter** frd mới: theo template, `status: draft`, `owner: BA`, `feature_id: F-XXX`, `template_version` copy từ `frd-template.md` (xem `conventions.md` §7 — chỉ set lúc CREATE; thay đổi sau qua `/spec-new` không đụng version).
252
257
 
@@ -331,7 +336,7 @@ Append **một** Change History entry vào `domain.md`, operation = `manual` (au
331
336
 
332
337
  (Nếu domain.md đang là skeleton create lần đầu thì entry vẫn `manual`/`update` — file đã được `/spec-prd` scaffold với operation `create` từ trước.) Atomic với 7a: domain cascade fail → rollback cả frd. `Owner` của entity do `/spec-sad`/`/spec-new` cascade bổ sung sau (HOW phase) qua `[MODIFY Owner]`.
333
338
 
334
- **7c. KHÔNG đụng gì khác.** Không đổi status của các feature *đã có* (frd tồn tại ≠ integration bắt đầu; marker "→ frd.md tồn tại" derive từ file existence). Không thêm component vào Index (chỉ candidate). Không carve component / không tự quyết `Owner` của shared entity. Không tạo crd/cdd/fdd/tsd. Không đụng sad.
339
+ **7c. KHÔNG đụng gì khác.** Không đổi status của các feature *đã có* (frd tồn tại ≠ integration bắt đầu; marker "→ frd.md tồn tại" derive từ file existence). Không thêm component vào Index (chỉ candidate). Không carve component / không tự quyết `Owner` của shared entity. Không tạo crd/cdd/fdd/test-design. Không đụng sad.
335
340
 
336
341
  **7d. Thông báo kết quả:**
337
342
 
@@ -349,7 +354,7 @@ Append **một** Change History entry vào `domain.md`, operation = `manual` (au
349
354
  - VR-F{NNN}-{seq} — {field}
350
355
 
351
356
  Bước tiếp theo:
352
- - /spec-tsd F-XXX → QC bootstrap test spec từ frd này
357
+ - /spec-test-design F-XXX → QC bootstrap test design từ frd này
353
358
  - /spec-new F-XXX → DEV bắt đầu integration (frd sẽ được consume, crd/cdd sinh qua cascade)
354
359
  {nếu có candidate hoặc entity Owner TBD} - /spec-sad → architect chốt boundary component + gán Owner cho shared entity
355
360
  ```
@@ -388,12 +393,14 @@ Bước tiếp theo:
388
393
  - [ ] frd.md có đủ 7 core sections (luôn create mới); `Open Questions` chứa câu hỏi clarify + component candidate còn mở, hoặc đã xóa nếu rỗng
389
394
  - [ ] Frontmatter có `template_version` copy từ `frd-template.md`
390
395
  - [ ] Mỗi User Story có persona + priority + ít nhất 1 AC Given/When/Then
391
- - [ ] Feature AC dùng ID `FAC-F{NNN}-{seq}` (counter độc lập với `AC-F{NNN}`), Then đo được
396
+ - [ ] Feature AC chỉ end-to-end (journey + consistency + integrity), ID `FAC-F{NNN}-{seq}` (counter độc lập với `AC-F{NNN}`), Then đo được; authz/access-control functional → AC/VR, không phải NFR
397
+ - [ ] Non-Functional Requirements: heading luôn có (required-emptyable); nếu có item → ID `NFR-F{NNN}-{seq}`, tham chiếu `NFR-*` PRD nếu có thể, Then đo được
398
+ - [ ] Data & Migration (required-emptyable): ID `DM-F{NNN}-{seq}`, Then đo được; không đụng migration → giữ heading, để trống
392
399
  - [ ] Verification Rules đã confirm với BA (không tự assert); không chứa regex/code/error message; semantic type
393
400
  - [ ] ID bắt đầu từ 001 (create mới)
394
401
  - [ ] Components Used reference C-XXX có sẵn; component mới ghi candidate + surface cho /spec-sad
395
402
  - [ ] Nếu register feature mới: prd Features có row [NEW] + Change History entry; status feature đã có KHÔNG đổi
396
403
  - [ ] Domain cascade (nếu có vocabulary mới, đã BA confirm): Glossary term ghi đủ định nghĩa; Shared Entity ghi đủ definition + attributes với `Owner: TBD` (KHÔNG tự gán C-XXX); domain.md có Change History entry operation = `manual`
397
- - [ ] KHÔNG tạo crd/cdd/fdd/tsd; KHÔNG carve component / gán Owner entity; KHÔNG đụng sad
404
+ - [ ] KHÔNG tạo crd/cdd/fdd/test-design; KHÔNG carve component / gán Owner entity; KHÔNG đụng sad
398
405
  - [ ] Change History entry (frd) operation = `manual` (luôn `create`)
399
406
  - [ ] User đã confirm trước khi ghi file
@@ -91,11 +91,13 @@ Sections hiện có:
91
91
 
92
92
  [1] Overview
93
93
  [2] User Flows
94
- [3] Feature-level Acceptance Criteria
95
- [4] User Stories
96
- [5] Verification Rules
97
- [6] Scope (In Scope / Out of Scope)
98
- [7] Dependencies (Feature Dependencies + Components Used)
94
+ [3] Feature Acceptance Criteria (end-to-end)
95
+ [4] Non-Functional Requirements
96
+ [5] Data & Migration (required-emptyable)
97
+ [6] User Stories
98
+ [7] Verification Rules
99
+ [8] Scope (In Scope / Out of Scope)
100
+ [9] Dependencies (Feature Dependencies + Components Used)
99
101
  [A] All — viết lại toàn bộ từ đầu
100
102
  [S] Lên spec từ frd.md hiện tại — frd.md đã đầy đủ, không cần chỉnh
101
103
 
@@ -241,7 +243,7 @@ Template gốc là single source of truth cho format. KHÔNG duplicate skeleton
241
243
 
242
244
  Liệt kê **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.
243
245
 
244
- - 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.
246
+ - Operation=create khi frd.md chưa tồn tại → nội dung đầy đủ các section: Overview, User Flows, Feature Acceptance Criteria (end-to-end), Non-Functional Requirements (required-emptyable), Data & Migration (required-emptyable), User Stories, Verification Rules, Scope, Dependencies.
245
247
  - Operation=update khi frd.md đã tồn tại → hỏi user chọn section cần update:
246
248
 
247
249
  ```
@@ -250,11 +252,13 @@ Sections hiện có:
250
252
 
251
253
  [1] Overview
252
254
  [2] User Flows
253
- [3] Feature-level Acceptance Criteria
254
- [4] User Stories
255
- [5] Verification Rules
256
- [6] Scope (In Scope / Out of Scope)
257
- [7] Dependencies (Feature Dependencies + Components Used)
255
+ [3] Feature Acceptance Criteria (end-to-end)
256
+ [4] Non-Functional Requirements
257
+ [5] Data & Migration (required-emptyable)
258
+ [6] User Stories
259
+ [7] Verification Rules
260
+ [8] Scope (In Scope / Out of Scope)
261
+ [9] Dependencies (Feature Dependencies + Components Used)
258
262
  [A] All — viết lại toàn bộ từ đầu
259
263
 
260
264
  Chọn section cần cập nhật (có thể chọn nhiều, ví dụ: 2 3):
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: spec-test
3
- description: Tạo test.md cho một integration bằng cách mechanical derive Test Scenarios + Test Cases từ Flows/US/AC/VR/FAC trong frd.md. Auto-cascade lên feature/{F-XXX}/tsd.md. Role QC, song song với /spec-tech (DEV) — cả hai chỉ phụ thuộc spec.md approved.
3
+ description: Tạo test.md cho một integration bằng cách mechanical derive Test Scenarios + Test Cases từ Flows/US/AC/VR/FAC trong frd.md. Auto-cascade lên feature/{F-XXX}/test-design.md. Role QC, song song với /spec-tech (DEV) — cả hai chỉ phụ thuộc spec.md approved.
4
4
  ---
5
5
 
6
6
  # spec-test
@@ -9,15 +9,15 @@ description: Tạo test.md cho một integration bằng cách mechanical derive
9
9
 
10
10
  Tạo `test.md` cho một integration trong `.specs/integrations/{slug}/`.
11
11
 
12
- `test.md` là verification design ở integration level — định nghĩa **how to verify** rằng integration đáp ứng `spec.md`. Nội dung gồm Test Strategy (per integration) + Changes blocks cascade lên feature `tsd.md` (Test Spec Document).
12
+ `test.md` là verification design ở integration level — định nghĩa **how to verify** rằng integration đáp ứng `spec.md`. Nội dung gồm Test Strategy (per integration) + Changes blocks cascade lên feature `test-design.md` (Test Design Document).
13
13
 
14
14
  **Hai artifact tách bạch:**
15
15
  - `.specs/integrations/{slug}/test.md` — integration-level, ephemeral, PR record bất biến sau approve (single-word naming như `spec.md` / `tech.md` / `plan.md`).
16
- - `.specs/main/feature/{F-XXX}-{slug}/tsd.md` — feature-level, persistent canonical artifact (3-letter naming như `frd.md` / `fdd.md`). TC content cuối cùng nằm ở đây.
16
+ - `.specs/main/feature/{F-XXX}-{slug}/test-design.md` — feature-level, persistent canonical artifact (cùng nhóm main feature như `frd.md` / `fdd.md`). TC content cuối cùng nằm ở đây.
17
17
 
18
18
  **Role:** QC. Song song với `/spec-tech` (DEV role). Cả hai chỉ phụ thuộc `spec.md` approved — không có thứ tự bắt buộc giữa chúng.
19
19
 
20
- **Cốt lõi:** agent **mechanical derive** TC từ frd.md (mỗi Flow → TS, mỗi US/AC → Functional TC, mỗi VR → Validation TC positive+negative, mỗi FAC → Feature AC TC). Agent KHÔNG sáng tạo TC ngoài frd — phần đó là QC thêm tay khi review.
20
+ **Cốt lõi:** agent **mechanical derive** TC từ frd.md (mỗi Flow → TS, mỗi US/AC → Functional TC, mỗi VR → Validation TC positive+negative, mỗi FAC → E2E TC, mỗi NFR → Non-functional TC, mỗi DM → Data & Migration TC). Agent KHÔNG sáng tạo TC ngoài frd — phần đó là QC thêm tay khi review.
21
21
 
22
22
  ## When to Use
23
23
 
@@ -27,7 +27,7 @@ Tạo `test.md` cho một integration trong `.specs/integrations/{slug}/`.
27
27
  ## When NOT to Use
28
28
 
29
29
  - `spec.md` chưa có hoặc chưa approve → chạy `/spec-new` trước
30
- - Integration có `features: []` (không touch feature nào) → `test.md` không áp dụng vì component-level `tsd.md` không tồn tại trong kit này (xem `templates/main/feature/tsd-template.md` — component contract verify gián tiếp qua feature TC + unit test trong code). Verification cho integration thuần component → đặt trong tech.md hoặc phase Verification của plan.md.
30
+ - Integration có `features: []` (không touch feature nào) → `test.md` không áp dụng vì component-level `test-design.md` không tồn tại trong kit này (xem `templates/main/feature/test-design-template.md` — component contract verify gián tiếp qua feature TC + unit test trong code). Verification cho integration thuần component → đặt trong tech.md hoặc phase Verification của plan.md.
31
31
  - Chỉ muốn cập nhật `test.md` đã có → edit file trực tiếp
32
32
 
33
33
  ---
@@ -90,8 +90,8 @@ Nếu `status` **không phải** `approved`:
90
90
 
91
91
  > ⛔ Integration **{slug}** không touch feature nào (`features: []`).
92
92
  >
93
- > `/spec-test` cascade lên `feature/{F-XXX}/tsd.md` — không áp dụng cho integration thuần component.
94
- > Component contract được verify gián tiếp qua feature TC + unit test trong code (xem `templates/main/feature/tsd-template.md`).
93
+ > `/spec-test` cascade lên `feature/{F-XXX}/test-design.md` — không áp dụng cho integration thuần component.
94
+ > Component contract được verify gián tiếp qua feature TC + unit test trong code (xem `templates/main/feature/test-design-template.md`).
95
95
  >
96
96
  > Đặt verification cho integration này trong:
97
97
  > - `tech.md > Implementation Notes` — verification approach
@@ -109,7 +109,7 @@ Load các file sau:
109
109
 
110
110
  - `.specs/integrations/{slug}/spec.md` — đọc toàn bộ + frontmatter (`features`)
111
111
  - `.specs/main/feature/{F-XXX}-{slug}/frd.md` — cho mỗi feature trong frontmatter `features` (source của TC — bắt buộc tồn tại vì cascade từ spec.md đã apply)
112
- - `.specs/main/feature/{F-XXX}-{slug}/tsd.md` — cho mỗi feature trong frontmatter `features` (nếu tồn tại — cần để diff và assign next ID)
112
+ - `.specs/main/feature/{F-XXX}-{slug}/test-design.md` — cho mỗi feature trong frontmatter `features` (nếu tồn tại — cần để diff và assign next ID)
113
113
  - `.specs/integrations/{slug}/tech.md` — đọc nếu tồn tại (optional, dùng để hint environment / data set / NFR perf threshold)
114
114
 
115
115
  Tóm tắt context:
@@ -119,8 +119,8 @@ TÔI HIỂU:
119
119
  - Integration: {title}
120
120
  - Features touched: {từ frontmatter — F-XXX, ...}
121
121
  - Mỗi feature có trong frd.md:
122
- - F-XXX: {N} Flows, {M} US ({K} AC), {P} VR, {Q} FAC
123
- - tsd.md hiện tại:
122
+ - F-XXX: {N} Flows, {M} US ({K} AC), {P} VR, {Q} FAC, {R} NFR, {S} DM
123
+ - test-design.md hiện tại:
124
124
  - F-XXX: tồn tại — max(TS)=NNN, max(TC)=MMM (cho operation=update)
125
125
  - F-YYY: chưa tồn tại (cho operation=create)
126
126
  - tech.md: {tồn tại / chưa — nếu có thì có hint gì cho env/data/perf}
@@ -139,11 +139,11 @@ Nếu frd.md của feature nào không tồn tại → báo lỗi và dừng (l
139
139
 
140
140
  Với mỗi feature trong `features:`:
141
141
 
142
- - Đọc `feature/{F-XXX}/tsd.md` hiện tại (nếu có) để lấy `max(TS-F{NNN}-seq)` và `max(TC-F{NNN}-seq)`
142
+ - Đọc `feature/{F-XXX}/test-design.md` hiện tại (nếu có) để lấy `max(TS-F{NNN}-seq)` và `max(TC-F{NNN}-seq)`
143
143
  - ID mới = `max(seq) + 1`, format 3 chữ số
144
- - TC dùng **chung sequence** cho Functional / Validation / Feature AC — không reset theo loại
144
+ - TC dùng **chung sequence** cho Functional / Validation / E2E / Non-functional / Data & Migration — không reset theo loại, không đẻ prefix riêng
145
145
  - ID **stable** — không tái sử dụng khi [REMOVE], không renumber khi [MODIFY]
146
- - Operation=create (tsd.md chưa tồn tại) → bắt đầu từ `001`
146
+ - Operation=create (test-design.md chưa tồn tại) → bắt đầu từ `001`
147
147
 
148
148
  #### 3.2 Derivation rules
149
149
 
@@ -176,14 +176,13 @@ Với mỗi feature trong `features:`:
176
176
  - Covers: `VR-{F_ID}-{seq}`
177
177
  - Priority: P1 mặc định (xem 3.3)
178
178
 
179
- **D. Feature AC Test Cases** — mỗi FAC → 1 Feature AC TC.
179
+ **D. E2E Test Cases** — mỗi `FAC-*` (end-to-end) → 1 TC. Type: `E2E — journey` (tuần tự liên story) / `E2E — consistency` (đa màn) / `E2E — integrity` (bất biến liên story, không tuần tự) — đọc FAC để phân loại. Covers `FAC-{F_ID}-{seq}`. Spans: list US IDs (nếu journey/integrity). Preconditions/Steps/Expected dịch 1:1 từ G/W/T.
180
180
 
181
- - TC ID mới = `TC-F{NNN}-{next_seq}`
182
- - Type: derive từ nhóm FAC (`e2e` / `consistency` / `NFR` / `data & migration`) — đọc context FAC để phân loại
183
- - Priority: theo bảng 3.3
184
- - Covers: `FAC-{F_ID}-{seq}`
185
- - Spans: list US IDs FAC liên quan (nếu FAC e2e)
186
- - Preconditions/Steps/Expected: dịch 1:1 từ Given/When/Then của FAC
181
+ **D2. Non-Functional Test Cases** — mỗi `NFR-*` → 1 TC. Type: `performance` / `a11y` / `security` / ... (theo NFR). Covers `NFR-{F_ID}-{seq}`. Dịch 1:1 từ G/W/T.
182
+
183
+ **D3. Data & Migration Test Cases** (required-emptyable) — mỗi `DM-*` → 1 TC. Type: `data migration`. Covers `DM-{F_ID}-{seq}`. Dịch 1:1 từ G/W/T. Frd không có DM entry → giữ heading, để section trống.
184
+
185
+ > Mọi TC ở D / D2 / D3 dùng **chung sequence `TC-F{NNN}-{next_seq}`** KHÔNG đẻ prefix riêng. Priority theo bảng 3.3.
187
186
 
188
187
  **E. Traceability Matrix** — row per frd item:
189
188
 
@@ -191,7 +190,9 @@ Với mỗi feature trong `features:`:
191
190
  - 1 row per US → cover by TC (Functional)
192
191
  - 1 row per Story AC → cover by TC (Functional)
193
192
  - 1 row per VR → cover by TC (Validation, list tất cả positive + negative)
194
- - 1 row per FAC → cover by TC (Feature AC)
193
+ - 1 row per FAC → cover by TC (E2E)
194
+ - 1 row per NFR → cover by TC (Non-functional)
195
+ - 1 row per DM → cover by TC (Data & Migration)
195
196
  - Mọi item phải có cover ✅ (vì derive 1:1). Nếu agent không thể derive một item nào → đánh dấu ❌ + ghi lý do ở Gaps section, KHÔNG silent skip.
196
197
 
197
198
  #### 3.3 Priority defaults
@@ -208,19 +209,20 @@ Mọi TC đều có priority deterministic. QC override khi review (Bước 4).
208
209
 
209
210
  **TC cover VR** — inherit max priority của các US trong `Refs` column của VR. Nếu Refs trống → P1 default.
210
211
 
211
- **TC cover FAC** — theo nhóm FAC:
212
+ **TC cover FAC / NFR / DM** — theo loại + section nguồn:
212
213
 
213
- | FAC group | TC Priority |
214
+ | Loại | TC Priority |
214
215
  | --- | --- |
215
- | End-to-end liên story | P0 |
216
- | Cross-story consistency | P1 |
217
- | NFRsecurity / data integrity | P0 |
216
+ | FAC — end-to-end (journey) | P0 |
217
+ | FAC integrity | P0 |
218
+ | FACconsistency | P1 |
219
+ | NFR — security | P0 |
218
220
  | NFR — performance / a11y / i18n / browser | P1 |
219
221
  | Data & migration | P0 |
220
222
 
221
- #### 3.4 Diff vs current tsd.md
223
+ #### 3.4 Diff vs current test-design.md
222
224
 
223
- Với feature có tsd.md hiện tại (operation=update):
225
+ Với feature có test-design.md hiện tại (operation=update):
224
226
 
225
227
  - Item đã có TC cover → KHÔNG sinh TC mới, giữ nguyên TC cũ
226
228
  - Item trong frd nhưng chưa có TC cover → sinh TC mới với marker `[NEW]`
@@ -229,7 +231,7 @@ Với feature có tsd.md hiện tại (operation=update):
229
231
 
230
232
  Agent compute diff tự động — KHÔNG hỏi user "field nào đã đổi"; đọc 2 file rồi đối chiếu.
231
233
 
232
- **No-delta case:** nếu diff giữa frd hiện tại và tsd.md hiện tại = empty cho 1 feature (frd không thêm/đổi item nào mà tsd chưa cover) → **bỏ Changes block của feature đó hoàn toàn**, ghi `no-op` trong Cascade Summary để minh bạch.
234
+ **No-delta case:** nếu diff giữa frd hiện tại và test-design.md hiện tại = empty cho 1 feature (frd không thêm/đổi item nào mà test-design chưa cover) → **bỏ Changes block của feature đó hoàn toàn**, ghi `no-op` trong Cascade Summary để minh bạch.
233
235
 
234
236
  #### 3.5 Placeholders cần QC fill
235
237
 
@@ -237,8 +239,7 @@ Agent **không suy đoán** các field sau, dùng placeholder rõ ràng để QC
237
239
 
238
240
  | Field | Placeholder | Vì sao agent không tự fill |
239
241
  | --- | --- | --- |
240
- | Environments table | Row mặc định: `dev / staging / prod-like` với `data set: TBD`, `mục đích: TBD` | Phụ thuộc setup CI/CD availability — QC owns |
241
- | Test Data table | Row `{TBD — fixture}` cho mỗi seed/boundary dataset agent thấy cần | QC chọn fixture source thực tế |
242
+ | Test Data Requirements | Row `{TBD shape}` cho mỗi seed/boundary dataset agent thấy cần | QC xác định yêu cầu data (shape); nguồn/refresh thuộc execution |
242
243
  | Out of Scope | Để trống với note `<!-- QC fill -->` | Quyết định business của QC |
243
244
  | Test Strategy > Approach | Bullet generic theo template gốc | Strategy đặc thù integration QC fill |
244
245
 
@@ -249,8 +250,8 @@ Agent **không suy đoán** các field sau, dùng placeholder rõ ràng để QC
249
250
  Tổng hợp và viết draft `test.md` theo `templates/integrations/test-template.md`:
250
251
 
251
252
  - **Context** — tóm tắt từ Bước 2
252
- - **Test Strategy** — placeholder + Environments table với placeholder rows
253
- - **Changes** — 1 block per feature *có delta*, mỗi block có operation + content theo template gốc `templates/main/feature/tsd-template.md`. Feature no-delta → bỏ block.
253
+ - **Test Strategy** — Approach delta đặc thù integration (KHÔNG có Environments table env assignment thuộc execution)
254
+ - **Changes** — 1 block per feature *có delta*, mỗi block có operation + content theo template gốc `templates/main/feature/test-design-template.md`. Feature no-delta → bỏ block.
254
255
  - **Out of Scope** — empty với note QC fill
255
256
  - **Open Questions** — list các item mà agent không thể derive deterministic (vd: FAC có wording vague, VR không rõ nhánh fail nào)
256
257
  - **Cascade Summary** — table liệt kê **tất cả** feature trong `features:` (kể cả no-delta — ghi `no-op`)
@@ -263,14 +264,14 @@ Hiển thị **toàn bộ draft** cho QC xem — **chưa ghi file, chưa cascade
263
264
 
264
265
  > Draft trên đã đúng chưa? QC điểm cần check:
265
266
  >
266
- > 1. **Mechanical derivation** — mỗi Flow / US / AC / VR / FAC trong frd đã có TC cover chưa? (xem Traceability Matrix)
267
+ > 1. **Mechanical derivation** — mỗi Flow / US / AC / VR / FAC / NFR / DM trong frd đã có TC cover chưa? (xem Traceability Matrix)
267
268
  > 2. **Priority defaults** — có TC nào cần override khỏi default không?
268
- > 3. **Placeholders** — fill Environments / Test Data / Out of Scope / Strategy Approach.
269
+ > 3. **Placeholders** — fill Test Data Requirements / Out of Scope / Strategy Approach.
269
270
  > 4. **Extra edge cases** — ngoài AC/VR có scenario nào QC muốn thêm? (vd: exploratory, security boundary, race condition không có trong AC)
270
271
  > 5. **Changes markers** — `[NEW]/[MODIFY]/[REMOVE]` có đúng không?
271
272
  > 6. **No-delta features** — Cascade Summary có ghi `no-op` đúng cho feature không có delta không?
272
273
  >
273
- > **Sau khi confirm, agent sẽ auto-apply tất cả Changes blocks lên feature tsd.md(s).**
274
+ > **Sau khi confirm, agent sẽ auto-apply tất cả Changes blocks lên feature test-design.md(s).**
274
275
 
275
276
  Nếu QC yêu cầu chỉnh sửa:
276
277
  - Override priority → update draft
@@ -286,25 +287,25 @@ Chỉ tiến hành Bước 6 sau khi QC confirm.
286
287
 
287
288
  **[6.1] Ghi `.specs/integrations/{slug}/test.md`** với status `approved` (không phải `draft` — human đã confirm ở Bước 5 chính là approval). Frontmatter `features` mirror từ `spec.md`. (test.md là integration artifact — **không** mang `template_version`; versioning chỉ áp dụng cho main artifacts, xem `conventions.md` §7.)
288
289
 
289
- **[6.2] Auto-apply mỗi Changes block** vào `feature/{F-XXX}/tsd.md` tương ứng. Thứ tự apply: theo thứ tự xuất hiện trong frontmatter `features` (deterministic, không có forward reference giữa các feature tsd.md). Bỏ qua feature có operation `no-op` trong Cascade Summary.
290
+ **[6.2] Auto-apply mỗi Changes block** vào `feature/{F-XXX}/test-design.md` tương ứng. Thứ tự apply: theo thứ tự xuất hiện trong frontmatter `features` (deterministic, không có forward reference giữa các feature test-design.md). Bỏ qua feature có operation `no-op` trong Cascade Summary.
290
291
 
291
292
  Cho từng block:
292
293
 
293
294
  - **Operation=create:**
294
- - Tạo file `.specs/main/feature/{F-XXX}-{slug}/tsd.md`
295
- - Nội dung = nội dung của Changes block (theo format `templates/main/feature/tsd-template.md`)
296
- - Frontmatter của tsd.md mới: status `draft` + `template_version` copy từ `tsd-template.md` (separate lifecycle với integration test.md). Chỉ stamp ở operation=create; **operation=update KHÔNG đụng** version của tsd.md hiện có.
295
+ - Tạo file `.specs/main/feature/{F-XXX}-{slug}/test-design.md`
296
+ - Nội dung = nội dung của Changes block (theo format `templates/main/feature/test-design-template.md`)
297
+ - Frontmatter của test-design.md mới: status `draft` + `template_version` copy từ `test-design-template.md` (separate lifecycle với integration test.md). Chỉ stamp ở operation=create; **operation=update KHÔNG đụng** version của test-design.md hiện có.
297
298
 
298
299
  - **Operation=update:**
299
- - Đọc tsd.md hiện tại
300
+ - Đọc test-design.md hiện tại
300
301
  - Với mỗi TS/TC trong Changes block:
301
302
  - `[NEW]` → append/insert vào section tương ứng (giữ thứ tự numeric của ID)
302
303
  - `[MODIFY {field}]` → tìm TS/TC bằng ID, update field đã chỉ định, giữ nguyên field khác
303
- - `[REMOVE]` → xóa TS/TC khỏi tsd.md (ID retire, không tái sử dụng)
304
+ - `[REMOVE]` → xóa TS/TC khỏi test-design.md (ID retire, không tái sử dụng)
304
305
  - Cập nhật Traceability Matrix: thêm row cho item mới, update row của item bị MODIFY, KHÔNG xóa row của REMOVE (đánh dấu retire)
305
- - Ghi lại tsd.md
306
+ - Ghi lại test-design.md
306
307
 
307
- **[6.2.5] Append Change History entry** vào mỗi tsd.md bị touched (theo `conventions.md` §5.5). Đây là phần atomic của auto-apply — nếu fail thì rollback luôn.
308
+ **[6.2.5] Append Change History entry** vào mỗi test-design.md bị touched (theo `conventions.md` §5.5). Đây là phần atomic của auto-apply — nếu fail thì rollback luôn.
308
309
 
309
310
  Format entry:
310
311
 
@@ -315,16 +316,16 @@ Format entry:
315
316
  - [marker] {TS/TC ID} — {mô tả ngắn 1 dòng}
316
317
  ```
317
318
 
318
- - Operation = `create` (tsd.md mới) | `update` (tsd.md đã tồn tại).
319
+ - Operation = `create` (test-design.md mới) | `update` (test-design.md đã tồn tại).
319
320
  - Integration link trỏ tới `test.md` (không phải `spec.md`) — đây là cascade từ test.
320
- - Section name = tên section trong template tsd (`Test Scenarios`, `Functional Test Cases`, `Validation Test Cases`, `Feature AC Test Cases`, `Traceability Matrix`...).
321
+ - Section name = tên section trong template test-design (`Test Scenarios`, `Functional Test Cases`, `Validation Test Cases`, `E2E Test Cases`, `Non-Functional Test Cases`, `Data & Migration Test Cases`, `Traceability Matrix`...).
321
322
  - Mọi TS/TC có marker trong Changes block phải xuất hiện ở entry, group theo section.
322
323
  - Với operation=create từ template trống (no Changes block content) → entry body có thể là `- **All sections**: initial scaffold`.
323
324
 
324
325
  **[6.3] Atomic rollback:** Nếu apply block nào fail (vd `[MODIFY TC-F001-005]` nhưng ID không tồn tại):
325
326
  1. Rollback các block đã apply trước đó về state ban đầu
326
327
  2. **Không** ghi integration test.md
327
- 3. Báo lỗi cụ thể cho QC fix draft hoặc feature tsd.md hiện tại
328
+ 3. Báo lỗi cụ thể cho QC fix draft hoặc feature test-design.md hiện tại
328
329
 
329
330
  **[6.4] Thông báo kết quả:**
330
331
 
@@ -332,12 +333,12 @@ Format entry:
332
333
  ✓ .specs/integrations/{slug}/test.md đã được tạo (status: approved)
333
334
 
334
335
  Auto-cascade applied:
335
- ✓ feature/F-XXX-{slug}/tsd.md — {created | updated: +N TS, +M TC, modify K TC, remove L TC}
336
- ✓ feature/F-YYY-{slug}/tsd.md — no-op (frd không đổi)
336
+ ✓ feature/F-XXX-{slug}/test-design.md — {created | updated: +N TS, +M TC, modify K TC, remove L TC}
337
+ ✓ feature/F-YYY-{slug}/test-design.md — no-op (frd không đổi)
337
338
 
338
339
  Bước tiếp theo:
339
- - QC: review feature tsd.md đã cascade, fill remaining TBD nếu có
340
- - DEV: có thể run /plan nếu chưa có plan.md (plan.md hiện chưa consume tsd.md — test tasks tự QC manage trong test framework)
340
+ - QC: review feature test-design.md đã cascade, fill remaining TBD nếu có
341
+ - DEV: có thể run /plan nếu chưa có plan.md (plan.md hiện chưa consume test-design.md — test tasks tự QC manage trong test framework)
341
342
  ```
342
343
 
343
344
  ---
@@ -348,7 +349,7 @@ Bước tiếp theo:
348
349
  | --- | --- |
349
350
  | "TC có thể nghĩ ra khi chạy test" | Không document = không có traceability. AC pass/fail không kiểm tra được nếu không có TC mapping. |
350
351
  | "VR positive đủ rồi, negative skip" | Negative case là nơi bug ẩn. Mỗi nhánh fail của VR phải có TC riêng. |
351
- | "Priority để default hết P1 cho nhanh" | Priority decorative thì cũng phải đúng — derive deterministic từ US Priority/FAC group. P1 hàng loạt = QC chưa nhìn frd. |
352
+ | "Priority để default hết P1 cho nhanh" | Priority decorative thì cũng phải đúng — derive deterministic từ US Priority/loại requirement (FAC/NFR/DM). P1 hàng loạt = QC chưa nhìn frd. |
352
353
  | "Out of Scope để trống cũng được" | Mọi integration đều có thứ không test. Trống = scope creep hoặc gap không kiểm soát. |
353
354
 
354
355
  ## Red Flags
@@ -357,8 +358,8 @@ Bước tiếp theo:
357
358
  - TC có Covers trống → không trace được lên frd
358
359
  - VR có ít hơn 2 TC (1 positive + 1+ negative) → coverage thiếu
359
360
  - Priority hàng loạt giống nhau cho mọi TC → QC chưa override default
360
- - Test Data toàn `TBD` sau khi QC review → chưa thật sự confirm
361
- - Changes block có marker `[NEW]` cho TC trùng ID với TC đã có trong tsd.md hiện tại → diff bug
361
+ - Test Data Requirements toàn `TBD` sau khi QC review → chưa thật sự confirm
362
+ - Changes block có marker `[NEW]` cho TC trùng ID với TC đã có trong test-design.md hiện tại → diff bug
362
363
  - Cascade Summary thiếu row cho feature trong `features:` (kể cả no-op) → không minh bạch
363
364
 
364
365
  ## Verification
@@ -368,17 +369,17 @@ Trước khi QC confirm (Bước 5), kiểm tra:
368
369
  - [ ] Mỗi Flow trong frd có 1 TS tương ứng
369
370
  - [ ] Mỗi US AC có TC Functional cover
370
371
  - [ ] Mỗi VR có ≥1 positive + ≥1 negative TC
371
- - [ ] Mỗi FAC có TC Feature AC cover
372
+ - [ ] Mỗi FAC có TC E2E cover; mỗi NFR có TC Non-functional; mỗi DM có TC Data & Migration
372
373
  - [ ] Traceability Matrix đầy đủ (không ❌ mà không giải thích)
373
374
  - [ ] Priority deterministic theo bảng 3.3 (default), QC override visible
374
375
  - [ ] ID assignment từ max(seq)+1, không tái sử dụng, không renumber
375
- - [ ] Markers `[NEW]/[MODIFY {field}]/[REMOVE]` khớp diff vs current tsd.md
376
+ - [ ] Markers `[NEW]/[MODIFY {field}]/[REMOVE]` khớp diff vs current test-design.md
376
377
  - [ ] Feature no-delta được ghi `no-op` trong Cascade Summary, KHÔNG có Changes block
377
378
 
378
379
  Sau khi QC confirm (Bước 6):
379
380
 
380
381
  - [ ] Auto-apply theo thứ tự features trong frontmatter
381
- - [ ] Mỗi tsd.md bị touched có entry mới trong `## Change History` (conventions §5.5)
382
+ - [ ] Mỗi test-design.md bị touched có entry mới trong `## Change History` (conventions §5.5)
382
383
  - [ ] Fail-safe: nếu apply fail thì không ghi integration test.md (rollback luôn Change History entries)
383
- - [ ] Mỗi feature tsd.md mới có status `draft` (separate lifecycle)
384
- - [ ] Main artifact tsd.md create có `template_version` copy từ template; tsd.md update giữ nguyên version cũ. test.md (integration) KHÔNG mang `template_version`
384
+ - [ ] Mỗi feature test-design.md mới có status `draft` (separate lifecycle)
385
+ - [ ] Main artifact test-design.md create có `template_version` copy từ template; test-design.md update giữ nguyên version cũ. test.md (integration) KHÔNG mang `template_version`