spec-lite 1.5.2 → 1.7.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.
@@ -0,0 +1,251 @@
1
+ ---
2
+ name: spec-test-exec
3
+ description: Sinh bundle test-executions cho MỘT feature — render Test Cases trong test-design.md thành các doc thực thi theo harness (func-manual/auto, e2e-manual/auto, nfr, dm). Đọc-xuống từ test-design (source of truth), inherit TC-F* nguyên văn, KHÔNG đẻ ID mới. Mỗi lần chạy = bundle đánh số mới, ephemeral per test cycle.
4
+ ---
5
+
6
+ # spec-test-exec
7
+
8
+ ## Overview
9
+
10
+ Sinh một **cycle bundle test-executions** cho một feature vào `.specs/test-executions/{F-XXX}-{slug}/{NNN}-{cycle-slug}/` — render các Test Case đã thiết kế ở `test-design.md` thành **doc thực thi** theo từng **harness** (manual GUI walk / automation / tool đặc thù / migration script). Plane 2 tầng: feature group (`{F-XXX}-{slug}/`) → cycle bundle (`{NNN}-{cycle-slug}/`); `{NNN}` reset per-feature (xem `conventions.md` §8.1).
11
+
12
+ **Vị trí trong 3 layer** (xem `conventions.md` §8):
13
+
14
+ ```
15
+ frd.md ──(/spec-test | /spec-test-design)──▶ test-design.md ──(/spec-test-exec)──▶ test-executions/{F-XXX}-{slug}/{NNN}-{cycle-slug}/
16
+ [DESIGN — TC là gì] [SOURCE OF TRUTH] [EXECUTION — chạy bằng harness gì]
17
+ ```
18
+
19
+ **Cốt lõi — đọc xuống, KHÔNG sáng tạo:**
20
+ - test-design.md là **source of truth** của bộ Test Case. Skill này **chỉ đọc** test-design → route TC vào doc theo section nguồn + harness.
21
+ - **Inherit `TC-F*` nguyên văn** — KHÔNG đẻ ID mới, KHÔNG renumber. (`{PREFIX}_E2E_*` nếu dùng chỉ là title `test.describe` trong code, không phải ID artifact.)
22
+ - Mỗi lần chạy = **bundle đánh số mới** (snapshot độc lập từ test-design hiện tại). **KHÔNG** carry-over result, **KHÔNG** link chuỗi với bundle cũ.
23
+
24
+ **KHÔNG versioned:** doc test-exec không mang `template_version`/`migrations` — derived, ngoài scope `/artifact-audit` + `/artifact-migrate` (xem `conventions.md` §7 + §8.1).
25
+
26
+ ## When to Use
27
+
28
+ - Một feature đã có `test-design.md` và cần sinh doc thực thi để bắt đầu một **chu kỳ test** (regression release, sprint test, UAT...).
29
+ - test-design.md vừa cập nhật (qua `/spec-test`) → cần một bundle thực thi mới phản ánh TC hiện tại.
30
+
31
+ ## When NOT to Use
32
+
33
+ - Feature **chưa có** `test-design.md` → chạy `/spec-test` (qua integration) hoặc `/spec-test-design` (bootstrap) trước.
34
+ - Muốn **thêm/đổi TC** → KHÔNG sửa ở đây (test-exec chỉ đọc). Sửa test-design qua `/spec-test`, rồi sinh lại bundle.
35
+ - Chỉ muốn cập nhật **kết quả thực thi** (Test Result) → edit doc trong bundle trực tiếp (đó là việc của owner khi chạy test), không chạy lại skill.
36
+
37
+ ---
38
+
39
+ ## Process
40
+
41
+ ### Bước 1: Xác định feature
42
+
43
+ `/spec-test-exec` thao tác trên **đúng một feature**.
44
+
45
+ **Nếu có ARGUMENT:**
46
+ - Parse: feature ID (`F-012`, `012`) hoặc slug (`F-012-bulk-import`, `bulk-import`).
47
+ - Quét `.specs/main/feature/*/test-design.md`, tìm feature khớp.
48
+ - Không khớp → báo lỗi:
49
+ > Không tìm thấy feature có test-design.md khớp với "{argument}". Kiểm tra `.specs/main/feature/`.
50
+
51
+ **Nếu không có ARGUMENT:**
52
+
53
+ Quét `.specs/main/feature/`. Liệt kê features **có `test-design.md`**, kèm các cycle bundle hiện có trong feature group:
54
+
55
+ ```
56
+ Features có test-design.md:
57
+
58
+ [1] F-012 — bulk-import test-design: approved cycles: 001-regression, 002-release-2.0
59
+ [2] F-031 — checkout test-design: draft cycles: —
60
+
61
+ Chọn số feature:
62
+ ```
63
+
64
+ Không feature nào có test-design.md → dừng:
65
+ > Chưa có feature nào có test-design.md. Chạy `/spec-test` hoặc `/spec-test-design` trước.
66
+
67
+ ---
68
+
69
+ ### Bước 2: Gate check + phát hiện section điều kiện
70
+
71
+ Đọc `.specs/main/feature/{F-XXX}-{slug}/test-design.md`.
72
+
73
+ **Check 1 — test-design.md tồn tại:** nếu không → dừng (đã xử lý ở Bước 1).
74
+
75
+ **Check 2 — status (cảnh báo, KHÔNG block):**
76
+
77
+ Nếu `status` **không phải** `approved`:
78
+ > ⚠ `test-design.md` của **{F-XXX}** đang ở `status: {status}` (chưa approved — có thể còn placeholder TBD ở Test Data / Strategy / Out of Scope).
79
+ >
80
+ > Bundle sinh ra sẽ kế thừa các placeholder đó. Tiếp tục? (yes / no — default yes)
81
+
82
+ `no` → dừng, gợi ý approve test-design trước.
83
+
84
+ **Check 3 — phát hiện section required-emptyable rỗng (quyết định nfr/dm):**
85
+
86
+ Đọc 2 section của test-design:
87
+ - `## Non-Functional Test Cases` — có TC block (`### TC-F...`) không?
88
+ - `## Data & Migration Test Cases` — có TC block không?
89
+
90
+ Quy tắc (xem `conventions.md` §8.2):
91
+ - Section có ≥1 TC → **sẽ sinh** doc tương ứng (`test-exec-nfr.md` / `test-exec-dm.md`).
92
+ - Section rỗng (chỉ heading, không TC) → **BỎ QUA** doc đó.
93
+
94
+ Báo lại cho user:
95
+ ```
96
+ test-design F-012:
97
+ Functional TC: 8 Validation TC: 12 E2E TC: 3 NFR TC: 2 DM TC: 0
98
+ → Sẽ sinh: func-manual, func-auto, e2e-manual, e2e-auto, nfr (BỎ dm — section rỗng)
99
+ ```
100
+
101
+ ---
102
+
103
+ ### Bước 3: Cấp feature group + cycle bundle
104
+
105
+ **Feature group** `{F-XXX}-{slug}/` — mirror tên thư mục `main/feature/{F-XXX}-{slug}/`. Chưa tồn tại → tạo mới; đã có → dùng lại (gom cycle).
106
+
107
+ **Cycle number `{NNN}`** — đánh số **per-feature** (reset trong mỗi feature group):
108
+ - Quét max `{NNN}` của các cycle bundle **trong feature group đó**:
109
+ - `.specs/test-executions/{F-XXX}-{slug}/*/` (active)
110
+ - `.specs/archive/**/` thuộc cùng feature (cycle đã archive)
111
+ - `{NNN}` mới = max + 1, zero-padded 3 chữ số. Feature group rỗng → `001`.
112
+
113
+ **Cycle slug** — kebab-case mô tả **chu kỳ test** (vd `regression`, `release-2.0`, `smoke`). KHÔNG nhúng `{F-XXX}` (đã ở tầng feature group). Hỏi user (mặc định gợi ý theo ngữ cảnh):
114
+
115
+ > Cycle mới: `F-012-bulk-import/003-regression`. Đổi cycle-slug? (Enter để giữ)
116
+
117
+ **Cảnh báo clobber:** nếu tên cycle trùng một bundle đã có trong feature group → cảnh báo, KHÔNG ghi đè (đề nghị số mới hoặc archive cycle cũ trước).
118
+
119
+ ---
120
+
121
+ ### Bước 4: Route TC → bucket + completeness check
122
+
123
+ **Đọc toàn bộ TC từ test-design**, gom theo section nguồn:
124
+
125
+ | Section test-design | Bucket scope | TC fields đọc được |
126
+ | --- | --- | --- |
127
+ | `## Functional Test Cases` | func | Type, **Autoable**, Priority, Covers, Scenario, Preconditions, Steps, Expected, Test data |
128
+ | `## Validation Test Cases` | func | TC ID, Covers VR, Field, Input, Expected, Polarity (**Autoable=YES** uniform) |
129
+ | `## E2E Test Cases` | e2e | Type (journey/consistency/integrity), Priority, Covers FAC, Spans, Preconditions, Steps, Expected |
130
+ | `## Non-Functional Test Cases` | nfr | Type, Priority, Covers NFR, Preconditions, Steps, Expected |
131
+ | `## Data & Migration Test Cases` | dm | Type, Priority, Covers DM, Preconditions, Steps, Expected |
132
+
133
+ **Route vào doc:**
134
+
135
+ | Doc | Lấy TC nào |
136
+ | --- | --- |
137
+ | `test-exec-func-manual` | **TOÀN BỘ** Functional + Validation TC (bất kể Autoable) |
138
+ | `test-exec-func-auto` | Functional + Validation TC có **`Autoable ∈ {YES, MAYBE}`** (Validation đều YES) |
139
+ | `test-exec-e2e-manual` | **TOÀN BỘ** E2E TC |
140
+ | `test-exec-e2e-auto` | **TOÀN BỘ** E2E TC (cùng tập với e2e-manual — hai harness thay thế) |
141
+ | `test-exec-nfr` | Non-Functional TC *(bỏ doc nếu rỗng)* |
142
+ | `test-exec-dm` | Data & Migration TC *(bỏ doc nếu rỗng)* |
143
+
144
+ **Completeness check (BẮT BUỘC trước khi ghi):**
145
+ - Tập `TC-F*` ở 4 **scope bucket** (func ∪ e2e ∪ nfr ∪ dm) phải **bằng** tập TC trong `test-design > Traceability Matrix`.
146
+ - Mỗi `TC-F*` rơi **đúng 1 scope bucket** (func/e2e/nfr/dm) — không lọt, không trùng scope. *(Cùng 1 TC xuất hiện ở cả func-manual lẫn func-auto là ĐÚNG — đó là hai harness của cùng scope func, không tính trùng.)*
147
+ - func-auto là **tập con** của func-manual (chỉ Autoable=YES/MAYBE) — phần `Autoable=NO` chỉ ở manual.
148
+ - Lỗi (TC không route được / TC thừa không có trong Matrix / section nguồn không parse được) → **dừng, báo cụ thể**, KHÔNG ghi bundle nửa vời.
149
+
150
+ ---
151
+
152
+ ### Bước 5: Sinh doc từ template
153
+
154
+ Với mỗi doc cần sinh, copy từ `templates/test-executions/test-exec-{...}-template.md` rồi điền:
155
+
156
+ **Frontmatter (`conventions.md` §8.5):**
157
+ - `id: test-exec-{kind}-{F-XXX}-{NNN}-{cycle-slug}` · `type: test-exec-{kind}` · `feature_id: {F-XXX}` · `status: draft`
158
+ - `test_design_ref: main/feature/{F-XXX}-{slug}/test-design.md` (từ `.specs/` root — không phụ thuộc độ sâu bundle)
159
+ - func/e2e: `alt_harness_{auto|manual}: ./test-exec-{...}.md` (relative, cùng bundle)
160
+ - Markdown link tới test-design trong body: bundle sâu 2 tầng → `../../../main/feature/{F-XXX}-{slug}/test-design.md`.
161
+ - **KHÔNG** `template_version`/`migrations`.
162
+
163
+ **Inherit (đọc xuống — KHÔNG suy diễn lại):**
164
+ - `TC-F*` ID, `Covers`, `Type`, `Priority`, `Preconditions`, `Steps`, `Expected` → copy **nguyên văn** từ test-design vào bảng Coverage + Test Cases của doc.
165
+ - `Autoable` (func) → copy y nguyên; func-auto chỉ chứa YES/MAYBE.
166
+
167
+ **Placeholder cho owner điền khi chạy** (KHÔNG tự bịa):
168
+ - **Test Result / Status (CI)** → `—` (chưa chạy).
169
+ - **Execution Locators / Test File / POM** → `_Pending — {owner}_`.
170
+ - **Tool / Command / Layer** (nfr/auto) → gợi ý theo Type nếu suy được (vd NFR performance → `k6`), còn lại để placeholder.
171
+ - Account/Role matrix, Env tiers, Seed, Fixtures → giữ skeleton template để owner điền theo môi trường.
172
+
173
+ **Coverage tables:** điền từ Traceability Matrix (AC/VR/FAC/NFR/DM → TC IDs) — KHÔNG dựng matrix cạnh tranh; coverage master vẫn ở test-design.
174
+
175
+ Hiển thị **tóm tắt bundle** (không dump toàn bộ) cho user xem trước khi ghi:
176
+ ```
177
+ Cycle F-012-bulk-import/003-regression — sẽ ghi 5 doc:
178
+ func-manual : 20 TC (8 func + 12 val) [toàn bộ]
179
+ func-auto : 18 TC (Autoable YES/MAYBE) [2 TC Autoable=NO chỉ ở manual]
180
+ e2e-manual : 3 TC
181
+ e2e-auto : 3 TC
182
+ nfr : 2 TC
183
+ (dm: bỏ — rỗng)
184
+ Completeness: 25/25 TC ở Traceability Matrix đều routed ✓
185
+ ```
186
+
187
+ ---
188
+
189
+ ### Bước 6: Ghi bundle + báo cáo
190
+
191
+ **[6.1]** Tạo `.specs/test-executions/{F-XXX}-{slug}/{NNN}-{cycle-slug}/` (tạo feature group nếu chưa có), ghi từng doc (status `draft`).
192
+
193
+ **[6.2]** KHÔNG cascade, KHÔNG đụng test-design (đọc-xuống one-way). KHÔNG ghi Change History vào test-design (test-exec không phải nguồn cascade).
194
+
195
+ **[6.3] Báo cáo:**
196
+ ```
197
+ ✓ .specs/test-executions/F-012-bulk-import/003-regression/ (từ test-design.md)
198
+ ✓ test-exec-func-manual.md — 20 TC
199
+ ✓ test-exec-func-auto.md — 18 TC (Autoable YES/MAYBE)
200
+ ✓ test-exec-e2e-manual.md — 3 TC
201
+ ✓ test-exec-e2e-auto.md — 3 TC
202
+ ✓ test-exec-nfr.md — 2 TC
203
+ (dm bỏ qua — test-design Data & Migration rỗng)
204
+
205
+ Bước tiếp theo (team chọn harness theo kỹ năng — xem terms/003/004):
206
+ - func: chạy func-manual (QC) HOẶC func-auto (DEV/SE). Lưu ý auto-only LỌT exploratory + Autoable=NO.
207
+ - e2e: chọn 1 trong e2e-manual (QC) / e2e-auto (SE) — thay thế hoàn toàn.
208
+ - nfr: SDET/specialist chạy bằng tool tương ứng.
209
+ - Xóa doc harness không dùng (sinh hết để team chọn).
210
+ - Điền Test Result / Status khi chạy.
211
+ ```
212
+
213
+ ---
214
+
215
+ ## Common Rationalizations
216
+
217
+ | Rationalization | Reality |
218
+ | --- | --- |
219
+ | "Thêm TC ngay trong bundle cho nhanh" | test-exec chỉ đọc xuống. TC mới phải vào test-design trước (qua `/spec-test`) rồi sinh lại — nếu không sẽ vỡ traceability + ID authority. |
220
+ | "Đổi TC ID cho gọn lại" | ID `TC-F*` do test-design làm chủ, stable. Renumber ở đây phá liên kết với test code + Traceability Matrix. |
221
+ | "Auto chạy pass hết là xong" | func-auto LỌT exploratory + `Autoable=NO` (visual). Manual-only mới đầy đủ scope func (terms/004). |
222
+ | "Sinh thiếu vài doc cho nhanh" | Sinh hết (6 hoặc 4) để team chọn harness. Thiếu = ép harness sai với kỹ năng team. |
223
+ | "Regenerate đè bundle cũ" | Mỗi cycle = bundle số mới. Đè bundle đã có Test Result = mất lịch sử thực thi. |
224
+
225
+ ## Red Flags
226
+
227
+ - Có `TC-F*` ở test-design Traceability Matrix nhưng không xuất hiện ở doc nào → completeness fail (lọt).
228
+ - Một `TC-F*` rơi vào >1 scope bucket (vd vừa func vừa e2e) → routing bug.
229
+ - func-auto chứa TC `Autoable=NO` → sai filter.
230
+ - Doc test-exec mang `template_version` → sai (test-exec không versioned).
231
+ - Ghi đè bundle cũ đang có Test Result mà không cảnh báo.
232
+ - Bịa Test Result / Locators / Tool thay vì để placeholder.
233
+ - Sửa test-design trong lúc chạy skill (skill này read-only với test-design).
234
+
235
+ ## Verification
236
+
237
+ Trước khi ghi bundle:
238
+
239
+ - [ ] Đúng một feature; test-design.md tồn tại (cảnh báo nếu draft, không block).
240
+ - [ ] nfr/dm: chỉ sinh khi section nguồn có TC; rỗng → bỏ doc.
241
+ - [ ] Feature group `{F-XXX}-{slug}/` (mirror main/feature); `{NNN}` = max cycle **trong feature group đó** (active + archived) + 1 (reset per-feature); cycle-slug mô tả chu kỳ.
242
+ - [ ] Route đúng: func ← Functional+Validation (manual=toàn bộ, auto=Autoable YES/MAYBE); e2e ← E2E (cả 2 harness cùng tập); nfr ← Non-Functional; dm ← Data & Migration.
243
+ - [ ] **Completeness**: mọi `TC-F*` ở Traceability Matrix routed đúng 1 scope bucket — không lọt/trùng.
244
+ - [ ] Inherit `TC-F*` + fields nguyên văn; KHÔNG ID mới, KHÔNG renumber.
245
+ - [ ] Frontmatter: `id/type/feature_id/test_design_ref/alt_harness_*` đúng; KHÔNG `template_version`.
246
+ - [ ] Test Result/Status/Locators = placeholder, không bịa.
247
+
248
+ Sau khi ghi:
249
+
250
+ - [ ] Bundle tại `.specs/test-executions/{F-XXX}-{slug}/{NNN}-{cycle-slug}/` với 6 (hoặc 4) doc, status `draft`.
251
+ - [ ] KHÔNG đụng test-design (one-way đọc xuống, không cascade, không Change History).
@@ -62,14 +62,14 @@ Nhận F-XXX từ argument (hoặc chọn từ prd Feature Index) + tùy chọn
62
62
  - **Create-only**: frd.md của feature mục tiêu **chưa tồn tại**. Đã tồn tại → **dừng, redirect `/spec-new`** (thay đổi feature đã spec phải đi qua integration để delta cascade + kéo theo `/spec-tech`/`/spec-test`).
