@relipa/ai-flow-kit 0.1.5-beta.0 → 0.1.5-beta.1

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.
@@ -1,194 +1,194 @@
1
- ---
2
- name: review-plan
3
- description: Gate 4 — After AI generates code, the developer reviews source code + summary. Developer must provide APPROVED or report a bug before closing the task.
4
- keywords: review, code review, approve, summary, checklist
5
- ---
6
-
7
- # Review Plan — Gate 4
8
-
9
- > **GATE 4: Runs after AI has completed code generation.**
10
- >
11
- > Principle: AI self-reviews first (verification + impact-analysis), then presents a summary to the developer. The developer decides: APPROVED or report a bug.
12
-
13
- ---
14
-
15
- ## Conditions to enter Gate 4
16
-
17
- - ✅ Gate 1 (requirement doc) has been APPROVED
18
- - ✅ Gate 2 (implementation plan) has been APPROVED
19
- - ✅ AI has completed code generation (Gate 3)
20
- - ✅ `superpowers:verification-before-completion` has run — tests pass
21
- - ✅ `impact-analysis` skill has run
22
-
23
- ## Mode Selection
24
-
25
- Check `mode` in `.aiflow/context/current.json`:
26
-
27
- | Mode | Impact Analysis | Review Checklist | summary.md |
28
- |------|----------------|-----------------|-----------|
29
- | `fast` | Quick scan — reason from diff only | 3 items | Short format |
30
- | `full` | Full grep scan across codebase | 10 items | Full format |
31
-
32
- ### Fast Track Impact Analysis (mode: fast)
33
- Assess impact by reasoning about the changed files only:
34
- 1. List each file you modified
35
- 2. For each file: "Does this file have callers/dependents outside the ticket scope?"
36
- 3. If yes → list them and assign impact level
37
- 4. DO NOT run grep on the full codebase
38
-
39
- ### Fast Track Review Checklist (mode: fast)
40
- - [ ] All tests pass
41
- - [ ] No hardcoded credentials or secrets
42
- - [ ] No SQL injection risk in new queries
43
-
44
- ## Fast Mode Output Rules (CRITICAL)
45
-
46
- When creating `plan/[ticket-id]/summary.md` in **fast mode**:
47
- - **Do not write long explanations or descriptions.**
48
- - **List format only:** Bullet points with `[NEW]`, `[MODIFIED]`, `[DELETED]`.
49
- - **Purpose:** Next to each file, write exactly 1 sentence explaining the *purpose* (the "why"), not the implementation details.
50
-
51
- **Example summary.md block:**
52
- ```markdown
53
- ### Gate 3 — Code
54
- - ✅ **Implemented batch endpoints**
55
- - \`[NEW] src/controllers/BatchController.ts\`: Handle bulk export requests
56
- - \`[MODIFIED] src/services/ExportService.ts\`: Added S3 upload integration
57
- ```
58
-
59
- ---
60
-
61
- ## Process
62
-
63
- ### Step 1: AI self-review (before showing the developer)
64
-
65
- Run in the following mandatory order:
66
-
67
- ```
68
- 1. superpowers:verification-before-completion
69
- → All tests must PASS. If any fail → fix immediately, do not show the developer.
70
-
71
- 2. impact-analysis skill
72
- → Check for breaking changes and side effects.
73
-
74
- 3. review-checklist (.rules/review-checklist.md)
75
- → Tick each item in the checklist.
76
- ```
77
-
78
- **If any step fails → fix first, do not proceed to Step 2.**
79
-
80
- ### Step 2: Create Summary Report
81
-
82
- Create file `plan/[ticket-id]/summary.md`:
83
-
84
- ```markdown
85
- # Summary: [Ticket ID] — [Title]
86
-
87
- **Date:** [YYYY-MM-DD]
88
- **Status:** Waiting for DEV review
89
-
90
- ---
91
-
92
- ## Implementation Details
93
-
94
- | File | Change | Reason |
95
- |------|----------|-------|
96
- | [path/to/file] | Created / Modified | [reason] |
97
-
98
- ---
99
-
100
- ## Acceptance Criteria — results
101
-
102
- | Criteria | Status | Notes |
103
- |---------|--------|---------|
104
- | [Criteria 1] | ✅ Done | [implementation details] |
105
- | [Criteria 2] | ✅ Done | |
106
-
107
- ---
108
-
109
- ## Tests Written
110
-
111
- | Test file | Test cases | Coverage |
112
- |-----------|-----------|---------|
113
- | [file] | [N] cases | [X%] |
114
-
115
- **Test output:**
116
- ```
117
- [Paste test results here]
118
- ```
119
-
120
- ---
121
-
122
- ## Impact Analysis results
123
-
124
- **Level:** 🟢 Low / 🟡 Medium / 🔴 High
125
-
126
- **Impact Scope:**
127
- - [File/Service A] — [reason for impact / lack of impact]
128
-
129
- **Breaking changes:** None / [description if any]
130
-
131
- ---
132
-
133
- ## Review Checklist
134
-
135
- - [ ] Code compiles and all tests pass
136
- - [ ] No hardcoded credentials / config
137
- - [ ] Security: no SQL injection, no exposure of sensitive data
138
- - [ ] Impact Analysis has been run
139
- - [ ] Naming and Code Style follow conventions
140
- - [ ] Sufficient tests (unit + integration)
141
- - [ ] No dead code / leftover console.logs
142
- ```
143
-
144
- ### Step 3: GATE 4 — Present to Developer
145
-
146
- ```markdown
147
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
148
- ⏸️ GATE 4: WAITING FOR DEV REVIEW
149
-
150
- I have completed implementation and self-review.
151
- Summary: plan/[ticket-id]/summary.md
152
-
153
- **Self-review results:**
154
- - Tests: ✅ [N] passed / ❌ [N] failed
155
- - Impact: [Low/Medium/High]
156
- - Checklist: [N/N] items ✅
157
-
158
- **You need to:**
159
- 1. Review the summary above
160
- 2. Check the source code if necessary
161
- 3. Run manual tests if desired
162
-
163
- **After review, reply with one of the following:**
164
-
165
- ✅ If OK: type **"APPROVED"**
166
- 🐛 If there are bugs: type **"BUG: [description]"**
167
- → If a requirement bug: I will return to Gate 1
168
- → If a coding bug: I will fix and repeat Gate 4
169
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
170
- ```
171
-
172
- ### Step 4: Handle feedback
173
-
174
- **If the developer types "APPROVED":**
175
- → Invoke `superpowers:requesting-code-review` to send for peer review
176
- → Guide on creating a Pull Request
177
-
178
- **If the developer types "BUG: [description]" — coding bug:**
179
- → Analyze bug, fix, rerun verification
180
- → Repeat from Step 1 of Gate 4
181
-
182
- **If the developer types "BUG: [description]" — requirement bug:**
183
- → Notify: "This is a requirement bug, requirement document needs update"
184
- → Return to Gate 1, update requirement.md, wait for APPROVED again
185
-
186
- ---
187
-
188
- ## Mandatory Rules
189
-
190
- - ❌ **DO NOT** invoke `requesting-code-review` before the developer provides APPROVED
191
- - ❌ **DO NOT** decide "task is done" on your own — must be confirmed by the developer
192
- - ✅ **MUST** run verification + impact-analysis before showing the developer
193
- - ✅ **MUST** clearly classify: requirement bug vs coding bug
194
- - ✅ **MUST** update summary.md each time changes are made
1
+ ---
2
+ name: review-plan
3
+ description: Gate 4 — After AI generates code, the developer reviews source code + summary. Developer must provide APPROVED or report a bug before closing the task.
4
+ keywords: review, code review, approve, summary, checklist
5
+ ---
6
+
7
+ # Review Plan — Gate 4
8
+
9
+ > **GATE 4: Runs after AI has completed code generation.**
10
+ >
11
+ > Principle: AI self-reviews first (verification + impact-analysis), then presents a summary to the developer. The developer decides: APPROVED or report a bug.
12
+
13
+ ---
14
+
15
+ ## Conditions to enter Gate 4
16
+
17
+ - ✅ Gate 1 (requirement doc) has been APPROVED
18
+ - ✅ Gate 2 (implementation plan) has been APPROVED
19
+ - ✅ AI has completed code generation (Gate 3)
20
+ - ✅ `superpowers:verification-before-completion` has run — tests pass
21
+ - ✅ `impact-analysis` skill has run
22
+
23
+ ## Mode Selection
24
+
25
+ Check `mode` in `.aiflow/context/current.json`:
26
+
27
+ | Mode | Impact Analysis | Review Checklist | summary.md |
28
+ |------|----------------|-----------------|-----------|
29
+ | `fast` | Quick scan — reason from diff only | 3 items | Short format |
30
+ | `full` | Full grep scan across codebase | 10 items | Full format |
31
+
32
+ ### Fast Track Impact Analysis (mode: fast)
33
+ Assess impact by reasoning about the changed files only:
34
+ 1. List each file you modified
35
+ 2. For each file: "Does this file have callers/dependents outside the ticket scope?"
36
+ 3. If yes → list them and assign impact level
37
+ 4. DO NOT run grep on the full codebase
38
+
39
+ ### Fast Track Review Checklist (mode: fast)
40
+ - [ ] All tests pass
41
+ - [ ] No hardcoded credentials or secrets
42
+ - [ ] No SQL injection risk in new queries
43
+
44
+ ## Fast Mode Output Rules (CRITICAL)
45
+
46
+ When creating `04.Coding/04.Reviews/[functionId]/[ticketId].md` in **fast mode**:
47
+ - **Do not write long explanations or descriptions.**
48
+ - **List format only:** Bullet points with `[NEW]`, `[MODIFIED]`, `[DELETED]`.
49
+ - **Purpose:** Next to each file, write exactly 1 sentence explaining the *purpose* (the "why"), not the implementation details.
50
+
51
+ **Example summary.md block:**
52
+ ```markdown
53
+ ### Gate 3 — Code
54
+ - ✅ **Implemented batch endpoints**
55
+ - \`[NEW] src/controllers/BatchController.ts\`: Handle bulk export requests
56
+ - \`[MODIFIED] src/services/ExportService.ts\`: Added S3 upload integration
57
+ ```
58
+
59
+ ---
60
+
61
+ ## Process
62
+
63
+ ### Step 1: AI self-review (before showing the developer)
64
+
65
+ Run in the following mandatory order:
66
+
67
+ ```
68
+ 1. superpowers:verification-before-completion
69
+ → All tests must PASS. If any fail → fix immediately, do not show the developer.
70
+
71
+ 2. impact-analysis skill
72
+ → Check for breaking changes and side effects.
73
+
74
+ 3. review-checklist (.rules/review-checklist.md)
75
+ → Tick each item in the checklist.
76
+ ```
77
+
78
+ **If any step fails → fix first, do not proceed to Step 2.**
79
+
80
+ ### Step 2: Create Summary Report
81
+
82
+ Create file `04.Coding/04.Reviews/[functionId]/[ticketId].md`:
83
+
84
+ ```markdown
85
+ # Summary: [Ticket ID] — [Title]
86
+
87
+ **Date:** [YYYY-MM-DD]
88
+ **Status:** Waiting for DEV review
89
+
90
+ ---
91
+
92
+ ## Implementation Details
93
+
94
+ | File | Change | Reason |
95
+ |------|----------|-------|
96
+ | [path/to/file] | Created / Modified | [reason] |
97
+
98
+ ---
99
+
100
+ ## Acceptance Criteria — results
101
+
102
+ | Criteria | Status | Notes |
103
+ |---------|--------|---------|
104
+ | [Criteria 1] | ✅ Done | [implementation details] |
105
+ | [Criteria 2] | ✅ Done | |
106
+
107
+ ---
108
+
109
+ ## Tests Written
110
+
111
+ | Test file | Test cases | Coverage |
112
+ |-----------|-----------|---------|
113
+ | [file] | [N] cases | [X%] |
114
+
115
+ **Test output:**
116
+ ```
117
+ [Paste test results here]
118
+ ```
119
+
120
+ ---
121
+
122
+ ## Impact Analysis results
123
+
124
+ **Level:** 🟢 Low / 🟡 Medium / 🔴 High
125
+
126
+ **Impact Scope:**
127
+ - [File/Service A] — [reason for impact / lack of impact]
128
+
129
+ **Breaking changes:** None / [description if any]
130
+
131
+ ---
132
+
133
+ ## Review Checklist
134
+
135
+ - [ ] Code compiles and all tests pass
136
+ - [ ] No hardcoded credentials / config
137
+ - [ ] Security: no SQL injection, no exposure of sensitive data
138
+ - [ ] Impact Analysis has been run
139
+ - [ ] Naming and Code Style follow conventions
140
+ - [ ] Sufficient tests (unit + integration)
141
+ - [ ] No dead code / leftover console.logs
142
+ ```
143
+
144
+ ### Step 3: GATE 4 — Present to Developer
145
+
146
+ ```markdown
147
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
148
+ ⏸️ GATE 4: WAITING FOR DEV REVIEW
149
+
150
+ I have completed implementation and self-review.
151
+ Summary: 04.Coding/04.Reviews/[functionId]/[ticketId].md
152
+
153
+ **Self-review results:**
154
+ - Tests: ✅ [N] passed / ❌ [N] failed
155
+ - Impact: [Low/Medium/High]
156
+ - Checklist: [N/N] items ✅
157
+
158
+ **You need to:**
159
+ 1. Review the summary above
160
+ 2. Check the source code if necessary
161
+ 3. Run manual tests if desired
162
+
163
+ **After review, reply with one of the following:**
164
+
165
+ ✅ If OK: type **"APPROVED"**
166
+ 🐛 If there are bugs: type **"BUG: [description]"**
167
+ → If a requirement bug: I will return to Gate 1
168
+ → If a coding bug: I will fix and repeat Gate 4
169
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
170
+ ```
171
+
172
+ ### Step 4: Handle feedback
173
+
174
+ **If the developer types "APPROVED":**
175
+ → Invoke `superpowers:requesting-code-review` to send for peer review
176
+ → Guide on creating a Pull Request
177
+
178
+ **If the developer types "BUG: [description]" — coding bug:**
179
+ → Analyze bug, fix, rerun verification
180
+ → Repeat from Step 1 of Gate 4
181
+
182
+ **If the developer types "BUG: [description]" — requirement bug:**
183
+ → Notify: "This is a requirement bug, requirement document needs update"
184
+ → Return to Gate 1, update requirement.md, wait for APPROVED again
185
+
186
+ ---
187
+
188
+ ## Mandatory Rules
189
+
190
+ - ❌ **DO NOT** invoke `requesting-code-review` before the developer provides APPROVED
191
+ - ❌ **DO NOT** decide "task is done" on your own — must be confirmed by the developer
192
+ - ✅ **MUST** run verification + impact-analysis before showing the developer
193
+ - ✅ **MUST** clearly classify: requirement bug vs coding bug
194
+ - ✅ **MUST** update summary.md each time changes are made
@@ -88,7 +88,7 @@ Sẵn sàng thực thi kiểm thử
88
88
 
