spec-lite 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-lite",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Spec-driven development kit for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,385 @@
1
+ ---
2
+ name: spec-frd-update
3
+ description: Migrate frd.md hiện có lên cấu trúc template mới nhất — fix Mermaid syntax, rename Feature AC → FAC (counter riêng), thêm Verification Rules section, cascade ID remap qua fdd/tsd/test/spec/tech. Dùng cho repo đã onboard SDD từ trước khi template thay đổi.
4
+ ---
5
+
6
+ # spec-frd-update
7
+
8
+ ## Overview
9
+
10
+ Migrate các file `specs/main/feature/{F-XXX}-{slug}/frd.md` hiện có sang **format mới nhất** của [templates/main/feature/frd-template.md](../../templates/main/feature/frd-template.md).
11
+
12
+ Skill này **chỉ làm migration mechanical + propose** — không phải BA interview. Mọi quyết định nội dung mới (Verification Rules content) đều cần user approve trước khi ghi.
13
+
14
+ ## When to Use
15
+
16
+ - Repo đã chạy `/spec-brownfield-feature` hoặc `/spec-new` từ lâu, frd.md sinh ra theo template cũ — giờ template đã update.
17
+ - Sau khi `git pull` kit mới và phát hiện frd.md hiện tại thiếu section so với template mới.
18
+ - Audit định kỳ để đảm bảo mọi frd.md tuân thủ cùng format.
19
+
20
+ ## When NOT to Use
21
+
22
+ - frd.md chưa tồn tại → dùng `/spec-brownfield-feature` (brownfield) hoặc `/spec-new` (greenfield).
23
+ - Muốn thay đổi **nội dung** frd (thêm US, đổi AC text) → edit thủ công hoặc qua integration changeset.
24
+ - Template chưa thay đổi gì so với khi frd.md được tạo → skill này sẽ no-op, không có gì để làm.
25
+
26
+ ---
27
+
28
+ ## Cảnh báo về ID cascade
29
+
30
+ Skill này có thể **rename Feature AC ID** từ `AC-F{NNN}-{seq}` sang `FAC-F{NNN}-{seq}` (counter riêng, reset từ 001). Các file sau có thể reference những ID này và cần cascade:
31
+
32
+ - `feature/{F-XXX}/fdd.md` — section Verification Implementation
33
+ - `feature/{F-XXX}/tsd.md` — Traceability Matrix, Test Cases
34
+ - `integrations/*/spec.md` — Cascade Proposals, Changes blocks
35
+ - `integrations/*/tech.md` — Changes blocks
36
+ - `integrations/*/test.md` — Coverage table
37
+
38
+ **Mặc định dry-run** — skill in toàn bộ ID remap + diff trước khi ghi, user xác nhận từng feature một.
39
+
40
+ ---
41
+
42
+ ## Migration vectors
43
+
44
+ Skill detect từng frd hiện tại thuộc "era" nào và apply vectors tương ứng:
45
+
46
+ | Vector | Detect bằng | Action | Risk |
47
+ |---|---|---|---|
48
+ | **V1 Mermaid syntax** | Có pattern `\[\{.+?\}\]` trong code block mermaid | Rewrite `[{X}]` → `["X"]` | None |
49
+ | **V2 Flow stability note** | Section `## User Flows` thiếu chuỗi "Flow numbering" | Insert dòng note sau intro | None |
50
+ | **V3 Section rename** | Có heading `## Feature-level Acceptance Criteria` | Rename → `## Feature Acceptance Criteria` + insert 4-group block + Out-of-scope note | Low |
51
+ | **V4 FAC ID renumber** | Trong section Feature AC, IDs dùng prefix `AC-F` (chứ không phải `FAC-F`) | Remap → `FAC-F{NNN}-001..N` + cascade references trong repo | **HIGH** |
52
+ | **V5 US/AC stability notes** | Section User Stories thiếu chuỗi "ID stable" | Insert 2 dòng note | None |
53
+ | **V6 VR section** | Không có heading `## Verification Rules` | Propose VR table từ User Stories → user approve → insert | Medium |
54
+ | **V7 Components Used location** | Section `## Components Consumed` đứng riêng (era pre-84d7303) | Move xuống `## Dependencies` thành subsection `### Components Used` | Low |
55
+ | **V8 User Flows missing** | Không có heading `## User Flows` (era pre-84d7303) | Derive Mermaid flows từ User Stories → propose → user approve → insert. 1 flow / nhóm US liên quan theo journey logic. | Medium |
56
+
57
+ ---
58
+
59
+ ## Process
60
+
61
+ ### Bước 0: Pre-flight — working tree clean
62
+
63
+ Chạy `git status --porcelain`. Nếu output không rỗng (có file modified / untracked / staged):
64
+
65
+ ```
66
+ ⛔ Working tree không clean. Skill không tạo file backup `.bak` — rollback dựa vào git.
67
+ Hãy commit hoặc stash thay đổi hiện tại trước khi chạy `/spec-frd-update`, rồi chạy lại.
68
+
69
+ Files dirty:
70
+ M specs/main/feature/F-001-auth/frd.md
71
+ ?? notes.md
72
+ ```
73
+
74
+ Dừng hoàn toàn. Skill chỉ proceed khi `git status` clean — đảm bảo mọi change sau đó đều thuộc migration, dễ revert bằng `git checkout -- {path}` hoặc `git restore`.
75
+
76
+ Nếu repo không phải git repo → cảnh báo và yêu cầu confirm:
77
+ > ⚠ Thư mục này không phải git repo. Skill không tạo file backup. Nếu apply sai, không thể rollback. Tiếp tục? (yes / no — default no)
78
+
79
+ ---
80
+
81
+ ### Bước 1: Discover & classify
82
+
83
+ Quét `specs/main/feature/*/frd.md`. Với mỗi file:
84
+
85
+ 1. Parse headings và frontmatter.
86
+ 2. Run detection cho V1–V8.
87
+ 3. Build classification table.
88
+
89
+ Display kết quả:
90
+
91
+ ```
92
+ Detected FRDs:
93
+
94
+ [1] F-001 — auth | Era: 2026-04 | Vectors needed: V1, V3, V4 (3 IDs), V5, V6
95
+ [2] F-002 — checkout | Era: 2026-05 | Vectors needed: V5, V6
96
+ [3] F-003 — refund | Era: current | Vectors needed: — (đã clean)
97
+ [4] F-004 — admin-panel | Era: pre-flows | Vectors needed: V1, V3, V4 (2 IDs), V5, V6, V7, V8
98
+
99
+ Tổng: 4 FRDs · 3 cần migration · 1 đã sạch.
100
+ ```
101
+
102
+ Hỏi user scope:
103
+
104
+ ```
105
+ Migrate FRDs nào?
106
+ [A] Tất cả cần migration (3 files)
107
+ [1] Chỉ F-001
108
+ [2] Chỉ F-002
109
+ ...
110
+ [N] Chọn subset (nhập danh sách số, vd: "1 4")
111
+ [X] Hủy
112
+
113
+ Lựa chọn:
114
+ ```
115
+
116
+ Nếu không có FRD nào cần migration → thông báo `Tất cả frd.md đã clean. No-op.` rồi dừng.
117
+
118
+ ---
119
+
120
+ ### Bước 2: Load context per FRD
121
+
122
+ Với mỗi FRD đã chọn, load các file sau (chỉ những gì cần thiết — KHÔNG load conventions.md, KHÔNG load source code):
123
+
124
+ | File | Bắt buộc | Mục đích |
125
+ |---|---|---|
126
+ | `specs/main/feature/{F-XXX}-{slug}/frd.md` | ✓ | File cần migrate |
127
+ | [templates/main/feature/frd-template.md](../../templates/main/feature/frd-template.md) | ✓ | Target structure — copy text cho V2/V3/V5 |
128
+ | `specs/main/feature/{F-XXX}-{slug}/fdd.md` | nếu tồn tại | Cascade target cho V4 (AC→FAC rename) |
129
+ | `specs/main/feature/{F-XXX}-{slug}/tsd.md` | nếu tồn tại | Cascade target cho V4 |
130
+ | `specs/main/domain.md` (Shared Entities block) | optional | Cho V6 — match field name với entity glossary để pick semantic type consistent |
131
+
132
+ **KHÔNG load:**
133
+ - `conventions.md` — template đã self-contained, load là thừa
134
+ - Source code — frd là WHAT, derive VR từ US/AC chứ không phải implementation
135
+ - `tech.md`/`cdd.md` — có thể contaminate VR bằng tech detail (regex, varchar(255)…)
136
+
137
+ ---
138
+
139
+ ### Bước 3: Apply mechanical vectors (V1, V2, V3, V5, V7)
140
+
141
+ Đây là các vector **không cần model reasoning** — pure text manipulation. Apply tuần tự, không hỏi user.
142
+
143
+ #### V1 — Mermaid syntax fix
144
+ - Regex trong mỗi code block ```mermaid: `\[\{([^}]+)\}\]` → `["$1"]`
145
+ - Edge case: keep escaped braces nguyên vẹn, chỉ replace pattern `[{...}]` ở edge label / node label.
146
+
147
+ #### V2 — Flow stability note
148
+ - Sau bullet intro của `## User Flows` (dòng `{Mỗi flow là một Mermaid…}`), insert:
149
+ > Flow numbering **stable** — không renumber khi xóa flow. Nếu xóa Flow 1, Flow 2 giữ nguyên số (không tái sử dụng số 1).
150
+
151
+ #### V3 — Section rename + structure
152
+ - Rename heading `## Feature-level Acceptance Criteria` → `## Feature Acceptance Criteria`.
153
+ - Replace block intro (dòng "Criteria áp dụng cho toàn bộ feature — không gắn với story…") bằng full block từ template (4 nhóm + Out-of-scope + Format note). Copy nguyên văn từ frd-template.md.
154
+
155
+ #### V5 — US/AC stability notes
156
+ - Sau dòng `US ID format: ...` trong User Stories section, đảm bảo có 2 dòng:
157
+ > US ID format: `US-F{NNN}-{seq}` — đánh số tăng dần toàn feature. ID **stable** — không tái sử dụng seq khi xóa, không renumber.
158
+ >
159
+ > Story AC ID format: `AC-F{NNN}-{seq}` — đánh số tăng dần toàn feature (không reset giữa các story). ID **stable** — không tái sử dụng seq khi xóa, không renumber.
160
+
161
+ #### V7 — Components Used relocation
162
+ - Detect `## Components Consumed` section.
163
+ - Cắt nội dung bảng, xóa heading.
164
+ - Trong `## Dependencies`, ensure có 2 subsections: `### Feature Dependencies` (giữ bảng cũ nếu có) và `### Components Used` (chèn bảng vừa cắt).
165
+
166
+ ---
167
+
168
+ ### Bước 4: V4 — AC → FAC renumber với cascade
169
+
170
+ **Đây là vector cao risk nhất.** Mỗi feature làm tuần tự, không batch.
171
+
172
+ #### 4.1 Parse Feature AC IDs
173
+ - Trong section `## Feature Acceptance Criteria` (đã rename ở V3), extract tất cả ID dạng `AC-F{NNN}-{seq}`.
174
+ - List: `[AC-F001-002, AC-F001-005, AC-F001-007]` (gap OK).
175
+
176
+ #### 4.2 Build remap table
177
+ - Cũ → mới: reset counter từ 001, giữ thứ tự xuất hiện.
178
+ - Ví dụ:
179
+ ```
180
+ AC-F001-002 → FAC-F001-001
181
+ AC-F001-005 → FAC-F001-002
182
+ AC-F001-007 → FAC-F001-003
183
+ ```
184
+
185
+ #### 4.3 Scan cascade references
186
+ - Grep toàn `specs/` cho từng ID cũ.
187
+ - **CRITICAL**: chỉ remap những match THUỘC Feature AC (Bước 4.1 list). KHÔNG đụng Story AC trùng namespace `AC-F{NNN}-{seq}` — đây là string overlap nhưng khác counter.
188
+ - Tạo bảng impact:
189
+ ```
190
+ Cascade impact for F-001:
191
+ feature/F-001-auth/fdd.md 3 refs
192
+ feature/F-001-auth/tsd.md 5 refs
193
+ integrations/003-otp-flow/spec.md 1 ref
194
+ integrations/003-otp-flow/test.md 2 refs
195
+ ```
196
+
197
+ #### 4.4 Dry-run preview
198
+ Hiển thị:
199
+ - Full remap table
200
+ - Per-file diff snippet (3 dòng context mỗi ref)
201
+ - Confirm prompt:
202
+
203
+ ```
204
+ Apply remap cho F-001? (yes / no / skip-feature)
205
+ yes → apply tất cả changes (frd.md + cascade files)
206
+ no → hủy V4 cho feature này, vẫn giữ AC-F prefix
207
+ skip-feature → bỏ qua toàn bộ migration cho F-001
208
+ ```
209
+
210
+ #### 4.5 Apply
211
+ - Edit `frd.md`: rewrite IDs trong section Feature AC.
212
+ - Edit từng cascade file: replace exact ID strings (sử dụng Edit với context dòng để tránh false-positive).
213
+ - Validate: re-grep ID cũ, phải về 0 trong Feature AC scope; Story AC giữ nguyên.
214
+
215
+ ---
216
+
217
+ ### Bước 5: V6 — Generate Verification Rules section
218
+
219
+ **Vector tiêu tốn LLM nhất.** Run nếu V6 detected.
220
+
221
+ #### 5.1 Load minimal context
222
+ - Section `## User Stories` của FRD đó (đã chứa AC).
223
+ - Optional: `domain.md > Shared Entities` block (nếu có field match entity name).
224
+
225
+ **KHÔNG load:** code, fdd.md, tech.md. Mục đích: tránh contamination bằng HOW.
226
+
227
+ #### 5.2 Derive rules
228
+ Quét từng AC trong User Stories:
229
+ - Identify input action ("nhập email", "submit form", "chọn date", "upload file"…).
230
+ - Extract field name + implicit constraint.
231
+ - Output bảng VR theo format template:
232
+ - **Type**: semantic (`string`, `email`, `enum<A|B|C>`, …) — không bao giờ concrete tech type.
233
+ - **Rule**: human-readable diễn đạt, không regex.
234
+ - **Refs**: trỏ tới US/AC source.
235
+ - Sub-rule phức tạp (vd: password = letter + digit + symbol) → tách flat thành nhiều ID.
236
+
237
+ #### 5.3 Propose & approve
238
+ Hiển thị bảng VR đề xuất:
239
+
240
+ ```
241
+ Proposed Verification Rules for F-001:
242
+
243
+ | ID | Field | Type | Required | Rule | Refs |
244
+ |----|-------|------|----------|------|------|
245
+ | VR-F001-001 | email | email | yes | định dạng email hợp lệ | US-F001-001 |
246
+ | VR-F001-002 | password | string | yes | tối thiểu 8 ký tự | US-F001-001 |
247
+ ...
248
+
249
+ Apply? (yes / edit / skip-vr)
250
+ yes → insert vào frd.md
251
+ edit → user trả lời text-edit rules nào cần sửa
252
+ skip-vr → giữ FRD không có VR section
253
+ ```
254
+
255
+ #### 5.4 Insert
256
+ - Insert `## Verification Rules` section ngay trước `## Scope` (theo thứ tự template).
257
+ - Copy nguyên block intro + quy ước từ template, chỉ replace bảng bằng nội dung derived.
258
+
259
+ ---
260
+
261
+ ### Bước 6: V8 — Derive User Flows section
262
+
263
+ **Run nếu V8 detected.** Propose-then-approve giống V6 — model derive draft, user duyệt trước khi ghi.
264
+
265
+ #### 6.1 Load minimal context
266
+ - Section `## Overview` của FRD (framing scope + actors).
267
+ - Section `## User Stories` (đã chứa AC — source của journey steps).
268
+
269
+ **KHÔNG load:** code, fdd.md, tech.md, sequence diagrams hiện có. Mục đích: flow ở frd là **user-facing journey** (WHAT), không phải implementation sequence (HOW thuộc fdd).
270
+
271
+ #### 6.2 Derive flows
272
+ Nhóm User Stories theo journey logic, mỗi journey → 1 Mermaid flowchart:
273
+
274
+ - **Grouping rule:** US chia sẻ chung trigger / actor / postcondition → cùng 1 flow. Vd `US-001 Đăng ký` + `US-002 Xác thực email` → 1 flow "Onboarding"; còn `US-003 Reset password` là journey riêng.
275
+ - **Mermaid structure:**
276
+ - Start node = trigger (user action mở đầu, từ Given của AC đầu tiên).
277
+ - Decision nodes = branch từ AC (happy / error paths).
278
+ - End node = postcondition (từ Then của AC cuối).
279
+ - Edge label = user action hoặc system response (từ When / Then).
280
+ - **Naming:** `Flow {N}: {tên ngắn}` — N đánh số từ 1 theo thứ tự xuất hiện trong frd.
281
+ - **Mermaid syntax:** dùng `["..."]` chứ KHÔNG `[{...}]` (V1 convention).
282
+
283
+ #### 6.3 Propose & approve
284
+
285
+ Hiển thị draft full mermaid blocks (chưa ghi file):
286
+
287
+ ```
288
+ Proposed User Flows for F-001:
289
+
290
+ Flow 1: Onboarding (đăng ký + xác thực email)
291
+ Spans: US-F001-001, US-F001-002
292
+ ```mermaid
293
+ flowchart TD
294
+ A["User mở trang Sign up"] --> B["Nhập email + password"]
295
+ B --> C{"Validation pass?"}
296
+ C -->|yes| D["Gửi email xác thực"]
297
+ C -->|no| E["Hiển thị lỗi"]
298
+ D --> F["User click link trong email"]
299
+ F --> G["Account active"]
300
+ ```
301
+
302
+ Flow 2: Login
303
+ Spans: US-F001-003
304
+ ```mermaid
305
+ ...
306
+ ```
307
+
308
+ Apply? (yes / edit / skip-flows)
309
+ yes → insert vào frd.md
310
+ edit → user góp ý flow nào cần sửa (vd: "Flow 1 thiếu nhánh email đã tồn tại")
311
+ skip-flows → giữ FRD không có User Flows section
312
+ ```
313
+
314
+ #### 6.4 Insert
315
+ - Insert section `## User Flows` ngay sau `## Overview` (theo thứ tự template).
316
+ - Copy intro + **Flow numbering stable** note (V2 convention) từ template, sau đó list các Mermaid blocks theo flow numbering.
317
+
318
+ ---
319
+
320
+ ### Bước 7: Validate
321
+
322
+ Sau khi apply hết vectors cho một FRD, chạy check:
323
+
324
+ - [ ] `## Feature Acceptance Criteria` (không phải Feature-**level**)
325
+ - [ ] Không còn ID `AC-F{NNN}-` trong scope Feature AC (chỉ có `FAC-F{NNN}-`)
326
+ - [ ] Story AC vẫn dùng `AC-F{NNN}-` (không bị remap nhầm)
327
+ - [ ] Mermaid blocks không còn pattern `[{...}]`
328
+ - [ ] Có heading `## Verification Rules` (nếu V6 applied)
329
+ - [ ] VR Rule column không chứa keyword UI copy: "error message", "vui lòng", "hint", "tooltip"
330
+ - [ ] Frontmatter `referenced_by` trỏ tới `3.3 Feature level` (không phải `3.2`)
331
+
332
+ Nếu check fail → rollback bằng `git checkout -- {file}` (skill không tạo backup vật lý vì git history đã đảm nhận vai trò này). Yêu cầu working tree clean trước khi chạy skill — nếu dirty, skill báo lỗi và dừng để tránh trộn lẫn change của user với change của migration.
333
+
334
+ ---
335
+
336
+ ### Bước 8: Report + changelog
337
+
338
+ Cho mỗi FRD đã migrate:
339
+
340
+ ```
341
+ ✓ F-001 — auth
342
+ Vectors applied: V1, V3, V4 (3 IDs remapped), V5, V6 (8 VRs added), V8 (2 flows added)
343
+ Cascade: fdd.md (3 refs), tsd.md (5 refs), integrations/003 (3 refs)
344
+
345
+ ✓ F-002 — checkout
346
+ Vectors applied: V5, V6 (5 VRs added)
347
+ ```
348
+
349
+ Rollback (nếu user phát hiện sai sau khi skill xong): `git checkout -- specs/main/feature/{F-XXX}-{slug}/` để revert toàn bộ feature dir, hoặc `git restore -p` để revert per-hunk.
350
+
351
+ Append vào [changelogs.md](../../changelogs.md) `## [Unreleased]`:
352
+
353
+ ```
354
+ - chore: migrate frd.md format cho {N} features (vectors: ...)
355
+ ```
356
+
357
+ ---
358
+
359
+ ## Common Rationalizations
360
+
361
+ | Rationalization | Reality |
362
+ |---|---|
363
+ | "Format mới optional, frd cũ vẫn dùng được" | Đúng cho đọc thủ công. Nhưng `/spec-test` và `/spec-tsd` derive TC theo IDs FAC/VR — frd thiếu sẽ break derivation, fallback bằng placeholder không trace được. |
364
+ | "Tự sinh VR an toàn, model giỏi infer constraint" | Model dễ bịa rule không có trong AC ("password tối thiểu 12 ký tự" khi AC chỉ nói "password hợp lệ"). Luôn propose-then-approve, không auto-apply. |
365
+ | "Skip cascade, chỉ rename trong frd thôi" | Sẽ break tsd.md Traceability Matrix và test.md Coverage. Hoặc cascade full, hoặc skip V4 toàn bộ. |
366
+ | "Migrate batch tất cả cùng lúc cho nhanh" | V4 cascade dễ break — user cần xem diff per-feature. Batch mode chỉ áp dụng cho V1, V2, V3, V5, V7 (mechanical, low risk). V6 và V8 phải propose-then-approve. |
367
+
368
+ ## Red Flags
369
+
370
+ - Apply V4 không có dry-run preview → user không kịp catch cascade reference sai.
371
+ - VR Rule column chứa regex `^[a-z]+$` hoặc tech type `varchar(255)` — đó là HOW, sai vị trí.
372
+ - V8 flows auto-apply không qua propose-then-approve → model có thể bịa glue step / sai journey grouping mà BA không kịp catch.
373
+ - V8 flow chứa step không trace được lên US nào (model bịa) → BA reject draft và yêu cầu regenerate.
374
+ - V8 Mermaid block dùng syntax `[{...}]` thay vì `["..."]` — vi phạm V1 convention.
375
+ - Validate fail nhưng skip rollback → file ở trạng thái nửa migrate, khó debug sau.
376
+ - Load conventions.md hoặc source code "for safety" → contamination, tốn context, không cải thiện output.
377
+
378
+ ## Verification
379
+
380
+ Trước khi mark feature done:
381
+ - [ ] Tất cả vectors detected đã apply (hoặc skip có log lý do)
382
+ - [ ] Validate Bước 6 pass
383
+ - [ ] Working tree clean trước khi skill chạy (git status verified) — rollback dùng git, không có file backup
384
+ - [ ] Cascade ID đã re-grep và confirm 0 false-positive
385
+ - [ ] User confirm VR proposal nếu V6 applied
@@ -185,6 +185,43 @@ Component Index và Feature Index **để placeholder** — sẽ được điề
185
185
 