63
63
  - Feature mới **đơn lẻ** chưa có trong Index → offer **register một row vào `prd.md > Features`** rồi author.
64
64
 
65
- **Sections template** (7): Overview · User Flows · Feature Acceptance Criteria · User Stories · Verification Rules · Scope · Dependencies
65
+ **Sections template**: Overview · User Flows · Feature Acceptance Criteria (end-to-end) · Non-Functional Requirements · Data & Migration *(nếu có)* · User Stories · Verification Rules · Scope · Dependencies
66
66
 
67
67
  **Phạm vi hẹp — chủ yếu `frd.md`:**
68
68
  - Reference component frd phụ thuộc (Components Used → C-XXX có sẵn).
69
69
  - Component cần-nhưng-chưa-có → ghi *candidate* + Open Question cho `/spec-sad`/architect chốt boundary.
70
70
  - Có thể register **một** feature row vào prd (side-effect lên prd).
71
71
  - **Cascade vocabulary lên `domain.md`** (pha mô tả/WHAT): glossary term + **định nghĩa shared entity** (attributes), `Owner: TBD` để `/spec-sad` gán ở pha thiết kế (HOW). BA define entity, KHÔNG carve/gán Owner.
72
- - **KHÔNG** tạo `crd.md`/`cdd.md` (sinh ở integration time qua `/spec-new` cascade), không tạo `fdd.md`/`tsd.md`, không đổi status feature đã có, không đụng sad.
72
+ - **KHÔNG** tạo `crd.md`/`cdd.md` (sinh ở integration time qua `/spec-new` cascade), không tạo `fdd.md`/`test-design.md`, không đổi status feature đã có, không đụng sad.
73
73
  - Change History operation = `manual` (cả frd lẫn domain). Verification Rules dùng quy ước option-suggester của `/spec-new` (BA owns).