89
89
  ### GATE 1 — Phân tích yêu cầu & Đánh giá rủi ro (auto-start)
90
90
 
91
- **Mục tiêu:** Tiếp nhận đầu vào, hiểu nghiệp vụ, xác định phạm vi kiểm thử, nhận diện rủi ro và phát hiện vấn đề cần làm trước khi xây dựng kịch bản.
91
+ **Mục tiêu:** Tiếp nhận đầu vào, hiểu nghiệp vụ, xác định phạm vi kiểm thử, nhận diện rủi ro và **đào sâu làm rõ toàn bộ vấn đề hồ ngay tại gate này** (hỏi QA từng câu một, tiếp tục đến khi hết nghi vấn Critical/Major) — để Gate 2, 3, 4 phía sau hiếm khi phải dừng lại hỏi thêm.
92
92
 
93
93
  **Đầu ra (Outputs):**
94
94
  - `03.Testing/07.AI-Artifacts/[functionId]/[functionId]_01_Requirement_Analysis_Result.md`
@@ -161,16 +161,23 @@ Vui lòng cung cấp mã định danh cho chức năng này (ví dụ: AD06, TC-
161
161
  15. Risk / điểm dễ lỗi
162
162
  16. Q&A / Out of Scope
163
163
  - Đánh giá rủi ro theo skill 00.02: kỹ thuật, dữ liệu, nghiệp vụ, hệ thống
164
- - **Issue Handling:**
165
- - Critical/Major DỪNG, tạo QA artifact, chờ phản hồi (không sinh Result artifact)
166
- - Minor Ghi TBD marker (`[TBD<issue-id>: tả]`), tiếp tục, carry-forward sang gate sau
164
+
165
+ #### Bước 2b: Đào sâu làm với QA/Stakeholder (Interactive Clarification)
166
+ **Mục tiêu:** xử dứt điểm mọi mơ hồ/nghi vấn ngay tại Gate 1 đây gate DUY NHẤT được phép dừng lại hỏi tự do; Gate 2-4 sau đó chỉ hỏi cho phát sinh thực sự mới (xem quy tắc ở các Gate đó).
167
+
168
+ - **Critical/Major** → **KHÔNG** chỉ gộp vào một file QA rồi im lặng chờ. Hỏi ngay trong hội thoại theo đúng Interaction Rule đã khai báo (hỏi **TỪNG CÂU MỘT**, đợi QA trả lời rồi mới hỏi câu tiếp theo, KHÔNG hỏi dồn nhiều câu):
169
+ - Với mỗi nghi vấn ở mục 16 (Q&A/Out of Scope) hoặc phát sinh trong lúc phân tích 16 mục, ưu tiên đề xuất 2-3 cách hiểu/giả định hợp lý để QA chọn nhanh (multiple-choice) thay vì hỏi mở.
170
+ - Tiếp tục hỏi tuần tự, đào sâu thêm nếu câu trả lời còn hé lộ nghi vấn mới, cho đến khi **không còn Critical/Major nào chưa rõ**.
171
+ - Không sinh Result artifact (Bước 3) trước khi toàn bộ Critical/Major đã được làm rõ.
172
+ - **Minor** → Ghi TBD marker (`[TBD — <issue-id>: mô tả]`), tiếp tục, carry-forward sang gate sau (không cần dừng hỏi).
167
173
 
168
174
  #### Bước 3: Soạn thảo kết quả phân tích yêu cầu
169
175
  - Artifact đầu ra phải có: Feature Summary, Actor & Persona, Business Rules (16 mục), Risk Matrix, Test Scope
170
176
  - Lưu: `03.Testing/07.AI-Artifacts/[functionId]/[functionId]_01_Requirement_Analysis_Result.md`
171
177
 
172
- #### Bước 4: Soạn thảo QA Artifact (nếu có issue)
173
- - Cấu trúc: Metadata, Detected Issues (Severity), Clarification Questions, Assumptions, Resolution Tracking
178
+ #### Bước 4: Soạn thảo QA Artifact (biên bản resolution, nếu có issue)
179
+ - File này ghi lại **kết quả** của Bước 2b (đã hỏi gì, QA trả lời gì) không phải chế dừng chính.
180
+ - Cấu trúc: Metadata, Detected Issues (Severity), Clarification Questions kèm Câu trả lời đã nhận, Assumptions, Resolution Tracking
174
181
  - Lưu: `03.Testing/07.AI-Artifacts/[functionId]/[functionId]_01_Requirement_Analysis_QA.md`
175
182
 
176
183
  #### Bước 5: Gate Review & Pause
@@ -185,7 +192,8 @@ Vui lòng cung cấp mã định danh cho chức năng này (ví dụ: AD06, TC-
185
192
  **Definition of Done:**
186
193
  - [ ] `functionId` đã được xác định, thư mục đầu ra đã sẵn sàng
187
194
  - [ ] File `01_Requirement_Analysis_Result.md` có đủ 16 mục + Risk Matrix + Test Scope
188
- - [ ] File `01_Requirement_Analysis_QA.md` đã tạo nếu issue (Critical/Major đã giải quyết)
195
+ - [ ] Toàn bộ Critical/Major đã được hỏi trực tiếp (từng câu một) và có câu trả lời từ QA — không còn nghi vấn bỏ ngỏ
196
+ - [ ] File `01_Requirement_Analysis_QA.md` đã tạo nếu có issue, ghi lại đầy đủ câu hỏi + câu trả lời (Bước 2b)
189
197
  - [ ] Không có giả định nào được tự ý chốt thành fact mà không đưa vào QA
190
198
 
191
199
  > **Telemetry:** Run `ak gate 1 start --ticket [functionId]` khi bắt đầu gate này.
@@ -237,7 +245,8 @@ Vui lòng cung cấp mã định danh cho chức năng này (ví dụ: AD06, TC-
237
245
  - Draft RTM (Scenario ID → Requirement ID từ `01_Requirement_Analysis_Result.md`)
238
246
  - Lưu: `03.Testing/07.AI-Artifacts/[functionId]/[functionId]_02_Test_Scenarios_Result.md`
239
247
 
240
- #### Bước 5: Soạn thảo QA Artifact (nếu có issue)
248
+ #### Bước 5: Soạn thảo QA Artifact (nếu có issue — NGOẠI LỆ)
249
+ - **Chỉ tạo khi có vấn đề THỰC SỰ MỚI**, chỉ lộ ra khi xây dựng kịch bản (vd: một nhánh luồng nghiệp vụ không thấy được ở mức phân tích yêu cầu). **KHÔNG** hỏi lại điều đã có câu trả lời/assumption trong `01_Requirement_Analysis_Result.md` hoặc `01_Requirement_Analysis_QA.md` — đọc lại 2 file đó trước khi quyết định hỏi thêm.
241
250
  - Lưu: `03.Testing/07.AI-Artifacts/[functionId]/[functionId]_02_Scenario_Building_QA.md`
242
251
  - Minor issues → TBD marker + carry-forward, tiếp tục workflow
243
252
 
@@ -321,7 +330,8 @@ Vui lòng cung cấp mã định danh cho chức năng này (ví dụ: AD06, TC-
321
330
  - Ghi TBD marker khi thiếu thông tin: `[TBD — <issue-id>: mô tả ngắn]`
322
331
  - Lưu: `03.Testing/07.AI-Artifacts/[functionId]/[functionId]_03_Test_Cases_Draft_Result.md`
323
332
 
324
- #### Bước 7: Soạn thảo QA Artifact (nếu có issue)
333
+ #### Bước 7: Soạn thảo QA Artifact (nếu có issue — NGOẠI LỆ)
334
+ - **Chỉ tạo khi có vấn đề THỰC SỰ MỚI**, chỉ lộ ra khi thiết kế test case chi tiết (vd: một tổ hợp dữ liệu biên chưa từng được nhắc tới). **KHÔNG** hỏi lại điều đã có câu trả lời/assumption trong artifact của Gate 1 hoặc Gate 2 — đọc lại các file đó trước khi quyết định hỏi thêm.
325
335
  - Lưu: `03.Testing/07.AI-Artifacts/[functionId]/[functionId]_03_Test_Design_QA.md`
326
336
  - Cấu trúc: Metadata, Detected Issues, Clarification Questions, Assumptions, Resolution Tracking
327
337
 
@@ -458,3 +468,5 @@ Vui lòng cung cấp mã định danh cho chức năng này (ví dụ: AD06, TC-
458
468
  - ✅ **BẮT BUỘC** tuân thủ 100% `testcase-template.md` ở Gate 3 và Gate 4
459
469
  - ✅ **BẮT BUỘC** ba artifact Gate 4 sinh ĐỒNG THỜI
460
470
  - ✅ **BẮT BUỘC** Issue Critical/Major phải giải quyết xong trước khi sinh Result artifact
471
+ - ✅ **BẮT BUỘC** Gate 1 là gate đào sâu Q&A chính — hỏi QA từng câu một (Bước 2b) cho đến khi hết nghi vấn Critical/Major, trước khi chuyển Gate 2
472
+ - ❌ **KHÔNG** ở Gate 2-4 tạo QA artifact/hỏi lại cho vấn đề đã có câu trả lời hoặc assumption rõ ràng trong artifact của gate trước — QA artifact ở các gate này chỉ dành cho phát sinh THỰC SỰ MỚI
@@ -29,21 +29,62 @@ If `taskType` is missing or unrecognized, default to the DEV workflow and ask ON
29
29
 
30
30
  > **For:** `feature` · `bug-fix` · `refactor` · `investigation` · `documentation`
31
31
 
32
+ ### Cấu trúc thư mục đầu ra
33
+
34
+ ```
35
+ 04.Coding/
36
+ ├── 00.Overview/_Index.md ← Tracker: F-ID | Ticket | Dev | Gate | PR (cập nhật mỗi gate)
37
+ ├── 01.Requirements/[functionId]/[ticketId].md ← Gate 1 tạo
38
+ ├── 02.Plans/[functionId]/[ticketId].md ← Gate 2 tạo
39
+ ├── 03.TDD-Notes/[functionId]/[ticketId].md ← Gate 3 tạo
40
+ ├── 04.Reviews/[functionId]/[ticketId].md ← Gate 4 tạo
41
+ └── 05.Pull-Requests/[functionId]/[ticketId].md ← Gate 5 tạo
42
+ ```
43
+
44
+ - `[functionId]`: mã định danh chức năng **do dự án quy định** (ví dụ `F-001_User-Login`, `AD06`, `UC-LOGIN`) — không ép format. Một feature có thể có nhiều ticket → folder theo functionId, file theo ticketId.
45
+ - `[ticketId]`: lấy từ `taskId` trong `.aiflow/context/current.json` (ví dụ `TICKET-100.md`).
46
+
32
47
  ### GATE 1 — AI Analyze Requirement (auto-start)
33
48
 
34
49
  **INVOKE:** `read-study-requirement` skill
35
50
 
36
51
  AI actively reads ticket + source code to understand the requirement:
52
+
53
+ 0. **Pre-flight — xác định `functionId` và thư mục đầu ra (BẮT BUỘC):**
54
+
55
+ Kiểm tra theo thứ tự ưu tiên:
56
+ 1. Trường `functionId` hoặc `screenId` trong `.aiflow/context/current.json`
57
+ 2. **Suy ra từ input**: nếu đầu vào có file UC Spec / tài liệu do BA bàn giao (trong `supplementaryContext[]`, description, hoặc file được chỉ định khi `ak use <file>`) → đọc nội dung file để tìm functionId, hoặc suy từ đường dẫn thư mục chứa file (ví dụ file nằm ở `02.BA-Specs/04.UC-Specs/[functionId]/UC-Spec_v1.md` → lấy `[functionId]`). Có thể tra thêm `04.Coding/00.Overview/_Index.md` hoặc `00.Project-Overview/Function-List.md` theo tên feature.
58
+ → Tìm được ứng viên → **hỏi xác nhận** thay vì hỏi trống:
59
+ ```
60
+ functionId của task này có phải là [X] không? (Y / hoặc nhập giá trị đúng)
61
+ ```
62
+ 3. Không suy ra được → hỏi DEV trực tiếp:
63
+ ```
64
+ Không tìm thấy functionId trong context.
65
+ Vui lòng cung cấp mã định danh chức năng theo quy ước dự án (ví dụ: F-001_User-Login, AD06):
66
+ ```
67
+
68
+ → Đợi DEV trả lời, dùng giá trị này cho toàn bộ 5 Gates. **KHÔNG ĐƯỢC TIẾP TỤC NẾU CHƯA CÓ functionId.**
69
+
70
+ Sau đó kiểm tra thư mục `04.Coding/` trong root dự án — chưa có thì tạo đủ cây thư mục (00.Overview → 05.Pull-Requests) và file tracker `00.Overview/_Index.md`. Thông báo:
71
+ ```
72
+ ✓ Thư mục đầu ra: 04.Coding/
73
+ ✓ functionId: [functionId] ✓ ticketId: [ticketId]
74
+ → Bắt đầu Gate 1...
75
+ ```
76
+
37
77
  1. Read `.aiflow/context/current.json` — ticket info
38
78
  2. **Pre-flight: sync with remote** — run `git status --porcelain`; if working tree is clean, run `git pull --ff-only` to pull the latest source from remote. Skip the pull (with a `⚠️` notice to DEV) if there are uncommitted changes, the branch has diverged, or no remote tracking branch exists.
39
79
  3. Read source code — architecture, related files, data flow
40
80
  4. If anything is unclear — ask ONE question at a time, wait for reply
41
- 5. Output `plan/[ticket-id]/requirement.md` with:
42
- - Requirements summary, source code analysis
81
+ 5. Output `04.Coding/01.Requirements/[functionId]/[ticketId].md` with:
82
+ - Requirements summary (ticket summary + AC), source code analysis
43
83
  - Proposed solution and approach
44
84
  - Impact analysis, effort estimate, testing plan
45
- 6. **INVOKE** `gate-review` skill (generate mode) write `.aiflow/review/gate-1-[ticket-id].md`
46
- 7. Display gate pause message from `gate-review` skill — wait for **APPROVED**
85
+ 6. Update tracker row in `04.Coding/00.Overview/_Index.md`: `| [F-ID] | [ticketId] | [feature] | [dev] | ✅⬜⬜⬜⬜ Gate 1 | - |`
86
+ 7. **INVOKE** `gate-review` skill (generate mode) write `.aiflow/review/gate-1-[ticket-id].md`
87
+ 8. Display gate pause message from `gate-review` skill — wait for **APPROVED**
47
88
 
48
89
  **When APPROVED received:**
49
90
  → **INVOKE** `gate-review` skill (verify mode) — run `ak review check --gate 1 --ticket [ticket-id]`
@@ -63,8 +104,9 @@ DO NOT just check format — **understand the content and propose solutions**.
63
104
 
64
105
  **INVOKE:** `generate-spec` skill, then `superpowers:writing-plans`
65
106
 
66
- - Create a detailed TDD implementation plan based on the approved requirement.
67
- - Output `plan/[ticket-id]/plan.md` with the detailed TDD implementation plan.
107
+ - Create a detailed TDD implementation plan based on the approved requirement (`04.Coding/01.Requirements/[functionId]/[ticketId].md`).
108
+ - Output `04.Coding/02.Plans/[functionId]/[ticketId].md` with the detailed TDD implementation plan (step-by-step, file list, test-first order).
109
+ - Update tracker row in `04.Coding/00.Overview/_Index.md` (Gate 2 ✅).
68
110
  - **INVOKE** `gate-review` skill (generate mode) — write `.aiflow/review/gate-2-[ticket-id].md`
69
111
  - Display gate pause message from `gate-review` skill — CODE WILL NOT BE GENERATED until all items checked and APPROVED received.
70
112
 
@@ -86,6 +128,10 @@ Only runs after Gate 2 has been APPROVED.
86
128
  - Complex feature (3+ files): `superpowers:subagent-driven-development`
87
129
  - Write tests FIRST — run to confirm FAIL -> implement -> PASS.
88
130
  - Bug fix EXTRA: `superpowers:systematic-debugging` + `investigate-bug` skill first.
131
+ - Output `04.Coding/03.TDD-Notes/[functionId]/[ticketId].md`:
132
+ - **Test List** — danh sách test viết TRƯỚC khi implement (checklist `- [ ] TC-01: ...`)
133
+ - **Implementation Notes** — ghi chú phát sinh trong quá trình code
134
+ - Update tracker row in `04.Coding/00.Overview/_Index.md` (Gate 3 ✅) when tests PASS.
89
135
 
90
136
  > **Telemetry:** Run `ak gate 3 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
91
137
 
@@ -99,7 +145,8 @@ Mandatory order:
99
145
  1. `superpowers:verification-before-completion` — all tests must PASS
100
146
  2. `impact-analysis` skill — check for breaking changes
101
147
  3. Tick `custom/rules/review-checklist.md`
102
- 4. Create `plan/[ticket-id]/summary.md`
148
+ 4. Create `04.Coding/04.Reviews/[functionId]/[ticketId].md` — Test Results, Impact Analysis (files changed, affected features, breaking changes), Review Checklist
149
+ 5. Update tracker row in `04.Coding/00.Overview/_Index.md` (Gate 4 ✅)
103
150
 
104
151
  Then:
105
152
  - **INVOKE** `gate-review` skill (generate mode) — write `.aiflow/review/gate-4-[ticket-id].md`
@@ -124,7 +171,13 @@ Then:
124
171
  Only runs after Gate 4 has been APPROVED.
125
172
 
126
173
  **INVOKE:** `superpowers:requesting-code-review`
127
- Guide on creating a Pull Request with the ticket link.
174
+
175
+ 1. Create `04.Coding/05.Pull-Requests/[functionId]/[ticketId].md` — PR description gồm:
176
+ - Ticket link, danh sách thay đổi chính, How to Test, Checklist for Reviewer
177
+ - **Related Docs links:** UC Spec (`02.BA-Specs/04.UC-Specs/[functionId]/`), Test Case (`03.Testing/01.Testcases/[functionId]/`), Dev Plan (`04.Coding/02.Plans/[functionId]/[ticketId].md`)
178
+ 2. **Lưu tài liệu `04.Coding/` lên remote (GitLab) TRƯỚC khi tạo Pull Request.**
179
+ 3. Guide on creating a Pull Request — dùng nội dung file trên làm PR description.
180
+ 4. Update tracker row in `04.Coding/00.Overview/_Index.md` (Gate 5 ✅ Done + PR link).
128
181
 
129
182
  > **Telemetry:** Run `ak gate 5 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
130
183
 
@@ -1,13 +1,13 @@
1
- # Claude AI System Instructions
2
-
3
- You are an expert AI assistant specialized in this project's stack. Follow the Gate Workflow and Team Rules strictly.
4
-
5
- > **Important:** Always read `.aiflow/context/current.json` to load ticket context and check the `plan/` directory for existing progress before starting any task.
6
-
7
- If Gate 1 does not auto-start, wait for the developer to type **"start"**, **"Gate 1"** or **"Analyze ticket"**.
8
-
9
- ## Interaction Rules:
10
-
11
- - **COLLABORATIVE SKILLS:** When a skill (like `read-study-requirement`) says to "ask one question at a time", you MUST stop and wait for the developer's reply before proceeding.
12
- - **NEVER BATCH QUESTIONS:** Only ask one question per message.
13
- - **WAIT FOR APPROVAL:** Do not move to the next Gate until you receive "APPROVED".
1
+ # Claude AI System Instructions
2
+
3
+ You are an expert AI assistant specialized in this project's stack. Follow the Gate Workflow and Team Rules strictly.
4
+
5
+ > **Important:** Always read `.aiflow/context/current.json` to load ticket context and check the `04.Coding/` docs directory for existing progress before starting any task.
6
+
7
+ If Gate 1 does not auto-start, wait for the developer to type **"start"**, **"Gate 1"** or **"Analyze ticket"**.
8
+
9
+ ## Interaction Rules:
10
+
11
+ - **COLLABORATIVE SKILLS:** When a skill (like `read-study-requirement`) says to "ask one question at a time", you MUST stop and wait for the developer's reply before proceeding.
12
+ - **NEVER BATCH QUESTIONS:** Only ask one question per message.
13
+ - **WAIT FOR APPROVAL:** Do not move to the next Gate until you receive "APPROVED".
@@ -1,12 +1,12 @@
1
- # GitHub Copilot Custom Instructions
2
-
3
- You are an expert AI assistant specialized in this project's stack. Follow the Gate Workflow and Team Rules strictly.
4
-
5
- > **Important:** Always check for context in `.aiflow/context/current.json` and progress in the `plan/` folder before suggesting changes.
6
-
7
- If the Gate Workflow hasn't started, wait for the developer to type **"start"** or **"Gate 1"**.
8
-
9
- ## Interaction Rules:
10
- - **COLLABORATIVE SKILLS:** When a skill (like `read-study-requirement`) says to "ask one question at a time", you MUST stop and wait for the developer's reply before proceeding.
11
- - **NEVER BATCH QUESTIONS:** Only ask one question per message.
12
- - **WAIT FOR APPROVAL:** Do not move to the next Gate until you receive "APPROVED".
1
+ # GitHub Copilot Custom Instructions
2
+
3
+ You are an expert AI assistant specialized in this project's stack. Follow the Gate Workflow and Team Rules strictly.
4
+
5
+ > **Important:** Always check for context in `.aiflow/context/current.json` and progress in the `04.Coding/` docs folder before suggesting changes.
6
+
7
+ If the Gate Workflow hasn't started, wait for the developer to type **"start"** or **"Gate 1"**.
8
+
9
+ ## Interaction Rules:
10
+ - **COLLABORATIVE SKILLS:** When a skill (like `read-study-requirement`) says to "ask one question at a time", you MUST stop and wait for the developer's reply before proceeding.
11
+ - **NEVER BATCH QUESTIONS:** Only ask one question per message.
12
+ - **WAIT FOR APPROVAL:** Do not move to the next Gate until you receive "APPROVED".