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.
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,10 @@ 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
+
131
+ #### `/spec-test-exec [F-XXX]`
132
+ 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), inherit `TC-F*` nguyên văn. Output: cycle bundle `.specs/test-executions/{F-XXX}-{slug}/{NNN}-{cycle-slug}/` (plane 2 tầng, ephemeral per chu kỳ test). Sinh tới 6 doc theo scope×harness — `func-manual`/`func-auto`, `e2e-manual`/`e2e-auto`, `nfr`, `dm` (nfr/dm bỏ nếu rỗng); team chọn harness theo kỹ năng. KHÔNG versioned. Feature-level, chạy sau khi có test-design (không thuộc per-integration pipeline).
130
133
 
131
134
  #### `/plan`
132
135
  Tạo `plan.md` và `todo.md` từ `spec.md` + `tech.md`.
@@ -171,15 +174,18 @@ Migrate **main artifact** lỗi thời lên structure mới (mọi main type). T
171
174
  | `/spec-brownfield-init` | `.specs/main/prd.md`, `.specs/main/domain.md`, `.specs/main/sad.md` |
172
175
  | `/spec-brownfield-component` | `.specs/main/component/{C-XXX}-*/crd.md + cdd.md` |
173
176
  | `/spec-brownfield-feature` | `.specs/main/feature/{F-XXX}-*/frd.md + fdd.md` |
174
- | `/spec-tsd` | `.specs/main/feature/{F-XXX}-*/tsd.md` |
177
+ | `/spec-test-design` | `.specs/main/feature/{F-XXX}-*/test-design.md` |
175
178
  | `/artifact-audit` | *(báo cáo out-dated; + stamp `template_version` cho main artifact legacy conform)* |
176
179
  | `/artifact-migrate` | *(modify in-place main artifact lỗi thời lên structure mới + set `template_version`)* |
177
180
  | `/spec-new` | `.specs/integrations/{slug}/spec.md` |
178
181
  | `/spec-tech` | `.specs/integrations/{slug}/tech.md` |
179
- | `/spec-test` | `.specs/integrations/{slug}/test.md`, cascade: `feature/{F-XXX}/tsd.md` |
182
+ | `/spec-test` | `.specs/integrations/{slug}/test.md`, cascade: `feature/{F-XXX}/test-design.md` |
183
+ | `/spec-test-exec` | `.specs/test-executions/{F-XXX}-*/{NNN}-*/test-exec-*.md` (derived từ test-design) |
180
184
  | `/plan` | `.specs/integrations/{slug}/plan.md`, `todo.md` |
181
185
  | `/build` | *(implements tasks từ `plan.md`/`todo.md`)* |
182
186
  | `/review-integration` | *(findings report — không tạo file)* |
183
187
  | `/review-everything` | `.specs/integrations/{NNN}-{slug}/review-findings.md` *(qua /spec-new)* |
184
188
 
185
189
  Feature artifacts (`frd.md`) ở greenfield có thể author trước bằng `/spec-frd`, hoặc mọc dần qua **cascade proposals** từ integrations (`/spec-new` fallback). Component artifacts (`crd.md`/`cdd.md`) ở greenfield chỉ mọc qua cascade — không có skill author trực tiếp (`/spec-frd` chỉ reference component, không tạo crd/cdd).
190
+
191
+ Ngoài `main/` và `integrations/`, còn plane thứ ba **`.specs/test-executions/`** (execution layer): bundle thực thi *derived* từ `test-design.md` qua `/spec-test-exec`, đánh số per-feature 2 tầng (`{F-XXX}-{slug}/{NNN}-{cycle-slug}/`), ephemeral per chu kỳ test, không versioned. Xem `conventions.md` §8.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-lite",
3
- "version": "1.5.2",
3
+ "version": "1.7.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,116 +1,125 @@
1
1
  ---
2
2
  name: archive