74
74
 
75
75
  Bỏ qua bước này cũng được — `/spec-new` sẽ tự tạo frd làm fallback khi integration đầu tiên chạm tới feature.
@@ -94,14 +94,14 @@ Bỏ qua bước này cũng được — `/spec-new` sẽ tự tạo frd làm fa
94
94
 
95
95
  Dùng khi onboarding một project đã có code vào SDD. Mục tiêu: extract main artifacts từ codebase hiện có, sau đó chuyển vào **Integration Pipeline** để implement.
96
96
 
97
- **Thứ tự bắt buộc:** `init` → `component` → `feature` → `tsd` *(tùy chọn — bootstrap test coverage tracking)*
97
+ **Thứ tự bắt buộc:** `init` → `component` → `feature` → `test-design` *(tùy chọn — bootstrap test coverage tracking)*
98
98
 
99
99
  | Command | Scan | Reads | Writes |
100
100
  | --- | --- | --- | --- |
101
101
  | `/spec-brownfield-init [path]` | tech stack, README, auth, infra | attachments | `prd.md` *(no indexes)*, `domain.md` *(glossary only)*, `sad.md` |
102
102
  | `/spec-brownfield-component [path]` | module dirs, service/controller/entity files | `prd.md`, `domain.md` | `component/{C-XXX}-*/crd.md + cdd.md`; update `prd.md` Component Index; cascade Shared Entities → `domain.md` |
