@relipa/ai-flow-kit 0.2.1 → 0.2.2-beta.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 +4 -4
- package/custom/skills/create-system-requirement/SKILL.md +47 -9
- package/custom/skills/create-system-requirement/system-requirement-template-v1.md +220 -66
- package/custom/skills/execute-flow/SKILL.md +142 -36
- package/custom/skills/execute-flow/templates/evidence-helper.ts +145 -0
- package/custom/skills/execute-flow/templates/playwright.config.ts +28 -8
- package/custom/skills/read-study-requirement/SKILL.md +1 -2
- package/custom/skills/script-sync/SKILL.md +54 -16
- package/custom/templates/shared/gate-workflow.md +17 -11
- package/docs/common/CHANGELOG.md +8 -0
- package/docs/common/INDEX.md +1 -0
- package/docs/common/QUICK_START.md +1 -1
- package/docs/common/System-Requirement-Read-Guide.md +178 -0
- package/docs/common/Testing-Structure.md +31 -25
- package/docs/common/cli-reference.md +12 -10
- package/package.json +1 -1
- package/scripts/prompt.js +3 -3
- package/scripts/scaffold-playwright.js +2 -0
package/README.md
CHANGED
|
@@ -80,8 +80,8 @@ ak execute PROJ-44 (or ./testcases.md or ak execute)
|
|
|
80
80
|
│
|
|
81
81
|
▼
|
|
82
82
|
⛩️ GATE 1 — Pre-flight & Work Plan [AI + QA]
|
|
83
|
-
Parse TC file → verify
|
|
84
|
-
Check BASE_URL env var + playwright.config.ts
|
|
83
|
+
Parse TC file → verify AK-Docs/03.Testing/ subfolders exist
|
|
84
|
+
Check BASE_URL env var + playwright.config.ts + .gitignore covers 04.Evidence/
|
|
85
85
|
Create execution work plan
|
|
86
86
|
QA reviews → "APPROVED"
|
|
87
87
|
│ APPROVED
|
|
@@ -341,9 +341,9 @@ ak execute
|
|
|
341
341
|
```
|
|
342
342
|
|
|
343
343
|
**What happens (4-gate Execute Flow):**
|
|
344
|
-
1. **Gate 1 — Pre-flight:** Parse TC file, verify `
|
|
344
|
+
1. **Gate 1 — Pre-flight:** Parse TC file, verify `AK-Docs/03.Testing/` subfolders exist, check `BASE_URL`, `playwright.config.ts`, and `.gitignore` covers `04.Evidence/` — QA reviews → `APPROVED`
|
|
345
345
|
2. **Gate 2 — Script Sync:** Hash-based TC↔script sync — gen new, update changed, skip unchanged (never fabricates selectors — uses Playwright MCP)
|
|
346
|
-
3. **Gate 3 — Execute & Evidence:** Run Playwright
|
|
346
|
+
3. **Gate 3 — Execute & Evidence:** Run Playwright from `AK-Docs/03.Testing/05.Scripts/`, evidence lands in `04.Evidence/` (gitignored) per `run-{N}/`, update TC file R1/R2 columns — QA reviews → `APPROVED`
|
|
347
347
|
4. **Gate 4 — Report & Bug Logging:** Generate `testreport.md`, ask per-bug Jira confirmation — QA reviews → `APPROVED`
|
|
348
348
|
|
|
349
349
|
> **Multi-AI:** Works with Claude, Codex, Gemini, Cursor, Copilot — the execute-flow skill is loaded via `ak init`/`ak up`.
|
|
@@ -21,10 +21,9 @@ keywords: system requirement, uc spec, functionId, trace, acceptance test, excep
|
|
|
21
21
|
|
|
22
22
|
**Hand-off from coding Gate 1 Pre-flight** (`read-study-requirement`, Step 0) when:
|
|
23
23
|
- No `System-Requirement_v*.md` exists yet for this `functionId`, **or**
|
|
24
|
-
- The existing one's `UC-Spec-Version` header does not match the UC Spec's current version
|
|
25
|
-
- It exists and matches but its `Status` header is not `✅ Approved`.
|
|
24
|
+
- The existing one's `UC-Spec-Version` header does not match the UC Spec's current version.
|
|
26
25
|
|
|
27
|
-
Any of these → coding Gate 1 shows a ⚠️ non-blocking warning and **continues** (it does not cancel). DEV can close the gap at any point — before or after the current ticket — by starting a new task with `ak use`, picking **"📐 Create System Requirement"** at the Task type prompt, and running it through both gates to APPROVED.
|
|
26
|
+
Any of these → coding Gate 1 shows a ⚠️ non-blocking warning and **continues** (it does not cancel). DEV can close the gap at any point — before or after the current ticket — by starting a new task with `ak use`, picking **"📐 Create System Requirement"** at the Task type prompt, and running it through both gates to APPROVED. Approval itself isn't tracked inside the document — the file only lands in `AK-Docs/` (and gets committed/pushed) once DEV has approved it, so its presence there is the approval signal.
|
|
28
27
|
|
|
29
28
|
---
|
|
30
29
|
|
|
@@ -91,7 +90,7 @@ For every row in the UC Spec's Main Flow, Alternative/Exception Flows, and Busin
|
|
|
91
90
|
|
|
92
91
|
#### Writing style & layering (applies to every item in Sections 1–4)
|
|
93
92
|
|
|
94
|
-
Every item is a stack of layers, each aimed at a different reader — write each layer, don't blend them
|
|
93
|
+
Every item is a stack of layers, each aimed at a different reader — write each layer, don't blend them. The field name alone tells the reader who it's for — see the "Ai đọc field nào" table at the top of the template. **Do not** tag individual field labels with `[Role]` — that mapping is fixed for the whole document and stated once, up top; repeating it on every item is noise, not signal.
|
|
95
94
|
|
|
96
95
|
1. **Requirement** — the system behavior in plain business language. No framework names, class names, method names, or library calls (`Rule::unique`, `FormRequest`, `Middleware`, `permission_handle()`, enum class names, etc.). PM must be able to read this layer alone and understand what the system does.
|
|
97
96
|
- ❌ `Rule::unique(...)` → ✅ "The system validates that the Tag name is unique among active Tags."
|
|
@@ -99,12 +98,20 @@ Every item is a stack of layers, each aimed at a different reader — write each
|
|
|
99
98
|
- When a technical concept (e.g. an enum) has a business meaning, state the business impact first (e.g. "Newly created Tags are assigned the default status PENDING") and put the raw technical value in Implementation Reference as a `Tech Reference:` line — **never invent or assume what an enum/status value means in business terms unless the PM has confirmed it**; if unconfirmed, ask in Step 4 or leave it as the raw value with a Gap/Assumption tag. Every `Tech Reference:` line also gets a row in Section 6.2 (Glossary / Term Mapping) — write it once there, don't leave it scattered only inside individual items.
|
|
100
99
|
2. **System Behavior** — how the system processes it, still in plain language (conditions, order of checks, what triggers what). This is what BA/Tester use to write test cases.
|
|
101
100
|
3. **Error Response** (Validation Rules and Exception & Error Handling only) — the expected result for Tester: keep the HTTP status code (never drop it — Tester needs it), paired with a friendly label and the user-facing message, e.g. `HTTP 422 (Validation Error) — "..."`.
|
|
102
|
-
4. **Implementation Reference** — file/class/method/framework rule, for Developer cross-check only. This is where all the technical detail from Step 2 belongs — it never appears in layers 1–2.
|
|
101
|
+
4. **Implementation Reference** — file/class/method/framework rule, for Developer cross-check only. This is where all the technical detail from Step 2 belongs — it never appears in layers 1–2. **Keep it to one line**: `file:line` (or class/method) plus at most one short clause of context. Do not write multi-sentence prose explaining why the current code is wrong or what the fix should look like — Dev reads the code directly for that; this field is a pointer, not a code review.
|
|
103
102
|
|
|
104
103
|
Keep each layer short — one requirement, one behavior, one result. If a sentence needs 2–3 clauses to say, split it into separate `Requirement` / `System Behavior` / `Result` lines instead of one long sentence.
|
|
105
104
|
|
|
106
105
|
Classify every item as **Gap** (missing entirely) / **Assumption** (inferred, unconfirmed) / **Decision** (a choice made and confirmed during Q&A) / **Deviation** (implementation differs from what the UC Spec states) — only when one of these applies. A plain fact (explicit in UC Spec or confirmed in code) needs no tag; do not mark every item "Fact" by default, since a Requirement is a fact unless flagged otherwise. This replaces the old Fact/Assumption/Gap convention from `read-study-requirement` Step 1.75 for this skill's output — `read-study-requirement` itself is unaffected.
|
|
107
106
|
|
|
107
|
+
**Writing the `Classification` value** — one decision → one line: `[state] — [ID] ([who decided]): [content, one clause]`, e.g. `Decision — OQ-42 (BA): keep the losing customer's cart unchanged`. **Two or more decisions** (e.g. BA decided part of it, Dev decided the rest) → do NOT chain them with `;` in one sentence (unreadable, even to a Tech Lead) — one sub-bullet per decision instead, same `[ID] ([who]): [content]` format:
|
|
108
|
+
```
|
|
109
|
+
- **Classification:** Gap → Decision
|
|
110
|
+
- OQ-35 (BA): chose the order-attempt-token mechanism to prevent duplicate orders
|
|
111
|
+
- D-03 (Dev): server responds HTTP 200 with the original order; token expires after 30 minutes
|
|
112
|
+
```
|
|
113
|
+
`OQ-xx` = a decision inherited from BA (originally from the UC Spec). `D-xx` = a decision made while drafting this System Requirement — log it in Section 8 (Decision Log).
|
|
114
|
+
|
|
108
115
|
---
|
|
109
116
|
|
|
110
117
|
### Step 3.5: Traceability Verification — 1-1 Gap Audit [Gate 1]
|
|
@@ -160,7 +167,24 @@ Save to `AK-Docs/02.BA-Specs/00.Requirements/[functionId]/System-Requirement_v{N
|
|
|
160
167
|
**System-Requirement-Version:** v{N}
|
|
161
168
|
**UC-Spec-Version:** [functionId] @ v{N} <!-- MANDATORY — the 1-1 matching anchor -->
|
|
162
169
|
**Source UC Spec:** AK-Docs/02.BA-Specs/04.UC-Specs/[functionId]/UC-Spec_v{N}.md
|
|
163
|
-
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Who reads what field (stated once — not repeated per item)
|
|
174
|
+
|
|
175
|
+
The field → reader mapping is fixed for the whole document, so it's declared once here instead of tagged on every item:
|
|
176
|
+
|
|
177
|
+
| Field | Who needs it |
|
|
178
|
+
|---|---|
|
|
179
|
+
| `Requirement` | PM/BrSE/Comtor, Tester |
|
|
180
|
+
| `System Behavior` | Tester |
|
|
181
|
+
| `Error Response` | Tester (full line, incl. HTTP code) — PM/BrSE/Comtor only needs the user-facing message |
|
|
182
|
+
| `Traced UC Ref` / `Traced UC BR` / `Traced Exception Flow` | PM/BrSE/Comtor (cross-check against UC Spec) |
|
|
183
|
+
| `Classification` | PM/BrSE/Comtor — this is the "needs a decision" / "already decided" signal |
|
|
184
|
+
| `Implementation Reference` / `Tech Reference` | Dev |
|
|
185
|
+
| Section 5 (Acceptance Test Scenarios) | Tester |
|
|
186
|
+
|
|
187
|
+
**Dev and AI read the entire document**, every field, regardless of the table above — Dev needs it to implement, AI needs it across multiple gates (coding Gate 3, testcase generation, traceability audit).
|
|
164
188
|
|
|
165
189
|
---
|
|
166
190
|
|
|
@@ -191,7 +215,7 @@ Each item below is layered: **Requirement** (business language, for PM) → **Sy
|
|
|
191
215
|
- **System Behavior:** [how the system processes it — conditions, order of checks]
|
|
192
216
|
- **Traced UC Ref:** Main Flow #3
|
|
193
217
|
- **Classification:** [Gap | Assumption | Decision | Deviation — omit this line if it's a plain fact]
|
|
194
|
-
- **Implementation Reference:** [file:line / class / method]
|
|
218
|
+
- **Implementation Reference:** [file:line / class / method — one line, no multi-sentence explanation]
|
|
195
219
|
|
|
196
220
|
<!-- repeat FR-02, FR-03, ... in the same block format -->
|
|
197
221
|
|
|
@@ -271,7 +295,13 @@ Only items tagged Gap / Assumption / Decision / Deviation land here — a plain
|
|
|
271
295
|
|---|---|---|
|
|
272
296
|
|
|
273
297
|
## 8. Decision Log
|
|
274
|
-
|
|
298
|
+
Short lookup table — do not restate the full question/answer, that detail already lives in the `Classification` line of the item it applies to (writing it twice is redundant). Just enough to trace back: decision ID → who decided → date → one-line summary.
|
|
299
|
+
|
|
300
|
+
| ID | Decided by | Date | Summary |
|
|
301
|
+
|---|---|---|---|
|
|
302
|
+
| OQ-xx | PM/BA | [YYYY-MM-DD] | [one line — full detail lives in the matching item in Sections 1–4] |
|
|
303
|
+
|
|
304
|
+
Unresolved Gaps stay listed in Section 7, not here — this table only holds decisions that **already have** an answer.
|
|
275
305
|
|
|
276
306
|
## 9. Change Log
|
|
277
307
|
| Date | Ticket | Change | Note |
|
|
@@ -308,6 +338,10 @@ Please review — matching 1-1 with UC Spec v{N} is the point of this document.
|
|
|
308
338
|
→ Type APPROVED (then run `aiflow task next`) to close this task and clear
|
|
309
339
|
the Gate 1 warning for tickets on this functionId
|
|
310
340
|
→ Or provide feedback to update
|
|
341
|
+
→ Non-tech reviewer (PM/Comtor/BrSE/Tester)? See
|
|
342
|
+
docs/common/System-Requirement-Read-Guide.md for what Classification/
|
|
343
|
+
Implementation Reference/Tech Reference mean, which fields you can skip,
|
|
344
|
+
an FAQ, and a review checklist.
|
|
311
345
|
|
|
312
346
|
⚠️ Until this task is APPROVED, coding Gate 1 for this functionId will keep
|
|
313
347
|
showing a non-blocking warning (it does not cancel).
|
|
@@ -316,7 +350,7 @@ Please review — matching 1-1 with UC Spec v{N} is the point of this document.
|
|
|
316
350
|
|
|
317
351
|
- Any Gap still open → cannot approve; go back to Step 4 (re-open Gate 1).
|
|
318
352
|
- DEV feedback → update draft → re-show prompt.
|
|
319
|
-
- `APPROVED` →
|
|
353
|
+
- `APPROVED` → task is done — commit/push the file so it becomes visible to PM; coding Gate 1 unlocks.
|
|
320
354
|
|
|
321
355
|
---
|
|
322
356
|
|
|
@@ -363,4 +397,8 @@ This does not bump `System-Requirement-Version` — the version stays tied to th
|
|
|
363
397
|
- ❌ **DO NOT** tag every item "Fact" — a plain fact is the unmarked default; only tag `Gap`, `Assumption`, `Decision`, or `Deviation` when one applies.
|
|
364
398
|
- ❌ **DO NOT** state or assume the business meaning of an enum/status value (e.g. what `PENDING` "means" for the business) unless the PM has confirmed it — reference the raw technical value in `Implementation Reference` and tag it `Assumption` or `Gap` until confirmed.
|
|
365
399
|
- ✅ **MUST** mirror every `Tech Reference:` used in Sections 1–4 as a row in Section 6.2 (Glossary / Term Mapping) — don't leave the mapping only inside individual items.
|
|
400
|
+
- ❌ **DO NOT** tag individual field labels with `[Role]` (e.g. `**Requirement [PM/BrSE/Comtor]:**`) — the field → reader mapping is declared once in the "Who reads what field" table at the top and never repeated per item; that repetition was tried and reverted for being pure noise once the convention is stated.
|
|
366
401
|
- ❌ **DO NOT** include Section 6.3 (External System Interfaces) when the UC has no integration outside the app's own UI/DB — omit the subsection entirely rather than leaving an empty table.
|
|
402
|
+
- ❌ **DO NOT** restate a full question/answer in Section 8 (Decision Log) when the same decision is already explained inline in an item's `Classification` line — Section 8 is a short lookup table (ID → who → date → one-line summary) that points back to the item, not a duplicate narrative.
|
|
403
|
+
- ❌ **DO NOT** write multi-sentence prose in `Implementation Reference` explaining why current code is wrong or how to fix it — one line (`file:line` + at most one short clause) is enough; Dev reads the code itself for the rest.
|
|
404
|
+
- ❌ **DO NOT** chain two or more decisions into one `Classification` sentence with `;` (e.g. "BA decided OQ-35...; DEV decided D-03...") — split into one sub-bullet per decision (`[ID] ([who]): [content]`), see "How to write Classification" above. This was reported as hard to read even by a Tech Lead.
|
|
@@ -1,128 +1,282 @@
|
|
|
1
1
|
# Template Yêu Cầu Hệ Thống (System Requirement) — Phiên bản v1
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Đây là cấu trúc chuẩn cho tài liệu **System Requirement**.
|
|
4
|
+
|
|
5
|
+
Mỗi tài liệu System Requirement phải **trace 1-1 với một phiên bản UC Spec cụ thể**. Không tự bổ sung hoặc suy diễn nội dung nếu nội dung đó không có căn cứ từ UC Spec.
|
|
4
6
|
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
# Tài Liệu Yêu Cầu Hệ Thống: [functionId] — [Tên Chức Năng]
|
|
8
10
|
|
|
9
11
|
**Ngày tạo (Date):** [YYYY-MM-DD]
|
|
12
|
+
|
|
10
13
|
**Phiên bản System Requirement (System-Requirement-Version):** v{N}
|
|
11
|
-
|
|
12
|
-
**UC Spec
|
|
13
|
-
|
|
14
|
+
|
|
15
|
+
**Phiên bản UC Spec tham chiếu (UC-Spec-Version):** [functionId] @ v{N}
|
|
16
|
+
|
|
17
|
+
<!-- BẮT BUỘC — mốc khớp 1-1 -->
|
|
18
|
+
|
|
19
|
+
**UC Spec nguồn (Source UC Spec):**
|
|
20
|
+
AK-Docs/02.BA-Specs/04.UC-Specs/[functionId]/UC-Spec_v{N}.md
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Ai cần đọc phần nào?
|
|
25
|
+
|
|
26
|
+
| Field | Ai cần đọc |
|
|
27
|
+
| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
28
|
+
| `Requirement` | PM/BrSE/Comtor, Tester |
|
|
29
|
+
| `System Behavior` | Tester |
|
|
30
|
+
| `Error Response` | Tester đọc đầy đủ, bao gồm cả HTTP code. PM/BrSE/Comtor chỉ cần đọc câu thông báo hiển thị, có thể bỏ qua HTTP code |
|
|
31
|
+
| `Traced UC Ref` / `Traced UC BR` / `Traced Exception Flow` | PM/BrSE/Comtor dùng để đối chiếu với UC Spec |
|
|
32
|
+
| `Classification` | PM/BrSE/Comtor dùng để nhận biết nội dung nào **cần quyết định** hoặc **đã được chốt** |
|
|
33
|
+
| `Implementation Reference` / `Tech Reference` | Dev |
|
|
34
|
+
| Mục 5 (Acceptance Test Scenarios) | Tester |
|
|
35
|
+
|
|
36
|
+
> **Dev và AI đọc toàn bộ tài liệu**, không phân biệt theo field.
|
|
37
|
+
>
|
|
38
|
+
> * Dev cần đầy đủ thông tin để triển khai.
|
|
39
|
+
> * AI sử dụng tài liệu ở nhiều gate khác nhau, ví dụ: coding Gate 3, sinh testcase và audit traceability.
|
|
40
|
+
>
|
|
41
|
+
> Bảng trên chủ yếu giúp PM/BrSE/Comtor và Tester biết phần nào cần tập trung đọc, và phần nào có thể bỏ qua nếu không liên quan trực tiếp đến công việc của mình.
|
|
14
42
|
|
|
15
43
|
---
|
|
16
44
|
|
|
17
45
|
## Tóm tắt điều hành (Executive Summary)
|
|
18
|
-
- **Mục đích (Purpose):** [1 câu — tài liệu này bao gồm gì và vì sao nó tồn tại]
|
|
19
|
-
- **Tình trạng triển khai (Implementation status):** [ví dụ: Chưa bắt đầu / Đang triển khai / Khớp với UC Spec v{N}]
|
|
20
|
-
- **Độ khớp truy vết (Traceability coverage — từ audit Step 3.5):** [X]/[Y] mục UC Spec đã có System Requirement tương ứng · [Z] item bị gỡ vì không có căn cứ (unsupported)
|
|
21
|
-
- **Các sai khác chính so với UC Spec (Key deviations from UC Spec):** [danh sách các mục được gắn nhãn Deviation, hoặc "Không phát hiện sai khác"]
|
|
22
|
-
- **Hành động cần từ PM (Action needed from PM):** [danh sách các Gap/Assumption chưa được giải quyết cần PM xác nhận, hoặc "Không có — sẵn sàng chuyển giao cho Dev"]
|
|
23
46
|
|
|
47
|
+
Phần này giúp người đọc nhanh chóng nắm được phạm vi tài liệu, mức độ hoàn thiện và những điểm cần quyết định trước khi chuyển sang triển khai.
|
|
48
|
+
|
|
49
|
+
* **Mục đích (Purpose):**
|
|
50
|
+
[1 câu — tài liệu này bao gồm những gì và vì sao tài liệu này được tạo]
|
|
51
|
+
|
|
52
|
+
* **Tình trạng triển khai (Implementation status):**
|
|
53
|
+
[ví dụ: Chưa bắt đầu / Đang triển khai / Khớp với UC Spec v{N}]
|
|
54
|
+
|
|
55
|
+
* **Độ khớp truy vết (Traceability coverage — từ audit Step 3.5):**
|
|
56
|
+
[X]/[Y] mục UC Spec đã có System Requirement tương ứng · [Z] item bị gỡ vì không có căn cứ (unsupported)
|
|
57
|
+
|
|
58
|
+
* **Các sai khác chính so với UC Spec (Key deviations from UC Spec):**
|
|
59
|
+
[danh sách các mục được gắn nhãn Deviation, hoặc "Không phát hiện sai khác"]
|
|
60
|
+
|
|
61
|
+
* **Hành động cần từ PM (Action needed from PM):**
|
|
62
|
+
[danh sách các Gap/Assumption chưa được giải quyết cần PM xác nhận, hoặc "Không có — sẵn sàng chuyển giao cho Dev"]
|
|
24
63
|
|
|
25
64
|
---
|
|
26
65
|
|
|
27
66
|
## 0. Ma trận truy vết (Traceability Matrix)
|
|
67
|
+
|
|
68
|
+
Bảng này giúp đối chiếu trực tiếp giữa UC Spec và các mục tương ứng trong System Requirement.
|
|
69
|
+
|
|
28
70
|
| Tham chiếu UC (Flow / BR) | Mục System Requirement tương ứng |
|
|
29
|
-
|
|
30
|
-
| Main Flow bước 3
|
|
31
|
-
| Exception Flow B
|
|
32
|
-
| BR1.1
|
|
71
|
+
| ------------------------- | -------------------------------- |
|
|
72
|
+
| Main Flow bước 3 | FR-01 |
|
|
73
|
+
| Exception Flow B | FR-05, ER-02 |
|
|
74
|
+
| BR1.1 | VR-01 |
|
|
75
|
+
|
|
76
|
+
---
|
|
33
77
|
|
|
34
78
|
## 1. Yêu Cầu Chức Năng (Functional Requirements)
|
|
35
79
|
|
|
36
|
-
Mỗi
|
|
80
|
+
Mỗi Functional Requirement được mô tả theo 3 tầng, từ dễ hiểu đến chi tiết kỹ thuật:
|
|
81
|
+
|
|
82
|
+
1. **Requirement**: mô tả hệ thống cần đáp ứng điều gì bằng ngôn ngữ nghiệp vụ.
|
|
83
|
+
2. **System Behavior**: mô tả hệ thống xử lý như thế nào để đáp ứng Requirement.
|
|
84
|
+
3. **Implementation Reference**: thông tin kỹ thuật để Dev tham chiếu khi triển khai.
|
|
85
|
+
|
|
86
|
+
`Implementation Reference` chỉ chứa thông tin kỹ thuật và **không được đưa ngược lên Requirement hoặc System Behavior**.
|
|
37
87
|
|
|
38
88
|
### FR-01: [tên ngắn gọn mô tả hành vi nghiệp vụ]
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
89
|
+
|
|
90
|
+
* **Requirement:**
|
|
91
|
+
[hành vi hệ thống bằng ngôn ngữ nghiệp vụ, không dùng tên framework/class/method]
|
|
92
|
+
|
|
93
|
+
* **System Behavior:**
|
|
94
|
+
[hệ thống xử lý như thế nào — điều kiện, thứ tự kiểm tra]
|
|
95
|
+
|
|
96
|
+
* **Traced UC Ref:** Main Flow #3
|
|
97
|
+
|
|
98
|
+
* **Classification:**
|
|
99
|
+
[Gap | Assumption | Decision | Deviation — bỏ dòng này nếu là một fact đơn thuần]
|
|
100
|
+
|
|
101
|
+
* **Implementation Reference:**
|
|
102
|
+
[file:line / class / method — 1 câu, không diễn giải dài; Dev đọc code trực tiếp khi cần chi tiết hơn]
|
|
44
103
|
|
|
45
104
|
<!-- lặp lại FR-02, FR-03, ... theo cùng cấu trúc trên -->
|
|
46
105
|
|
|
106
|
+
---
|
|
107
|
+
|
|
47
108
|
## 2. Yêu Cầu Phi Chức Năng (Non-Functional Requirements)
|
|
48
109
|
|
|
110
|
+
Phần này mô tả các yêu cầu không trực tiếp thuộc nghiệp vụ chức năng, ví dụ như performance hoặc security.
|
|
111
|
+
|
|
49
112
|
### NFR-01: [tên ngắn]
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
113
|
+
|
|
114
|
+
* **Requirement:**
|
|
115
|
+
[ngôn ngữ nghiệp vụ — ví dụ: yêu cầu về performance/security]
|
|
116
|
+
|
|
117
|
+
* **System Behavior:**
|
|
118
|
+
[cách yêu cầu này được thực thi, bằng ngôn ngữ đơn giản]
|
|
119
|
+
|
|
120
|
+
* **Traced UC Ref:** BR3.1
|
|
121
|
+
|
|
122
|
+
* **Classification:**
|
|
123
|
+
[Gap | Assumption | Decision | Deviation — bỏ nếu là fact đơn thuần]
|
|
124
|
+
|
|
125
|
+
* **Implementation Reference:**
|
|
126
|
+
[file:line / class / method]
|
|
127
|
+
|
|
128
|
+
---
|
|
55
129
|
|
|
56
130
|
## 3. Quy Tắc Nghiệp Vụ → Quy Tắc Kiểm Tra Hợp Lệ (Business Rules → Validation Rules)
|
|
57
131
|
|
|
132
|
+
Phần này chuyển các Business Rules trong UC Spec thành Validation Rules mà hệ thống thực hiện.
|
|
133
|
+
|
|
58
134
|
### VR-01: [tên ngắn]
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
135
|
+
|
|
136
|
+
* **Requirement:**
|
|
137
|
+
[ví dụ: "Tên Tag phải là duy nhất trong số các Tag đang active."]
|
|
138
|
+
|
|
139
|
+
* **System Behavior:**
|
|
140
|
+
[ví dụ: "Hệ thống kiểm tra tên Tag với toàn bộ Tag đang active trước khi lưu."]
|
|
141
|
+
|
|
142
|
+
* **Error Response:**
|
|
143
|
+
HTTP 422 (Validation Error) — "[thông báo hiển thị cho người dùng]"
|
|
144
|
+
|
|
145
|
+
* **Traced UC BR:** BR1.1
|
|
146
|
+
|
|
147
|
+
* **Classification:**
|
|
148
|
+
[Gap | Assumption | Decision | Deviation — bỏ nếu là fact đơn thuần]
|
|
149
|
+
|
|
150
|
+
* **Implementation Reference:**
|
|
151
|
+
[ví dụ: `Rule::unique(...)` trong `StoreTagRequest`]
|
|
152
|
+
|
|
153
|
+
---
|
|
65
154
|
|
|
66
155
|
## 4. Xử Lý Ngoại Lệ & Lỗi (Exception & Error Handling)
|
|
67
156
|
|
|
157
|
+
Phần này mô tả các trường hợp hệ thống không thể tiếp tục xử lý theo Main Flow, bao gồm điều kiện xảy ra, cách hệ thống phản hồi và thông báo trả về.
|
|
158
|
+
|
|
68
159
|
### ER-01: [điều kiện kích hoạt, bằng ngôn ngữ nghiệp vụ]
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
160
|
+
|
|
161
|
+
* **Requirement:**
|
|
162
|
+
[ví dụ: "Chỉ người dùng có quyền CREATE mới được tạo Tag."]
|
|
163
|
+
|
|
164
|
+
* **System Behavior:**
|
|
165
|
+
[ví dụ: "Request bị từ chối vì người gọi không có quyền cần thiết."]
|
|
166
|
+
|
|
167
|
+
* **Error Response:**
|
|
168
|
+
HTTP 403 (Forbidden) — "[thông báo hiển thị cho người dùng]"
|
|
169
|
+
|
|
170
|
+
* **Traced Exception Flow:** Exception Flow B
|
|
171
|
+
|
|
172
|
+
* **Classification:**
|
|
173
|
+
[Gap | Assumption | Decision | Deviation — bỏ nếu là fact đơn thuần]
|
|
174
|
+
|
|
175
|
+
* **Implementation Reference:**
|
|
176
|
+
[error code/class/middleware hiện có]
|
|
177
|
+
|
|
178
|
+
---
|
|
75
179
|
|
|
76
180
|
## 5. Kịch Bản Kiểm Thử Chấp Nhận (Acceptance Test Scenarios)
|
|
181
|
+
|
|
182
|
+
Phần này mô tả các kịch bản mà Tester sử dụng để xác nhận hệ thống đáp ứng các yêu cầu đã được định nghĩa.
|
|
183
|
+
|
|
77
184
|
### AT-01: [Tên kịch bản] (Main Flow)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
185
|
+
|
|
186
|
+
* **Given** ...
|
|
187
|
+
* **When** ...
|
|
188
|
+
* **Then** ...
|
|
189
|
+
* **Requirement Coverage:** FR-01, FR-03
|
|
82
190
|
|
|
83
191
|
### AT-02: [Tên kịch bản] (Exception Flow B)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
192
|
+
|
|
193
|
+
* **Given** ...
|
|
194
|
+
* **When** ...
|
|
195
|
+
* **Then** ...
|
|
196
|
+
* **Requirement Coverage:** VR-01, ER-01
|
|
197
|
+
|
|
198
|
+
---
|
|
88
199
|
|
|
89
200
|
## 6. Bối Cảnh Hệ Thống Hiện Có (Existing System Context)
|
|
90
201
|
|
|
202
|
+
Phần này giúp người đọc hiểu nhanh các khu vực liên quan trong hệ thống hiện tại.
|
|
203
|
+
|
|
204
|
+
Không đưa chi tiết triển khai sâu vào đây. Các thông tin kỹ thuật chi tiết phải được đặt trong **Implementation Reference** của từng item tương ứng.
|
|
205
|
+
|
|
91
206
|
### 6.1 Tổng Quan Các Khu Vực Hệ Thống (System Areas Summary)
|
|
92
|
-
|
|
207
|
+
|
|
208
|
+
Chỉ tóm tắt các khu vực có liên quan.
|
|
93
209
|
|
|
94
210
|
| Khu vực (Area) | Tóm tắt (Summary) |
|
|
95
|
-
|
|
96
|
-
| API
|
|
97
|
-
| Model
|
|
98
|
-
| Validation
|
|
99
|
-
| Migration
|
|
100
|
-
| Test
|
|
211
|
+
| -------------- | ----------------- |
|
|
212
|
+
| API | ... |
|
|
213
|
+
| Model | ... |
|
|
214
|
+
| Validation | ... |
|
|
215
|
+
| Migration | ... |
|
|
216
|
+
| Test | ... |
|
|
101
217
|
|
|
102
218
|
### 6.2 Bảng Thuật Ngữ / Ánh Xạ Thuật Ngữ (Glossary / Term Mapping)
|
|
103
|
-
Mỗi `Tech Reference:` được dùng trong Mục 1–4 phải có một dòng tương ứng ở đây — một nơi duy nhất để tra thuật ngữ nghiệp vụ ánh xạ sang cái gì trong code, thay vì phải lục từng item. Chỉ đưa vào các thuật ngữ đã được PM xác nhận ý nghĩa nghiệp vụ (Decision) hoặc giá trị thô chưa được PM xác nhận nhưng đã gắn nhãn tương ứng — không bao giờ đoán ý nghĩa.
|
|
104
219
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
220
|
+
Mỗi `Tech Reference:` được sử dụng trong Mục 1–4 phải có một dòng tương ứng tại đây.
|
|
221
|
+
|
|
222
|
+
Mục đích là tạo **một nơi duy nhất để tra cứu** mối liên hệ giữa thuật ngữ nghiệp vụ và Technical Reference trong code, thay vì phải tìm lại từng item.
|
|
223
|
+
|
|
224
|
+
Chỉ đưa vào bảng:
|
|
108
225
|
|
|
109
|
-
|
|
110
|
-
|
|
226
|
+
* Thuật ngữ đã được PM xác nhận ý nghĩa nghiệp vụ thông qua `Decision`.
|
|
227
|
+
* Giá trị thô chưa được PM xác nhận nhưng đã được gắn `Classification` tương ứng.
|
|
111
228
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
|
229
|
+
Không tự suy đoán ý nghĩa nghiệp vụ.
|
|
230
|
+
|
|
231
|
+
| Thuật Ngữ Nghiệp Vụ (Business Term) | Tham Chiếu Kỹ Thuật (Technical Reference) | Classification |
|
|
232
|
+
| --------------------------------------- | ------------------------------------------ | ----------------------------------------------------------------- |
|
|
233
|
+
| [ví dụ: "trạng thái mặc định PENDING"] | `TagStatusEnum::PENDING` | Decision (PM xác nhận ngày [date]) / Assumption (chưa xác nhận) |
|
|
234
|
+
|
|
235
|
+
### 6.3 Giao Diện Với Hệ Thống Ngoài (External System Interfaces)
|
|
236
|
+
|
|
237
|
+
*(Tùy chọn — chỉ có khi UC này tích hợp với hệ thống bên ngoài UI/DB của app, ví dụ third-party API, webhook, message queue)*
|
|
238
|
+
|
|
239
|
+
UC Spec chủ yếu mô tả luồng UI và nghiệp vụ. Nếu chức năng có giao tiếp với hệ thống bên ngoài, thông tin tích hợp được ghi nhận tại đây.
|
|
240
|
+
|
|
241
|
+
Nếu UC không có giao diện bên ngoài thì bỏ hẳn mục này.
|
|
242
|
+
|
|
243
|
+
| Giao diện (Interface) | Chiều (Direction) | Protocol/Format | Ghi chú (Note) |
|
|
244
|
+
| ----------------------------- | ------------------ | ---------------- | -------------- |
|
|
245
|
+
| [ví dụ: Payment Gateway API] | Outbound | REST/JSON | ... |
|
|
246
|
+
|
|
247
|
+
---
|
|
115
248
|
|
|
116
249
|
## 7. Giả Định / Điểm Thiếu / Quyết Định / Sai Khác (Assumptions / Gaps / Decisions / Deviations)
|
|
117
|
-
|
|
250
|
+
|
|
251
|
+
Chỉ các item được gắn nhãn `Gap`, `Assumption`, `Decision` hoặc `Deviation` mới xuất hiện tại đây.
|
|
252
|
+
|
|
253
|
+
Các fact đơn thuần không cần đưa vào bảng này vì đó là trạng thái mặc định của các item trong Mục 1–4.
|
|
118
254
|
|
|
119
255
|
| Loại (Type) | Item | Cách xử lý (Resolution) |
|
|
120
|
-
|
|
256
|
+
| ----------- | ---- | ----------------------- |
|
|
257
|
+
|
|
258
|
+
---
|
|
121
259
|
|
|
122
260
|
## 8. Nhật Ký Quyết Định (Decision Log)
|
|
123
|
-
|
|
261
|
+
|
|
262
|
+
Đây là bảng tra cứu ngắn gọn, giúp tìm ngược từ ID quyết định đến người chốt, ngày chốt và nội dung chính.
|
|
263
|
+
|
|
264
|
+
Không cần diễn giải lại đầy đủ câu hỏi và câu trả lời vì chi tiết đã được ghi tại `Classification` của item tương ứng trong Mục 1–4.
|
|
265
|
+
|
|
266
|
+
| ID | Người chốt | Ngày | Tóm tắt |
|
|
267
|
+
| ----- | ---------- | ------------ | ----------------------------------------------------------- |
|
|
268
|
+
| OQ-xx | PM/BA | [YYYY-MM-DD] | [1 dòng — chi tiết đầy đủ xem tại item tương ứng ở Mục 1–4] |
|
|
269
|
+
|
|
270
|
+
Quy tắc:
|
|
271
|
+
|
|
272
|
+
* `OQ-xx` / `D-xx` đã có câu trả lời thì ghi tại đây.
|
|
273
|
+
* Gap chưa được giải quyết vẫn phải ghi tại Mục 7.
|
|
274
|
+
* Không đưa Gap chưa có quyết định vào Decision Log.
|
|
275
|
+
|
|
276
|
+
---
|
|
124
277
|
|
|
125
278
|
## 9. Nhật Ký Thay Đổi (Change Log)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
|
279
|
+
|
|
280
|
+
| Ngày (Date) | Ticket | Thay đổi (Change) | Ghi chú (Note) |
|
|
281
|
+
| ------------ | ------ | --------------------------- | -------------- |
|
|
282
|
+
| [YYYY-MM-DD] | — | Tạo lần đầu từ UC Spec v{N} | |
|