3
- description: Archive một integration từ .specs/integrations sang .specs/archive. Dùng khi một integration đã hoàn thành hoặc không còn active và cần được lưu trữ ra khỏi thư mục làm việc chính.
3
+ description: Archive một integration hoặc một test-execution (cycle bundle / feature group) sang .specs/archive/ — namespaced theo loại (.specs/archive/integrations/ .specs/archive/test-executions/). Dùng khi integration đã hoàn thành hoặc một chu kỳ test đã xong và cần dọn ra khỏi thư mục làm việc chính.
4
4
  ---
5
5
 
6
6
  # archive
7
7
 
8
8
  ## Overview
9
9
 
10
- Di chuyển một integration từ `.specs/integrations/` sang `.specs/archive/` để dọn dẹp thư mục làm việc chính trong khi vẫn giữ nguyên toàn bộ nội dung integration đó.
10
+ Di chuyển một artifact bundle ra khỏi thư mục làm việc sang `.specs/archive/`, giữ nguyên nội dung. Hỗ trợ **hai plane**:
11
+
12
+ - **Integration**: `.specs/integrations/{id}-{slug}/` → `.specs/archive/integrations/{id}-{slug}/`
13
+ - **Test execution**: `.specs/test-executions/{F-XXX}-{slug}/{NNN}-{cycle-slug}/` → `.specs/archive/test-executions/{F-XXX}-{slug}/{NNN}-{cycle-slug}/`
14
+ - Đơn vị archive = **cycle bundle** (một chu kỳ test xong) hoặc **cả feature group** (`{F-XXX}-{slug}/`) khi feature retire.
15
+
16
+ `.specs/archive/` được **namespace theo loại** (`integrations/` + `test-executions/`) để không trộn lẫn hai plane. Cấu trúc nguồn được giữ nguyên dưới subfolder loại (test-exec giữ 2 tầng feature-group → cycle-bundle).
11
17
 
12
18
  ## When to Use
13
19
 
14
- - Integration đã hoàn thành (Done) không cần active nữa
15
- - Integration bị cancel hoặc deferred thời hạn
16
- - Muốn dọn dẹp `.specs/integrations/` khỏi các integration
20
+ - Integration đã hoàn thành (Done) / cancel / deferred vô thời hạn.
21
+ - Một **chu kỳ test** (cycle bundle test-exec) đã chạy xong, muốn lưu kết quả ra khỏi working set.
22
+ - Feature retire archive cả feature group test-executions của nó.
23
+ - Dọn dẹp `.specs/integrations/` hoặc `.specs/test-executions/` khỏi bundle cũ.
17
24
 
18
25
  ## When NOT to Use
19
26
 
20
- - Integration đang In Progress → chưa nên archive
21
- - Muốn xóa hoàn toàn đừng archive, thao tác thủ công sau khi confirm với team
27
+ - Integration đang In Progress → chưa nên archive.
28
+ - Cycle test đang chạy dở (Test Result chưa xong) chưa archive.
29
+ - Muốn xóa hoàn toàn → đừng archive, thao tác thủ công sau khi confirm với team.
22
30
 
23
31
  ---
24
32
 
25
33
  ## Process
26
34
 
27
- ### Bước 1: Kiểm tra thư mục archive
35
+ ### Bước 1: Chuẩn bị thư mục archive
28
36
 
29
- Kiểm tra `.specs/archive/` đã tồn tại chưa.
37
+ `.specs/archive/` chứa subfolder theo loại. **Tạo lazy** — chỉ tạo subfolder loại nào khi thực sự archive item thuộc loại đó:
30
38
 
31
- **Nếu chưa tồn tại** tạo thư mục `.specs/archive/`.
32
-
33
- **Nếu đã tồn tại** → tiếp tục.
39
+ - Archive integrationđảm bảo `.specs/archive/integrations/` tồn tại (tạo nếu chưa).
40
+ - Archive test-execution → đảm bảo `.specs/archive/test-executions/` tồn tại (tạo nếu chưa).
34
41
 
35
42
  ---
36
43
 