103
103
  | `/spec-brownfield-feature [path]` | use cases, routes, test files | `prd.md`, `domain.md`, `component/*/crd.md` | `feature/{F-XXX}-*/frd.md + fdd.md`; update `prd.md` Feature Index |
104
- | `/spec-tsd [F-XXX]` | — *(không scan code, derive 100% từ frd)* | `feature/{F-XXX}-*/frd.md`, `fdd.md` *(optional)* | `feature/{F-XXX}-*/tsd.md` |
104
+ | `/spec-test-design [F-XXX]` | — *(không scan code, derive 100% từ frd)* | `feature/{F-XXX}-*/frd.md`, `fdd.md` *(optional)* | `feature/{F-XXX}-*/test-design.md` |
105
105
 
106
106
  ### Phân chia trách nhiệm
107
107
 
@@ -173,21 +173,21 @@ Component Index và Feature Index **để placeholder** — sẽ được điề
173
173
 
174
174
  ---
175
175
 
176
- ### `/spec-tsd [F-XXX]`
176
+ ### `/spec-test-design [F-XXX]`
177
177
 
178
- **Mục tiêu:** Bootstrap `tsd.md` (Test Spec Document) cho một feature trực tiếp từ frd.md — mechanical derive Test Scenarios + Test Cases. KHÔNG cần integration.
178
+ **Mục tiêu:** Bootstrap `test-design.md` (Test Design Document) cho một feature trực tiếp từ frd.md — mechanical derive Test Scenarios + Test Cases. KHÔNG cần integration.
179
179
 
180
180
  **Khi nào dùng:**