186
186
  ---
187
187
 
188
+ ## Maintenance — migrate artifacts khi template thay đổi
189
+
190
+ Nhóm skill dọn dẹp / migrate artifacts hiện có sau khi template được update. Không phải pipeline — chạy ad-hoc khi cần.
191
+
192
+ | Command | Reads | Writes |
193
+ | --- | --- | --- |
194
+ | `/spec-frd-update` | `feature/*/frd.md`, `frd-template.md` | `feature/*/frd.md`, cascade: `fdd.md`, `tsd.md`, `integrations/*/spec.md`, `tech.md`, `test.md` |
195
+
196
+ ### `/spec-frd-update`
197
+
198
+ Migrate frd.md hiện có lên format mới nhất của `templates/main/feature/frd-template.md`. Dùng cho repo đã chạy `/spec-brownfield-feature` hoặc `/spec-new` từ trước, frd.md sinh ra theo template cũ.
199
+
200
+ **8 migration vectors** detect tự động:
201
+
202
+ | Vector | Action | Risk |
203
+ |---|---|---|
204
+ | V1 | Fix Mermaid syntax `[{...}]` → `["..."]` | None |
205
+ | V2 | Insert "Flow numbering stable" note | None |
206
+ | V3 | Rename `Feature-level AC` → `Feature AC` + 4 nhóm chuẩn | Low |
207
+ | V4 | Rename `AC-F{NNN}-` (Feature AC) → `FAC-F{NNN}-` (counter riêng) + cascade refs | **HIGH** |
208
+ | V5 | Insert US/AC stability notes | None |
209
+ | V6 | Propose Verification Rules từ User Stories → user approve → insert | Medium |
210
+ | V7 | Move `Components Consumed` → `Dependencies > Components Used` | Low |
211
+ | V8 | Derive Mermaid flows từ User Stories → propose → user approve → insert | Medium |
212
+
213
+ **Workflow:** Pre-flight git clean check → discover & classify → per-FRD context load → apply mechanical vectors (V1/V2/V3/V5/V7) → V4 dry-run preview với cascade impact → confirm → V6 propose VR → confirm → V8 propose Flows → confirm → validate → report.
214
+
215
+ **Cảnh báo:**
216
+ - V4 mặc định dry-run, in remap table + cascade diff trước khi ghi.
217
+ - V6 luôn propose-then-approve, không auto-apply (model dễ bịa rule).
218
+ - V8 luôn propose-then-approve — model derive flow từ US journey grouping, BA phải review để catch glue step bịa hoặc grouping sai.
219
+ - KHÔNG tạo file `.bak` — rollback dùng `git checkout -- {file}`. Pre-flight yêu cầu working tree clean.
220
+
221
+ **No-op safe:** nếu mọi FRD đã clean, skill báo và dừng — không ghi gì.
222
+
223
+ ---
224
+
188
225
  ## Integration Pipeline — dùng cho cả greenfield và brownfield
189
226
 
190
227
  Sau khi main artifacts đã sẵn sàng (từ greenfield hoặc brownfield), mọi requirement mới đều đi qua pipeline này.