37
- ### Bước 2: Liệt kê integrations
38
-
39
- Quét `.specs/integrations/` để tìm tất cả các integration (mỗi integration là một thư mục con).
44
+ ### Bước 2: Liệt kê archivable từ cả hai plane
40
45
 
41
- **Nếu không integration nào:**
46
+ Quét `.specs/integrations/` và `.specs/test-executions/`. Hiển thị danh sách **chia section theo plane, đánh số liên tục**:
42
47
 
43
48
  ```
44
- Không có integration nào trong .specs/integrations/.
45
- ```
46
-
47
- Dừng lại.
48
-
49
- **Nếu có integrations**, hiển thị danh sách dạng numbered list, kèm trạng thái nếu đọc được từ `spec.md` (frontmatter `status` hoặc heading):
50
-
51
- ```
52
- Integrations trong .specs/integrations/:
49
+ Archivable:
53
50
 
51
+ Integrations (.specs/integrations/):
54
52
  [1] 001-user-authentication (approved)
55
- [2] 002-payment-integration (draft)
56
- [3] 003-notification-service (done)
57
- [4] 004-admin-panel (in-progress)
53
+ [2] 003-notification-service (done)
54
+
55
+ Test executions (.specs/test-executions/):
56
+ [3] F-012-bulk-import / 001-regression
57
+ [4] F-012-bulk-import / 002-release-2.0
58
+ [5] F-012-bulk-import (cả feature group — gồm 001, 002)
59
+ [6] F-031-checkout / 001-smoke
58
60
 
59
- Chọn số thứ tự integration để archive (hoặc nhập nhiều số cách nhau bởi dấu cách, ví dụ: 1 3):
61
+ Chọn số để archive (nhiều số cách nhau bởi dấu cách, ví dụ: 1 3):
60
62
  ```
61
63
 
62
- Với mỗi integration, cố gắng đọc `spec.md` để lấy status. Nếu không đọc được thì bỏ qua phần status.
64
+ - **Integration**: mỗi `{id}-{slug}/` 1 dòng. Cố đọc `spec.md` frontmatter `status` để hiển thị (bỏ qua nếu không đọc được).
65
+ - **Test execution**: mỗi **cycle bundle** `{F-XXX}-{slug}/{NNN}-{cycle-slug}/` là 1 dòng (qualified tên feature group). **Thêm 1 dòng cho cả feature group** `{F-XXX}-{slug}/` để archive trọn gói.
66
+ - Cả hai plane rỗng → `Không có gì để archive trong .specs/integrations/ và .specs/test-executions/.` → dừng.
63
67
 
64
68
  ---
65
69
 
66
70
  ### Bước 3: Xác nhận
67
71
 
68
- Sau khi user chọn, hiển thị xác nhận trước khi di chuyển:
72
+ Hiển thị source **namespaced dest** trước khi di chuyển:
69
73
 
70
74
  ```
71
- Sẽ archive các integration sau:
75
+ Sẽ archive:
72
76
 
73
- .specs/integrations/001-user-authentication/ → .specs/archive/001-user-authentication/
74
- .specs/integrations/003-notification-service/ → .specs/archive/003-notification-service/
77
+ .specs/integrations/001-user-authentication/
78
+ → .specs/archive/integrations/001-user-authentication/
79
+
80
+ .specs/test-executions/F-012-bulk-import/001-regression/
81
+ → .specs/archive/test-executions/F-012-bulk-import/001-regression/
75
82
 
76
83
  Xác nhận? (yes/no)
77
84
  ```
78
85
 
79
- Nếu user không confirmhủy, không làm gì.
86
+ - Nếu user chọn **cả feature group** lẫn một cycle con của nó cảnh báo trùng, chỉ giữ feature group (archive group bao trọn cycle).
87
+ - Không confirm → hủy, không làm gì.
80
88
 
81
89
  ---
82
90
 
83
91
  ### Bước 4: Di chuyển
84
92
 