181
- - **Brownfield onboarding** — sau `/spec-brownfield-feature` đã sinh frd.md, chạy `/spec-tsd` cho từng feature để có test coverage tracking từ ngày 1.
182
- - **Greenfield deferred** — feature đã có frd.md từ lâu nhưng tsd.md chưa được tạo.
183
- - **Ad-hoc rebuild** — tsd drift khỏi frd, regenerate fresh.
181
+ - **Brownfield onboarding** — sau `/spec-brownfield-feature` đã sinh frd.md, chạy `/spec-test-design` cho từng feature để có test coverage tracking từ ngày 1.
182
+ - **Greenfield deferred** — feature đã có frd.md từ lâu nhưng test-design.md chưa được tạo.
183
+ - **Ad-hoc rebuild** — test-design drift khỏi frd, regenerate fresh.
184
184
 
185
185
  **Khi nào KHÔNG dùng:**
186
- - Có integration cascade từ spec.md → frd → muốn cập nhật tsd theo changeset → dùng `/spec-test` (preserve ID stable).
186
+ - Có integration cascade từ spec.md → frd → muốn cập nhật test-design theo changeset → dùng `/spec-test` (preserve ID stable).
187
187
 
188
- **Derivation:** mechanical 1:1 từ frd — mỗi Flow → TS, mỗi US/AC → Functional TC, mỗi VR → ≥1 positive + 1+ negative Validation TC, mỗi FAC → Feature AC TC. Priority deterministic theo US Priority + FAC group. KHÔNG interview.
188
+ **Derivation:** mechanical 1:1 từ frd — mỗi Flow → TS, mỗi US/AC → Functional TC, mỗi VR → ≥1 positive + 1+ negative Validation TC, mỗi FAC → E2E TC, mỗi NFR → Non-functional TC, mỗi DM → Data & Migration TC. Priority deterministic theo US Priority + loại requirement. KHÔNG interview.
189
189
 
190
- **Cảnh báo overwrite:** nếu tsd.md đã tồn tại, skill hỏi confirm rõ ràng — regenerate sẽ reassign IDs từ 001 và làm vỡ test code references nếu có.
190
+ **Cảnh báo overwrite:** nếu test-design.md đã tồn tại, skill hỏi confirm rõ ràng — regenerate sẽ reassign IDs từ 001 và làm vỡ test code references nếu có.
191
191
 
192
192
  ---
193
193
 
@@ -203,7 +203,7 @@ Component Index và Feature Index **để placeholder** — sẽ được điề
203
203
  /spec-brownfield-feature [path]
204
204
 
205
205
 
206
- /spec-tsd [F-XXX] (tùy chọn — chạy cho mỗi feature để bootstrap tsd.md)
206
+ /spec-test-design [F-XXX] (tùy chọn — chạy cho mỗi feature để bootstrap test-design.md)
207
207
 
208
208
 
209
209
  (fill in NEEDS_CLARIFY items khi có thêm context)
@@ -225,7 +225,7 @@ Nhóm skill dọn dẹp / migrate artifacts hiện có sau khi template được
225
225
 
226
226
  ### `/artifact-audit [type]`
227
227
 
228
- Phát hiện **main artifact** lỗi thời so với template (xem `conventions.md` §7 Template Versioning). So `template_version` của artifact với `template_version` đọc thẳng từ template tại `.claude/templates/main/` — không manifest, không cache. **Chỉ main artifacts** (`prd`/`domain`/`sad`/`frd`/`fdd`/`tsd`/`crd`/`cdd`); integration artifacts ngoài scope.
228
+ Phát hiện **main artifact** lỗi thời so với template (xem `conventions.md` §7 Template Versioning). So `template_version` của artifact với `template_version` đọc thẳng từ template tại `.claude/templates/main/` — không manifest, không cache. **Chỉ main artifacts** (`prd`/`domain`/`sad`/`frd`/`fdd`/`test-design`/`crd`/`cdd`); integration artifacts ngoài scope.
229
229
 
230
230
  **Scope:** argument là 1 main type (`/artifact-audit frd`) hoặc list (`frd,crd`); không có arg → audit mọi main type. Type resolve theo **filename**.
231
231
 
@@ -260,11 +260,12 @@ Sau khi main artifacts đã sẵn sàng (từ greenfield hoặc brownfield), m
260
260
  | --- | --- | --- |
261
261
  | `/spec-new [requirement]` | `prd.md`, `domain.md`, frd(s), crd(s) | `.specs/integrations/{slug}/spec.md` |
262
262
  | `/spec-tech [number]` | `sad.md`, `domain.md`, cdd(s), fdd(s), `spec.md` | `.specs/integrations/{slug}/tech.md` |
263
- | `/spec-test [number]` | `spec.md`, frd(s), tsd(s), `tech.md` *(optional)* | `.specs/integrations/{slug}/test.md`, `feature/{F-XXX}/tsd.md` |
263
+ | `/spec-test [number]` | `spec.md`, frd(s), test-design(s), `tech.md` *(optional)* | `.specs/integrations/{slug}/test.md`, `feature/{F-XXX}/test-design.md` |
264
+ | `/spec-test-exec [F-XXX]` *(feature-level, sau khi có test-design)* | `feature/{F-XXX}/test-design.md` | `.specs/test-executions/{F-XXX}-*/{NNN}-*/test-exec-*.md` |
264
265
  | `/plan` | `spec.md`, `tech.md`, `domain.md` | `plan.md`, `todo.md` |
265
266
  | `/build` | `plan.md`, `todo.md` | *(source code)* |
266
267
  | `/review-integration` | `spec.md`, `tech.md`, `plan.md`, `todo.md`, *(source code)* | *(findings report)* |
267
- | `/archive` | `.specs/integrations/` | `.specs/archive/` |
268
+ | `/archive` | `.specs/integrations/`, `.specs/test-executions/` | `.specs/archive/{integrations,test-executions}/` |
268
269
 
269
270
  ### `/spec-new [requirement]`
270
271
 
@@ -308,21 +309,34 @@ Tạo `.specs/integrations/{slug}/test.md` cho một integration. Chạy bởi *
308
309
 
309
310
  **Luôn hiển thị danh sách tất cả integrations** trong `.specs/integrations/`, đánh dấu `✓` những cái đã có `test.md`. Nếu có argument → chọn luôn không cần hiển thị.
310
311
 
311
- **Gate check:** spec.md phải `approved` + `features:` non-empty. Integration có `features: []` (thuần component) → dừng vì component-level `tsd` không tồn tại trong kit này.
312
+ **Gate check:** spec.md phải `approved` + `features:` non-empty. Integration có `features: []` (thuần component) → dừng vì component-level `test-design` không tồn tại trong kit này.
312
313
 
313
- Context load: `spec.md` + `frd.md` (cho mỗi feature — source của TC) + `tsd.md` (cho mỗi feature nếu tồn tại, để diff và assign next ID) + `tech.md` *(optional, hint env / data set / NFR threshold)*.
314
+ Context load: `spec.md` + `frd.md` (cho mỗi feature — source của TC) + `test-design.md` (cho mỗi feature nếu tồn tại, để diff và assign next ID) + `tech.md` *(optional, hint env / data set / NFR threshold)*.
314
315
 
315
316
  **KHÔNG interview** — agent **mechanical derive** TC từ frd.md:
316
317
  - mỗi Flow → 1 Test Scenario (`TS-F{NNN}-{seq}`)
317
318
  - mỗi US AC → 1 Functional TC
318
319
  - mỗi VR → 1 positive + 1+ negative Validation TC
319
- - mỗi FAC → 1 Feature AC TC (theo nhóm e2e / consistency / NFR / data & migration)
320
+ - mỗi FAC → 1 E2E TC (Type e2e / consistency)
321
+ - mỗi NFR → 1 Non-functional TC; mỗi DM → 1 Data & Migration TC
320
322
 
321
- Priority deterministic: US Priority Must/Should/Could → P0/P1/P2 (TC cover US/AC); VR → inherit max priority của Refs; FAC e2e/security/data → P0, consistency/perf/a11y → P1.
323
+ Priority deterministic: US Priority Must/Should/Could → P0/P1/P2 (TC cover US/AC); VR → inherit max priority của Refs; FAC e2e + NFR security + DM → P0, FAC consistency + NFR perf/a11y → P1.
322
324
 
323
- **Cascade Proposals** đề xuất delta cho mỗi `feature/{F-XXX}/tsd.md` qua Changes blocks với markers `[NEW]/[MODIFY {field}]/[REMOVE]`. Feature no-delta → **bỏ block hoàn toàn**, ghi `no-op` trong Cascade Summary.
325
+ **Cascade Proposals** đề xuất delta cho mỗi `feature/{F-XXX}/test-design.md` qua Changes blocks với markers `[NEW]/[MODIFY {field}]/[REMOVE]`. Feature no-delta → **bỏ block hoàn toàn**, ghi `no-op` trong Cascade Summary.
324
326
 
325
- QC review: override priority defaults, fill placeholders (env / data / OOS / strategy), add extra edge cases ngoài AC/VR nếu thấy cần. Sau confirm → auto-cascade ghi tsd.md.
327
+ QC review: override priority defaults, fill placeholders (env / data / OOS / strategy), add extra edge cases ngoài AC/VR nếu thấy cần. Sau confirm → auto-cascade ghi test-design.md.
328
+
329
+ ---
330
+
331
+ ### `/spec-test-exec [F-XXX]`
332
+
333
+ Sinh **bundle test-executions** (bản thực thi) cho **một feature** từ `test-design.md`. Layer EXECUTION — `test-design.md` là **source of truth**, skill **đọc-xuống một chiều** (KHÔNG cascade, KHÔNG sửa test-design). Feature-level, chạy *sau* khi feature đã có test-design (không thuộc per-integration pipeline).
334
+
335
+ **Cách chạy:** `/spec-test-exec` (list feature có test-design) hoặc `/spec-test-exec F-012`.
336
+
337
+ **Output:** cycle bundle `.specs/test-executions/{F-XXX}-{slug}/{NNN}-{cycle-slug}/` (plane 2 tầng — feature group → cycle bundle, `{NNN}` reset per-feature, ephemeral per chu kỳ test). Mỗi lần chạy = cycle mới.
338
+
339
+ Route TC theo **section nguồn + Autoable**, sinh **tới 6 doc** (4 nếu feature không NFR/DM): `func-manual` (toàn bộ Functional+Validation), `func-auto` (Autoable=YES/MAYBE), `e2e-manual` + `e2e-auto` (toàn bộ E2E), `nfr`, `dm` *(nfr/dm bỏ nếu section rỗng)*. **Sinh hết để team chọn harness** theo kỹ năng (e2e: manual⇄auto thay thế hoàn toàn; func: auto-only lọt exploratory/visual). **Inherit `TC-F*` nguyên văn** (không đẻ ID) + completeness check mọi TC ở Traceability Matrix rơi đúng 1 scope bucket. KHÔNG versioned. Chi tiết: `conventions.md` §8, `terms/003`+`004`.
326
340
 
327
341
  ---
328
342
 
@@ -384,17 +398,17 @@ Review implementation sau `/build` theo năm trục: correctness, readability, a
384
398
 
385
399
  ### `/archive`
386
400
 
387
- Di chuyển integration đã hoàn thành hoặc không còn active từ `.specs/integrations/` sang `.specs/archive/` để dọn dẹp thư mục làm việc chính.
401
+ Di chuyển artifact đã hoàn thành / không còn active sang `.specs/archive/` hỗ trợ **cả 2 plane** **namespace theo loại**.
388
402
 
389
- **Bước 1 — Kiểm tra thư mục:** Tự động tạo `.specs/archive/` nếu chưa tồn tại.
403
+ **Bước 1 — Chuẩn bị:** Tạo lazy subfolder theo loại `.specs/archive/integrations/` và/hoặc `.specs/archive/test-executions/`.
390
404
 
391
- **Bước 2 — Liệt kê:** Quét `.specs/integrations/`, hiển thị numbered list kèm status (đọc từ `spec.md` nếu ). Nếu không integration nào thông báo dừng.
405
+ **Bước 2 — Liệt kê:** Quét `.specs/integrations/` (mỗi `{id}-{slug}/`) `.specs/test-executions/` (mỗi cycle bundle `{F-XXX}-{slug}/{NNN}-{cycle-slug}/`, + tùy chọn cả feature group). Hiển thị 2 section đánh số liên tục. Cả hai rỗng → dừng.
392
406
 