85
- Với mỗi integration đã được confirm:
93
+ Với mỗi item đã confirm, di chuyển **giữ nguyên cấu trúc nguồn** dưới subfolder loại:
94
+
95
+ - Integration: `.specs/integrations/{id}-{slug}/` → `.specs/archive/integrations/{id}-{slug}/`
96
+ - Cycle bundle: `.specs/test-executions/{F-XXX}-{slug}/{NNN}-{cycle-slug}/` → `.specs/archive/test-executions/{F-XXX}-{slug}/{NNN}-{cycle-slug}/` (tạo feature group dưới archive nếu chưa có).
97
+ - Feature group: `.specs/test-executions/{F-XXX}-{slug}/` → `.specs/archive/test-executions/{F-XXX}-{slug}/`.
86
98
 
87
- - Di chuyển toàn bộ thư mục `.specs/integrations/{slug}/` sang `.specs/archive/{slug}/`
88
- - Giữ nguyên toàn bộ cấu trúc thư mục và file bên trong
99
+ Sau khi di chuyển cycle bundle, nếu feature group nguồn **rỗng** (không còn cycle nào) → xóa thư mục feature group rỗng ở `.specs/test-executions/` cho gọn.
89
100
 
90
- Nếu `.specs/archive/{slug}/` đã tồn tại (trùng tên) cảnh báo:
101
+ **No-overwrite guard:** nếu dest đã tồn tại → cảnh báo và **bỏ qua** item đó (không ghi đè frozen record):
91
102
 
92
103
  ```
93
- ⚠ .specs/archive/001-user-authentication/ đã tồn tại. Bỏ qua integration này để tránh ghi đè.
104
+ ⚠ .specs/archive/test-executions/F-012-bulk-import/001-regression/ đã tồn tại. Bỏ qua để tránh ghi đè.
94
105
  ```
95
106
 
96
- bỏ qua integration đó, tiếp tục với các integration còn lại.
107
+ Tiếp tục với các item còn lại.
97
108
 
98
109
  ---
99
110
 
100
111
  ### Bước 5: Kết quả
101
112
 
102
- Thông báo kết quả:
103
-
104
113
  ```
105
114
  ✓ Đã archive:
106
- .specs/archive/001-user-authentication/
107
- .specs/archive/003-notification-service/
115
+ .specs/archive/integrations/001-user-authentication/
116
+ .specs/archive/test-executions/F-012-bulk-import/001-regression/
108
117
 
109
- {nếu có lỗi}
118
+ {nếu có}
110
119
  ⚠ Bỏ qua (đã tồn tại):
111
- .specs/archive/005-foo/
120
+ .specs/archive/test-executions/F-031-checkout/001-smoke/
112
121
 
113
- .specs/integrations/ hiện còn {N} integration(s).
122
+ Còn lại: {N} integration(s), {M} test-execution cycle(s).
114
123
  ```
115
124
 
116
125
  ---
@@ -119,7 +128,9 @@ Thông báo kết quả:
119
128
 
120
129
  Trước khi di chuyển:
121
130
 
122
- - [ ] `.specs/archive/` đã tồn tại (tạo nếu chưa)
123
- - [ ] User đã chọn ít nhất 1 integration
124
- - [ ] User đã confirm trước khi di chuyển
125
- - [ ] Không ghi đè nếu slug đã tồn tại trong `.specs/archive/`
131
+ - [ ] Subfolder loại tương ứng (`.specs/archive/integrations/` hoặc `.specs/archive/test-executions/`) đã tồn tại (tạo lazy nếu chưa).
132
+ - [ ] User đã chọn ít nhất 1 item.
133
+ - [ ] User đã confirm; trùng feature-group cycle-con đã dedupe.
134
+ - [ ] Cấu trúc nguồn giữ nguyên dưới subfolder loại (test-exec giữ 2 tầng).
135
+ - [ ] Không ghi đè nếu dest đã tồn tại.
136
+ - [ ] Feature group nguồn rỗng sau khi archive cycle → dọn thư mục rỗng.
@@ -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):