393
- **Bước 3 — Xác nhận:** Hiển thị preview mapping `integrations/{slug}/ → archive/{slug}/` trước khi di chuyển. Chờ user confirm.
407
+ **Bước 3 — Xác nhận:** Preview source namespaced dest (`integrations/{slug}/ → archive/integrations/{slug}/`; cycle bundle `archive/test-executions/{F-XXX}-{slug}/{NNN}-{cycle-slug}/`). Dedupe nếu chọn cả feature group lẫn cycle con.
394
408
 
395
- **Bước 4 — Di chuyển:** Move toàn bộ thư mục, giữ nguyên cấu trúc bên trong. Nếu slug đã tồn tại trong `.specs/archive/` → bỏ qua cảnh báo để tránh ghi đè.
409
+ **Bước 4 — Di chuyển:** Move giữ nguyên cấu trúc nguồn dưới subfolder loại (test-exec giữ 2 tầng). Dest đã tồn tại → bỏ qua + cảnh báo (no-overwrite). Feature group nguồn rỗng sau khi archive cycle → dọn thư mục rỗng.
396
410
 
397
- **Bước 5 — Kết quả:** Liệt kê integrations đã archive, integrations bị bỏ qua (nếu có), và số integration còn lại trong `.specs/integrations/`.
411
+ **Bước 5 — Kết quả:** Liệt kê đã archive, bị bỏ qua (nếu có), và số còn lại mỗi plane.
398
412
 
399
413
  ---
400
414
 
@@ -410,7 +424,7 @@ Di chuyển integration đã hoàn thành hoặc không còn active từ `.specs
410
424
  ▼ ▼
411
425
  /spec-tech /spec-test
412
426
  (review + cascade (review + cascade
413
- → cdd / fdd / sad) → tsd)
427
+ → cdd / fdd / sad) → test-design)
414
428
  │ │
415
429
  └───────────┬───────────┘
416
430
  │ (tech.md approved — /plan KHÔNG đợi test.md)
@@ -12,15 +12,15 @@ referenced_by:
12
12
 
13
13
  ## Context
14
14
 
15
- <!-- Tóm tắt ngắn các thông tin quan trọng từ context đã load (spec.md, tech.md, frd.md, current tsd.md của các feature touched), để file self-contained. -->
15
+ <!-- Tóm tắt ngắn các thông tin quan trọng từ context đã load (spec.md, tech.md, frd.md, current test-design.md của các feature touched), để file self-contained. -->
16
16
 
17
17
  ## Test Strategy
18
18
 
19
19
  <!--
20
20
  Strategy cho integration này — KHÔNG lặp lại Strategy chung của feature.
21
21
  Chỉ ghi delta hoặc nhấn mạnh phần đặc thù integration:
22
- - Loại test ưu tiên (functional / validation / FAC / cross-story consistency / NFR).
23
- - Environments / data set / fixture đặc thù.
22
+ - Loại test ưu tiên (functional / validation / FAC e2e: journey / consistency / integrity / NFR / data & migration).
23
+ - Yêu cầu data đặc thù integration (shape) — nguồn/refresh/env assignment thuộc execution layer, KHÔNG ở đây.
24
24
  - Risk areas (vd: data migration cần backfill verify, integration đụng auth flow → security regression).
25
25
  -->
26
26
 
@@ -28,46 +28,40 @@ Chỉ ghi delta hoặc nhấn mạnh phần đặc thù integration:
28
28
 
29
29
  - {bullet ngắn}
30
30
 
31
- ### Environments
32
-
33
- | Env | Mục đích | Data set | Ghi chú |
34
- | --- | --- | --- | --- |
35
- | {dev / staging / prod-like} | {functional / E2E / load} | {seed / anonymized prod} | ... |
36
-
37
31
  ## Changes
38
32
 
39
33
  <!--
40
- test.md = changeset patch áp lên feature tsd.md(s). Mỗi block dưới đây tương ứng 1 feature bị touched.
34
+ test.md = changeset patch áp lên feature test-design.md(s). Mỗi block dưới đây tương ứng 1 feature bị touched.
41
35
  Lặp block cho mỗi feature trong `features:` frontmatter mà có delta TC.
42
36
 
43
37
  **Khi nào BỎ block của 1 feature:**
44
- - Diff giữa frd hiện tại và tsd.md hiện tại của feature đó = empty (frd không thêm/đổi item nào mà tsd chưa cover).
38
+ - Diff giữa frd hiện tại và test-design.md hiện tại của feature đó = empty (frd không thêm/đổi item nào mà test-design chưa cover).
45
39
  - Bỏ block hoàn toàn, ghi `no-op` cho feature đó trong Cascade Summary để minh bạch.
46
40
 
47
41
  **Operation:**
48
- - `create` — feature/{F-XXX}/tsd.md chưa tồn tại. Nội dung đầy đủ theo template gốc, mọi TS/TC implicit [NEW] (không cần marker).
49
- - `update` — feature/{F-XXX}/tsd.md đã tồn tại. Chỉ liệt kê TS/TC bị ảnh hưởng. Mỗi item có marker:
50
- - `[NEW]` — TS/TC chưa có trong tsd hiện tại
42
+ - `create` — feature/{F-XXX}/test-design.md chưa tồn tại. Nội dung đầy đủ theo template gốc, mọi TS/TC implicit [NEW] (không cần marker).
43
+ - `update` — feature/{F-XXX}/test-design.md đã tồn tại. Chỉ liệt kê TS/TC bị ảnh hưởng. Mỗi item có marker:
44
+ - `[NEW]` — TS/TC chưa có trong test-design hiện tại
51
45
  - `[MODIFY {field}]` — TS/TC đã có, đang đổi field cụ thể (ví dụ `[MODIFY steps]`, `[MODIFY expected]`, `[MODIFY priority]`, `[MODIFY covers]`)
52
46
  - `[REMOVE]` — TS/TC đã có, sẽ bị xóa (ID retire — không tái sử dụng)
53
47
 
54
- **Format reference:** dùng đúng format của template gốc — KHÔNG duplicate skeleton ở đây. `templates/main/feature/tsd-template.md` là single source of truth cho format.
48
+ **Format reference:** dùng đúng format của template gốc — KHÔNG duplicate skeleton ở đây. `templates/main/feature/test-design-template.md` là single source of truth cho format.
55
49
 
56
- **ID assignment:** agent đọc tsd.md hiện tại của feature để xác định next ID:
50
+ **ID assignment:** agent đọc test-design.md hiện tại của feature để xác định next ID:
57
51
  - `TS-F{NNN}-{seq}` cho Test Scenarios
58
- - `TC-F{NNN}-{seq}` cho Test Cases (Functional, Validation, Feature AC dùng chung sequence — không reset theo loại)
52
+ - `TC-F{NNN}-{seq}` cho Test Cases (Functional, Validation, E2E dùng chung sequence — không reset theo loại)
59
53
  - ID **stable** — không tái sử dụng khi [REMOVE], không renumber khi [MODIFY].
60
54
 
61
- **Auto-cascade:** sau khi human approve test.md, agent tự apply tất cả Changes blocks vào feature tsd.md. Integration test.md được giữ như PR record bất biến.
55
+ **Auto-cascade:** sau khi human approve test.md, agent tự apply tất cả Changes blocks vào feature test-design.md. Integration test.md được giữ như PR record bất biến.
62
56
  -->
63
57
 
64
- ### feature/{F-XXX}-{feature-slug}/tsd.md *(lặp block cho mỗi feature trong `features:` mà có delta TC; bỏ block nếu no-delta)*
58
+ ### feature/{F-XXX}-{feature-slug}/test-design.md *(lặp block cho mỗi feature trong `features:` mà có delta TC; bỏ block nếu no-delta)*
65
59
 
66
60
  **Operation:** create | update
67
- **Format reference:** [tsd-template.md](../../templates/main/feature/tsd-template.md)
61
+ **Format reference:** [test-design-template.md](../../templates/main/feature/test-design-template.md)
68
62
 
69
63
  <!--
70
- operation=create → nội dung đầy đủ theo tsd-template.md (Overview, Test Strategy, Test Scenarios, Functional TCs, Validation TCs, Feature AC TCs, Test Data, Traceability Matrix, Out of Scope, Dependencies).
64
+ operation=create → nội dung đầy đủ theo test-design-template.md (Overview, Test Strategy, Test Scenarios, Functional TCs, Validation TCs, E2E TCs, Non-Functional TCs, Data & Migration TCs, Test Data Requirements, Traceability Matrix, Out of Scope, Dependencies).
71
65
  operation=update → chỉ liệt kê TS/TC bị ảnh hưởng, mỗi item có marker, và **bắt buộc update Traceability Matrix** rows tương ứng.
72
66
 
73
67
  Ví dụ operation=update:
@@ -121,13 +115,13 @@ Ví dụ operation=update:
121
115
  | `TC-F001-030` | `VR-F001-008` | `refund_reason` | `"Customer changed mind"` | accept | positive | NEW |
122
116
  | `TC-F001-031` | `VR-F001-008` | `refund_reason` | `"abc"` | reject — min length | negative | NEW |
123
117
 
124
- #### Feature AC Test Cases
118
+ #### E2E Test Cases
125
119
 
126
120
  ##### TC-F001-040 [NEW]: E2E checkout + refund
127
121
 
128
122
  | Field | Value |
129
123
  | --- | --- |
130
- | **Type** | Feature AC e2e |
124
+ | **Type** | E2Ejourney |
131
125
  | **Priority** | P0 |
132
126
  | **Covers** | `FAC-F001-004` |
133
127
  | **Spans** | `US-F001-001`, `US-F001-005` |
@@ -135,6 +129,32 @@ Ví dụ operation=update:
135
129
  **Steps:** ...
136
130
  **Expected:** ...
137
131
 
132
+ #### Non-Functional Test Cases
133
+
134
+ ##### TC-F001-045 [NEW]: Refund endpoint chịu tải
135
+
136
+ | Field | Value |
137
+ | --- | --- |
138
+ | **Type** | Non-functional — performance |
139
+ | **Priority** | P1 |
140
+ | **Covers** | `NFR-F001-002` |
141
+
142
+ **Steps:** ...
143
+ **Expected:** ...
144
+
145
+ #### Data & Migration Test Cases
146
+
147
+ ##### TC-F001-048 [NEW]: Backfill refund_reason cho order cũ
148
+
149
+ | Field | Value |
150
+ | --- | --- |
151
+ | **Type** | Data migration |
152
+ | **Priority** | P0 |
153
+ | **Covers** | `DM-F001-001` |
154
+
155
+ **Steps:** ...
156
+ **Expected:** ...
157
+
138
158
  #### Traceability Matrix
139
159
 
140
160
  Bổ sung row cho mọi item mới + cập nhật row cho item bị [MODIFY]. KHÔNG xóa row của [REMOVE] — đánh dấu retire.
@@ -145,6 +165,8 @@ Bổ sung row cho mọi item mới + cập nhật row cho item bị [MODIFY]. KH
145
165
  | `AC-F001-012` | Story AC | `TC-F001-022` | ✅ | NEW |
146
166
  | `VR-F001-008` | VR | `TC-F001-030`, `TC-F001-031` | ✅ | NEW |
147
167
  | `FAC-F001-004` | Feature AC | `TC-F001-040` | ✅ | NEW |
168
+ | `NFR-F001-002` | NFR | `TC-F001-045` | ✅ | NEW |
169
+ | `DM-F001-001` | Data & Migration | `TC-F001-048` | ✅ | NEW |
148
170
  | Flow 3 | Flow | `TS-F001-003` | ✅ | NEW |
149
171
  -->
150
172
 
@@ -162,5 +184,5 @@ Bổ sung row cho mọi item mới + cập nhật row cho item bị [MODIFY]. KH
162
184
 
163
185
  | Artifact | Operation | Summary |
164
186
  | --- | --- | --- |
165
- | `feature/F-XXX-{slug}/tsd.md` | create / update | {ngắn: +N TS, +M TC, modify TC-F001-008, remove TC-F001-015} |
166
- | `feature/F-YYY-{slug}/tsd.md` | no-op | frd không đổi, tsd hiện tại đã cover full |
187
+ | `feature/F-XXX-{slug}/test-design.md` | create / update | {ngắn: +N TS, +M TC, modify TC-F001-008, remove TC-F001-015} |
188
+ | `feature/F-YYY-{slug}/test-design.md` | no-op | frd không đổi, test-design hiện tại đã cover full |