@leejungkiin/awkit 1.1.9 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,414 @@
1
+ ---
2
+ name: module-spec-writer
3
+ description: >-
4
+ Gate 1.5 — Module Specification Writer. Tạo tài liệu mô tả chi tiết từng module
5
+ của ứng dụng: screens, user flows, business rules, validation, data contracts,
6
+ edge cases. Chạy sau brainstorm (Gate 1) và trước architecture design (Gate 2).
7
+ Đặc biệt critical cho port/migration projects.
8
+ metadata:
9
+ stage: core
10
+ version: "1.0"
11
+ tags: [gate, spec, module, product-spec, documentation, core]
12
+ requires: orchestrator
13
+ agent: Spec Writer
14
+ trigger: conditional
15
+ invocation-type: auto
16
+ priority: 1
17
+ activation_keywords:
18
+ - "module spec"
19
+ - "mô tả module"
20
+ - "screen inventory"
21
+ - "feature spec"
22
+ - "product spec"
23
+ - "mô tả app"
24
+ - "document modules"
25
+ ---
26
+
27
+ # Module Spec Writer v1.0 — Gate 1.5: Product Specification
28
+
29
+ > **Purpose:** Tạo tài liệu mô tả chi tiết từng module/feature của ứng dụng
30
+ > ở cấp độ **Product** (screens, flows, rules) — TRƯỚC KHI đi vào thiết kế
31
+ > kỹ thuật (DB/API). Đảm bảo AI và user có shared understanding về "app làm gì"
32
+ > trước khi bàn "app xây thế nào".
33
+ >
34
+ > **Problem it solves:**
35
+ > - "Nhảy thẳng vào code mà chưa ai mô tả rõ app có bao nhiêu màn hình"
36
+ > - "Port app từ iOS sang Android mà không ai document chi tiết app gốc"
37
+
38
+ ---
39
+
40
+ ## ⚠️ SCOPE CLARITY
41
+
42
+ | Skill này LÀM | Skill này KHÔNG làm |
43
+ |---------------|---------------------|
44
+ | Mô tả screens, user flows, business rules per module | Thiết kế DB/API (việc của spec-gate) |
45
+ | Tạo screen inventory cho toàn app | Viết code |
46
+ | Document validation rules & edge cases | Track tasks (việc của symphony-enforcer) |
47
+ | Scan existing codebase để auto-generate spec (port projects) | Brainstorm ý tưởng (việc của brainstorm-agent) |
48
+ | Yêu cầu user approve module spec | Deploy |
49
+
50
+ ---
51
+
52
+ ## 🚀 ACTIVATION
53
+
54
+ Skill này được kích hoạt bởi:
55
+ 1. **Orchestrator auto-trigger:** Khi Gate 1.5 check FAIL (không tìm thấy module specs)
56
+ 2. **Explicit command:** `/module-spec` hoặc `/product-spec`
57
+ 3. **Keyword trigger:** "module spec", "mô tả module", "screen inventory"
58
+
59
+ ### Khi nào Gate 1.5 MANDATORY:
60
+
61
+ ```yaml
62
+ mandatory_when:
63
+ - complexity: COMPLEX (score ≥6)
64
+ - project_type: port/migration (iOS→Android, Android→iOS)
65
+ - module_count: >3 modules in BRIEF.md
66
+ - explicit_request: user asks for module documentation
67
+
68
+ skip_when:
69
+ - complexity: TRIVIAL or MODERATE
70
+ - module_count: ≤3 AND not port/migration
71
+ - user_override: "skip spec" or "bỏ qua spec"
72
+ ```
73
+
74
+ ---
75
+
76
+ ## 📋 INPUT REQUIREMENTS
77
+
78
+ ```
79
+ REQUIRED:
80
+ → BRIEF.md hoặc docs/specs/<feature>.md (output từ Gate 1)
81
+ HOẶC existing codebase (cho port/migration projects)
82
+ → .project-identity (projectId, techStack)
83
+
84
+ OPTIONAL:
85
+ → CODEBASE.md (project structure overview)
86
+ → KnowledgeItems (existing module documentation)
87
+ → NeuralMemory context (previous decisions)
88
+ → Source codebase (for port/migration — iOS/Android source files)
89
+ ```
90
+
91
+ ---
92
+
93
+ ## 🔄 PROCESS
94
+
95
+ ### Phase 1: Module Discovery
96
+
97
+ ```
98
+ INPUT SOURCE DETECTION:
99
+ A) Có BRIEF.md → Extract module list từ "TÍNH NĂNG" section
100
+ B) Có existing codebase (port project) → Scan source code structure:
101
+ - iOS: Xcode project groups, Views/, Features/ folders
102
+ - Android: feature/ packages, activities, fragments
103
+ - Đọc CODEBASE.md nếu có
104
+ C) Cả hai → Cross-reference BRIEF với source code
105
+
106
+ OUTPUT: Danh sách modules cần spec:
107
+ Module 1: [name] — [1-line description]
108
+ Module 2: [name] — [1-line description]
109
+ ...
110
+
111
+ PRESENT cho user:
112
+ "📋 Em tìm thấy [N] modules cần document:
113
+ 1. [Module A] — [description]
114
+ 2. [Module B] — [description]
115
+ ...
116
+ Anh xem có đúng/đủ không? Bổ sung/bỏ bớt cứ nói nhé."
117
+ ```
118
+
119
+ ### Phase 2: Per-Module Spec Generation
120
+
121
+ Cho MỖI module, tạo spec theo template chuẩn:
122
+
123
+ ```
124
+ Quy trình:
125
+ 1. Gather context:
126
+ - BRIEF.md → extract relevant features
127
+ - Source code (nếu port) → scan screens, ViewModels, models
128
+ - KnowledgeItems → extract existing documentation
129
+ - NeuralMemory → previous decisions
130
+
131
+ 2. Generate spec draft using template (see TEMPLATE section)
132
+
133
+ 3. Self-review checklist (per module):
134
+ - [ ] Tất cả screens đã liệt kê?
135
+ - [ ] Happy path flow rõ ràng?
136
+ - [ ] Error/edge cases đã cover?
137
+ - [ ] Business rules explicit (không implicit)?
138
+ - [ ] Data contracts rõ input/output?
139
+ - [ ] Acceptance criteria testable?
140
+ ```
141
+
142
+ ### Phase 3: Cross-Module Consistency Check
143
+
144
+ ```
145
+ Sau khi TẤT CẢ module specs xong:
146
+
147
+ 1. Dependency graph:
148
+ - Module A depends on Module B? Đã ghi trong cả 2 specs?
149
+ - Circular dependency? → Cảnh báo
150
+
151
+ 2. Shared concepts:
152
+ - User model xuất hiện ở nhiều modules? → Consistent fields?
153
+ - Navigation flow giữa modules logic?
154
+
155
+ 3. Coverage check:
156
+ - Mọi feature trong BRIEF.md đã có module spec?
157
+ - Mọi screen trong source code (port) đã có trong inventory?
158
+ ```
159
+
160
+ ### Phase 4: Present & Approval
161
+
162
+ ```
163
+ Present cho user với format:
164
+
165
+ ────────────────────────────────────
166
+ 📋 MODULE SPECIFICATIONS: <Project Name>
167
+ ────────────────────────────────────
168
+
169
+ Đã tạo [N] module specs:
170
+
171
+ | # | Module | Screens | Flows | Status |
172
+ |---|--------|---------|-------|--------|
173
+ | 1 | [name] | [count] | [count] | Draft |
174
+ | 2 | [name] | [count] | [count] | Draft |
175
+
176
+ ## Cross-Module Notes
177
+ - [Note 1: shared concern]
178
+ - [Note 2: dependency]
179
+
180
+ ────────────────────────────────────
181
+ ⏳ Anh review từng file spec nhé. Sửa gì cứ nói.
182
+ Chốt hết thì mình chuyển sang thiết kế kỹ thuật (Gate 2).
183
+ ────────────────────────────────────
184
+ ```
185
+
186
+ ### Phase 5: Write & Store
187
+
188
+ Sau khi user approve:
189
+
190
+ ```
191
+ 1. Tạo folder: docs/specs/modules/ (nếu chưa có)
192
+
193
+ 2. Write files:
194
+ docs/specs/modules/<module-name>_spec.md (cho mỗi module)
195
+ docs/specs/modules/MODULE_INDEX.md (index file)
196
+
197
+ 3. Thêm approval marker cho mỗi file:
198
+ ## Status: Approved
199
+ **Approved by:** User
200
+ **Approved at:** <ISO date>
201
+
202
+ 4. Lưu vào NeuralMemory:
203
+ nmem_remember(
204
+ content="Module specs approved for <project>. Modules: <list>. Total screens: <N>",
205
+ type="decision",
206
+ tags=["module-spec", "<projectId>"]
207
+ )
208
+
209
+ 5. Proceed → orchestrator re-checks Gate 1.5 → PASS → Gate 2
210
+ ```
211
+
212
+ ---
213
+
214
+ ## 📝 MODULE SPEC TEMPLATE
215
+
216
+ ```markdown
217
+ # 📋 Module Spec: [Module Name]
218
+
219
+ **Project:** [project-name]
220
+ **Version:** 1.0
221
+ **Created:** [date]
222
+ **Status:** Draft | Approved
223
+
224
+ ---
225
+
226
+ ## Overview
227
+ [1-2 câu mô tả mục đích module này trong app]
228
+
229
+ ## Dependencies
230
+ - **Depends on:** [list modules this depends on]
231
+ - **Used by:** [list modules that depend on this]
232
+ - **Shared services:** [auth, analytics, etc.]
233
+
234
+ ---
235
+
236
+ ## Screen Inventory
237
+
238
+ | # | Screen Name | Type | Key Elements | Notes |
239
+ |---|------------|------|--------------|-------|
240
+ | 1 | [name] | [full/modal/sheet/overlay/tab] | [main UI components] | [optional] |
241
+
242
+ ---
243
+
244
+ ## User Flows
245
+
246
+ ### Flow 1: [Happy Path Name]
247
+ **Entry:** [how user gets here]
248
+ **Steps:**
249
+ 1. User [action] → Screen [A]
250
+ 2. User [action] → System [response]
251
+ 3. System [shows/navigates] → Screen [B]
252
+ 4. **End state:** [what user sees/has achieved]
253
+
254
+ ### Flow 2: [Alternative Path / Error Path]
255
+ **Trigger:** [what causes this path]
256
+ **Steps:**
257
+ 1. ...
258
+
259
+ ---
260
+
261
+ ## Business Rules
262
+
263
+ | ID | Rule | Details |
264
+ |----|------|---------|
265
+ | BR-01 | [rule name] | [full description] |
266
+ | BR-02 | [rule name] | [full description] |
267
+
268
+ ---
269
+
270
+ ## Validation Rules
271
+
272
+ | Field | Condition | Error Message | Screen |
273
+ |-------|-----------|---------------|--------|
274
+ | [field] | [rule] | [message] | [where] |
275
+
276
+ ---
277
+
278
+ ## Data Contracts
279
+
280
+ ### Input (consumed by this module)
281
+ | Data | Type | Source | Required |
282
+ |------|------|--------|----------|
283
+ | [name] | [type] | [module/API/local] | [yes/no] |
284
+
285
+ ### Output (produced by this module)
286
+ | Data | Type | Destination | Trigger |
287
+ |------|------|-------------|---------|
288
+ | [name] | [type] | [module/API/local] | [when] |
289
+
290
+ ---
291
+
292
+ ## Edge Cases & Error States
293
+
294
+ | ID | Scenario | Expected Behavior |
295
+ |----|----------|-------------------|
296
+ | EC-01 | [scenario] | [what should happen] |
297
+ | EC-02 | [scenario] | [what should happen] |
298
+
299
+ ---
300
+
301
+ ## Acceptance Criteria
302
+ - [ ] [measurable criterion 1]
303
+ - [ ] [measurable criterion 2]
304
+ - [ ] [measurable criterion 3]
305
+ ```
306
+
307
+ ---
308
+
309
+ ## 📄 MODULE INDEX TEMPLATE
310
+
311
+ ```markdown
312
+ # 📚 Module Index: [Project Name]
313
+
314
+ **Total modules:** [N]
315
+ **Created:** [date]
316
+ **Status:** [All Approved / Some Draft]
317
+
318
+ | # | Module | Spec File | Screens | Status |
319
+ |---|--------|-----------|---------|--------|
320
+ | 1 | [name] | [link to spec file] | [count] | Approved |
321
+ | 2 | [name] | [link to spec file] | [count] | Draft |
322
+
323
+ ## Dependency Graph
324
+ [Module A] → [Module B] → [Module C]
325
+ [Module D] → [Module B]
326
+
327
+ ## Shared Services
328
+ - **Auth:** Used by [modules]
329
+ - **Analytics:** Used by [modules]
330
+ - **AI/ML:** Used by [modules]
331
+ ```
332
+
333
+ ---
334
+
335
+ ## 🔄 PORT/MIGRATION MODE
336
+
337
+ Khi project là port/migration (iOS→Android, Android→iOS):
338
+
339
+ ```
340
+ SPECIAL BEHAVIOR:
341
+ 1. Scan source codebase TRƯỚC → auto-detect modules
342
+ 2. Đọc existing KnowledgeItems cho source project
343
+ 3. Cross-reference với BRIEF.md để catch missing modules
344
+ 4. Generate specs từ source code structure + knowledge
345
+
346
+ AUTO-DETECTION SOURCES:
347
+ iOS:
348
+ → Xcode project navigator groups
349
+ → Features/ or Presentation/Views/ folders
350
+ → NavigationStack/TabView structure
351
+ → Existing CODEBASE.md
352
+
353
+ Android:
354
+ → feature/ packages
355
+ → Navigation graph (nav_graph.xml)
356
+ → Activity/Fragment inventory
357
+ → Existing CODEBASE.md
358
+
359
+ OUTPUT: Pre-filled module specs with data from source code
360
+ → User chỉ cần review + approve, không cần viết từ đầu
361
+ ```
362
+
363
+ ---
364
+
365
+ ## 🗣️ Communication Style
366
+
367
+ ```
368
+ ❌ "Module specification documents are required before proceeding."
369
+ ✅ "Trước khi bắt tay vào thiết kế kỹ thuật, để em mô tả chi tiết
370
+ từng module — screens nào, flow ra sao — để anh em hiểu rõ cùng nhau."
371
+
372
+ ❌ "Please review 8 specification documents."
373
+ ✅ "Em đã viết xong spec cho 8 modules. Anh xem từng cái nhé,
374
+ sửa gì cứ nói, chốt hết rồi mình chuyển sang thiết kế DB/API."
375
+ ```
376
+
377
+ ---
378
+
379
+ ## 🚫 Anti-Patterns
380
+
381
+ ```yaml
382
+ never_do:
383
+ - Tự approve module specs (user PHẢI approve)
384
+ - Viết spec quá vắn tắt (< 5 screens → cảnh báo "có thiếu screen không?")
385
+ - Skip cross-module consistency check
386
+ - Trộn lẫn product spec với technical spec (DB/API)
387
+ - Bắt đầu Gate 2 khi còn module spec ở status "Draft"
388
+ - Force Gate 1.5 cho TRIVIAL tasks
389
+
390
+ always_do:
391
+ - Show module list cho user confirm TRƯỚC khi viết spec
392
+ - Chạy cross-module consistency check SAU khi viết hết
393
+ - Ghi acceptance criteria testable (SMART)
394
+ - Scan source code khi port/migration project
395
+ - Tag specs vào NeuralMemory
396
+ ```
397
+
398
+ ---
399
+
400
+ ## 🧩 Skill Relationships
401
+
402
+ ```
403
+ TRIGGERED BY: orchestrator (Gate 1.5 check fail)
404
+ DEPENDS ON: brainstorm-agent output (Gate 1 must pass first)
405
+ FEEDS INTO: spec-gate (Gate 2 reads module specs to design DB/API)
406
+ WORKS WITH:
407
+ - nm-memory-sync (store module decisions)
408
+ - gitnexus-intelligence (scan source codebase structure)
409
+ - KnowledgeItems (read existing project documentation)
410
+ ```
411
+
412
+ ---
413
+
414
+ *module-spec-writer v1.0 — Product Specification Gate for AWKit*
@@ -1,25 +1,27 @@
1
1
  ---
2
2
  name: orchestrator
3
3
  description: >-
4
- Autonomous State Machine Gatekeeper — triages task complexity, enforces 5-Gate pipeline,
4
+ Autonomous State Machine Gatekeeper — triages task complexity, enforces 7-Gate pipeline,
5
5
  and auto-routes to the correct skill. AI tự kiểm tra trạng thái dự án và bắt buộc
6
6
  user đi qua đúng Gate trước khi code. User KHÔNG CẦN gọi workflow bằng tay.
7
+ Hỗ trợ auto-detect .kiro/specs từ IDE Kiro để bypass/accelerate Gates.
7
8
  metadata:
8
9
  stage: core
9
- version: "2.1"
10
- replaces: "1.0"
11
- tags: [orchestrator, routing, gate, triage, state-machine, core]
10
+ version: "2.3"
11
+ replaces: "2.2"
12
+ tags: [orchestrator, routing, gate, triage, state-machine, core, kiro]
12
13
  agent: Orchestrator
13
14
  trigger: always
14
15
  invocation-type: auto
15
16
  priority: 0
16
17
  ---
17
18
 
18
- # Orchestrator v2.1 — Autonomous State Machine Gatekeeper
19
+ # Orchestrator v2.3 — Autonomous State Machine Gatekeeper
19
20
 
20
- > **Purpose:** Route mọi request qua hệ thống 5-Gate tự động.
21
+ > **Purpose:** Route mọi request qua hệ thống 7-Gate tự động.
21
22
  > AI tự nhận diện project state → tự quyết định gate nào cần chạy.
22
23
  > User chỉ cần nói ý tưởng, AI lo phần còn lại.
24
+ > Hỗ trợ auto-detect `.kiro/specs` để accelerate/bypass Gates khi IDE đã tạo sẵn specs.
23
25
 
24
26
  ---
25
27
 
@@ -47,6 +49,89 @@ AI LÀ NGƯỜI GIÁM SÁT "CÁN CÂN" CỦA DỰ ÁN.
47
49
 
48
50
  ---
49
51
 
52
+ ## 🔍 Kiro Spec Detection (Auto-Accelerate Gates)
53
+
54
+ > **Kiro** là IDE có khả năng sinh spec cấu trúc tại `.kiro/specs/`.
55
+ > Khi phát hiện thư mục này, orchestrator tự động map nội dung vào Gate system,
56
+ > giúp bypass/accelerate các Gates mà không cần AI tự sinh lại tài liệu.
57
+
58
+ ### Detection Logic (chạy ĐẦU TIÊN trước Gate check)
59
+
60
+ ```yaml
61
+ kiro_detection:
62
+ trigger: Mỗi khi bắt đầu COMPLEX task
63
+ scan_path: ".kiro/specs/" (tương đối từ project root)
64
+
65
+ structure_expected:
66
+ .kiro/specs/
67
+ ├── <project-slug>/ # Top-level project spec
68
+ │ ├── requirements.md # → Gate 1 (Spec)
69
+ │ ├── design.md # → Gate 2 (Architecture)
70
+ │ └── tasks.md # → Gate 3 (Symphony Tasks)
71
+ ├── <module-01>/ # Per-module specs
72
+ │ ├── requirements.md # → Gate 1.5 (Module Spec)
73
+ │ ├── design.md # → Gate 2 (per-module design)
74
+ │ └── tasks.md # → Gate 3 (per-module tasks)
75
+ └── <module-02>/
76
+ └── ...
77
+
78
+ gate_mapping:
79
+ gate_1_spec:
80
+ pass_if: ANY requirements.md exists in .kiro/specs/
81
+ source: .kiro/specs/<project-slug>/requirements.md
82
+ action: Load as project BRIEF — bypass brainstorm-agent
83
+
84
+ gate_1_5_module_spec:
85
+ pass_if: ≥2 module folders (excluding project-slug) with requirements.md
86
+ source: .kiro/specs/<module>/requirements.md (each)
87
+ action: Load as module specs — bypass module-spec-writer
88
+
89
+ gate_2_architecture:
90
+ pass_if: ANY design.md exists in .kiro/specs/
91
+ source: .kiro/specs/<project-slug>/design.md + per-module design.md
92
+ action: Load as approved design — auto-approve (user already approved in Kiro)
93
+
94
+ gate_2_5_visual:
95
+ pass_if: NOT affected (Kiro doesn't produce visual designs)
96
+ action: Normal Gate 2.5 flow
97
+
98
+ gate_3_tasks:
99
+ pass_if: ANY tasks.md exists in .kiro/specs/
100
+ source: .kiro/specs/<module>/tasks.md (each)
101
+ action: Parse tasks → auto-create Symphony tickets
102
+
103
+ output_format:
104
+ "🔍 KIRO SPECS DETECTED at .kiro/specs/
105
+ 📄 Requirements: {count} files (Gate 1 + 1.5 → AUTO-PASS)
106
+ 📐 Design docs: {count} files (Gate 2 → AUTO-PASS)
107
+ 📋 Task lists: {count} files (Gate 3 → AUTO-IMPORT)
108
+ Modules: {list module names}"
109
+ ```
110
+
111
+ ### Kiro Spec Priority Rules
112
+
113
+ ```
114
+ 1. .kiro/specs > docs/specs > docs/architecture > Brain/NeuralMemory
115
+ → Kiro specs LUÔN được ưu tiên khi tồn tại
116
+
117
+ 2. Nếu CẢ .kiro/specs VÀ docs/specs tồn tại:
118
+ → Dùng .kiro/specs làm source of truth
119
+ → Cảnh báo: "⚠️ Phát hiện cả .kiro/specs và docs/specs.
120
+ Sử dụng .kiro/specs làm source of truth. docs/specs có thể outdated."
121
+
122
+ 3. Kiro specs KHÔNG thay thế:
123
+ → Gate 2.5 (Visual Design) — Kiro không tạo design visuals
124
+ → Gate 5 (Verification) — luôn cần run tests/build
125
+ → NeuralMemory decisions — vẫn lưu context vào brain
126
+
127
+ 4. Khi code (Gate 4), AI PHẢI đối chiếu với:
128
+ → .kiro/specs/<module>/requirements.md (acceptance criteria)
129
+ → .kiro/specs/<module>/design.md (technical design)
130
+ → .kiro/specs/<module>/tasks.md (task checklist)
131
+ ```
132
+
133
+ ---
134
+
50
135
  ## 🎯 STEP 1: Complexity Triage (BẮT BUỘC)
51
136
 
52
137
  Mỗi khi nhận request từ user, orchestrator PHẢI phân loại complexity **TRƯỚC** mọi action khác.
@@ -89,8 +174,8 @@ TRIVIAL (score 0-2): Bypass ALL gates → Execute trực tiếp
89
174
  MODERATE (score 3-5): Gate 3 + 4 + 5
90
175
  Examples: thêm UI component, sửa logic business nhỏ, update 1-2 files
91
176
 
92
- COMPLEX (score 6-10): ALL 5 Gates bắt buộc
93
- Examples: thêm feature mới, thay đổi DB schema, refactor architecture, thêm API
177
+ COMPLEX (score 6-10): ALL 7 Gates bắt buộc
178
+ Examples: thêm feature mới, thay đổi DB schema, thiết kế UI, refactor architecture, thêm API
94
179
  ```
95
180
 
96
181
  ### Output Format
@@ -112,27 +197,69 @@ Dừng tại Gate ĐẦU TIÊN chưa thỏa mãn.
112
197
 
113
198
  ```
114
199
  CHECK: Tồn tại file mô tả feature này?
115
- Scan: docs/specs/<feature>.md HOẶC docs/BRIEF.md section liên quan
116
- Hoặc: NeuralMemory BRIEF/SPEC cho feature này
200
+ CHECK 1 (Kiro): .kiro/specs/<module>/requirements.md tồn tại?
201
+ AUTO-PASS Gate 1 (Kiro specs detected)
202
+ → CHECK 2: docs/specs/<feature>.md HOẶC docs/BRIEF.md có section liên quan
203
+ → CHECK 3: NeuralMemory có BRIEF/SPEC cho feature này
117
204
 
118
- PASS condition: File tồn tại VÀ có nội dung rõ ràng (use cases, target users, scope)
205
+ PASS condition:
206
+ - .kiro/specs requirements.md tồn tại (highest priority), HOẶC
207
+ - docs/specs file tồn tại VÀ có nội dung rõ ràng, HOẶC
208
+ - NeuralMemory có BRIEF/SPEC
119
209
 
120
210
  FAIL action:
121
211
  → Thông báo user: "Ý tưởng rất hay! Nhưng trước khi bắt tay vào code,
122
212
  để tôi hỏi vài câu để chốt rõ yêu cầu đã nhé."
123
213
  → Kích hoạt: brainstorm-agent skill (Phase 2-6)
124
214
  → Output: BRIEF.md hoặc docs/specs/<feature>.md
125
- → Sau khi tạo xong → Re-check Gate 1 → Proceed Gate 2
215
+ → Sau khi tạo xong → Re-check Gate 1 → Proceed Gate 1.5
216
+ ```
217
+
218
+ ### Gate 1.5: Module Specification 🟠
219
+
220
+ ```
221
+ CHECK: Mỗi module có file spec chi tiết?
222
+ → CHECK 1 (Kiro): .kiro/specs/ chứa ≥2 module folders với requirements.md?
223
+ → CÓ → AUTO-PASS Gate 1.5 (Kiro module specs detected)
224
+ → Load từng .kiro/specs/<module>/requirements.md làm module spec
225
+ → CHECK 2: docs/specs/modules/<module>_spec.md tồn tại?
226
+ → CHECK 3: NeuralMemory có module specs cho project này
227
+
228
+ PASS condition:
229
+ - .kiro/specs module folders tồn tại (highest priority), HOẶC
230
+ - Tất cả modules có spec file VÀ status "Approved"
231
+
232
+ SKIP condition:
233
+ → TRIVIAL hoặc MODERATE tasks → SKIP
234
+ → Single-module projects (≤3 modules, không phải port) → SKIP
235
+ → User nói "skip spec" → SKIP
236
+
237
+ MANDATORY condition:
238
+ → COMPLEX (score ≥6) VÀ >3 modules
239
+ → Port/migration projects (iOS→Android, Android→iOS)
240
+
241
+ FAIL action:
242
+ → Thông báo user: "Trước khi thiết kế kỹ thuật, để em mô tả chi tiết
243
+ từng module — screens, flows, rules — để anh em hiểu rõ cùng nhau."
244
+ → Kích hoạt: module-spec-writer skill
245
+ → Output: docs/specs/modules/<module>_spec.md (per module)
246
+ → Sau khi tạo + approved → Re-check Gate 1.5 → Proceed Gate 2
126
247
  ```
127
248
 
128
249
  ### Gate 2: Architecture & Data Design 🟠
129
250
 
130
251
  ```
131
252
  CHECK: Tồn tại bản thiết kế kỹ thuật đã được duyệt?
132
- Scan: docs/architecture/<feature>_design.md
133
- HOẶC: implementation_plan.md section "Data Model" + marker "Approved"
253
+ CHECK 1 (Kiro): .kiro/specs/<module>/design.md tồn tại?
254
+ AUTO-PASS Gate 2 (Kiro design specs detected, pre-approved by IDE)
255
+ → Load design.md làm approved architecture document
256
+ → Lưu vào NeuralMemory: "Kiro design docs loaded for <modules>"
257
+ → CHECK 2: docs/architecture/<feature>_design.md tồn tại?
258
+ → CHECK 3: implementation_plan.md có section "Data Model" + marker "Approved"
134
259
 
135
- PASS condition: File tồn tại VÀ có marker "## Status: Approved"
260
+ PASS condition:
261
+ - .kiro/specs design.md tồn tại (highest priority, auto-approved), HOẶC
262
+ - docs/architecture file tồn tại VÀ có marker "## Status: Approved"
136
263
 
137
264
  FAIL action:
138
265
  → Thông báo user: "Đã có spec rồi. Giờ để tôi phác thảo thiết kế
@@ -140,19 +267,45 @@ FAIL action:
140
267
  → Kích hoạt: spec-gate skill
141
268
  → Output: docs/architecture/<feature>_design.md
142
269
  → Yêu cầu user approve design
143
- → Sau khi approved → Re-check Gate 2 → Proceed Gate 3
270
+ → Sau khi approved → Re-check Gate 2 → Proceed Gate 2.5
271
+ ```
272
+
273
+ ### Gate 2.5: Visual Design & UI Sync 🎨
274
+
275
+ ```
276
+ CHECK: Đã có thiết kế UI/hiểu biết chung về UI chưa?
277
+ → Scan: docs/design/ hoặc docs/screenshot/ có ảnh/tài liệu UI
278
+ → HOẶC: file docs/design/<feature>.pen đã được duyệt
279
+
280
+ PASS condition: Đã có ảnh UI tham chiếu HOẶC bản vẽ Pencil đính kèm.
281
+
282
+ SKIP condition:
283
+ → Backend/Logic-only tasks (Cron, API pure, Refactor, DB Query...)
284
+ → User nói "skip design"
285
+
286
+ FAIL action:
287
+ → Thông báo user: "Tính năng này có giao diện nên để đảm bảo đồng bộ,
288
+ tôi sẽ phác thảo qua thiết kế bằng Pencil hoặc anh có thể gửi ảnh screenshot/vào docs/design/ trước nhé."
289
+ → Kích hoạt: visual-design-gate skill
290
+ → Output: UI layout thống nhất (ảnh / .pen file)
291
+ → Xác nhận approve visual preview
292
+ → Sau khi approved → Re-check Gate 2.5 → Proceed Gate 3
144
293
  ```
145
294
 
146
295
  ### Gate 3: Task Breakdown (Symphony) 🟡
147
296
 
148
297
  ```
149
298
  CHECK: Có Symphony tasks liên kết feature này?
150
- symphony_available_tasks filter by feature keyword/tag
299
+ CHECK 1 (Kiro): .kiro/specs/<module>/tasks.md tồn tại?
300
+ → CÓ → Parse tasks từ Kiro tasks.md
301
+ → Map task items → Symphony tickets (symphony_create_task)
302
+ → AUTO-IMPORT: Tạo Symphony tasks từ Kiro task list
303
+ → CHECK 2: symphony_available_tasks → filter by feature keyword/tag
151
304
 
152
305
  PASS condition: ≥1 task tồn tại cho feature này
153
306
 
154
307
  FAIL action:
155
- → Đọc design doc từ Gate 2
308
+ → Đọc design doc từ Gate 2 (hoặc .kiro/specs design.md)
156
309
  → Auto-generate 3-8 micro-tasks
157
310
  → Tạo Symphony tasks (symphony_create_task cho mỗi task)
158
311
  → Present danh sách cho user confirm
@@ -304,7 +457,9 @@ always_do:
304
457
  ```
305
458
  DELEGATES TO:
306
459
  Gate 1 → brainstorm-agent (phỏng vấn → BRIEF.md)
460
+ Gate 1.5 → module-spec-writer (mô tả chi tiết per-module spec)
307
461
  Gate 2 → spec-gate (thiết kế DB/API → design doc)
462
+ Gate 2.5 → visual-design-gate (thống nhất UI/UX bằng Pencil)
308
463
  Gate 3 → symphony-enforcer (tạo + track tasks)
309
464
  Gate 4 → relevant coding workflow (/code, /codeExpert)
310
465
  Gate 5 → verification-gate + code-review
@@ -333,7 +488,11 @@ DOES NOT:
333
488
  | Multiple features cùng lúc | Triage TỪNG feature riêng |
334
489
  | Spec tồn tại nhưng outdated | Cảnh báo "Spec cũ, cần update?" |
335
490
  | Project chưa có docs/ folder | Tạo folder structure tự động |
491
+ | `.kiro/specs/` tồn tại | AUTO-DETECT → accelerate Gates 1, 1.5, 2, 3 |
492
+ | `.kiro/specs` + `docs/specs` cùng tồn tại | Ưu tiên `.kiro/specs`, cảnh báo potential conflict |
493
+ | `.kiro/specs` chỉ có 1 module folder | Pass Gate 1, SKIP Gate 1.5 (single module) |
494
+ | `.kiro/specs/<module>/tasks.md` format lạ | Parse best-effort, fallback tạo tasks thủ công |
336
495
 
337
496
  ---
338
497
 
339
- *orchestrator v2.0 — Autonomous State Machine Gatekeeper for AWKit*
498
+ *orchestrator v2.3 — Autonomous State Machine Gatekeeper for AWKit (Kiro Spec Integration)*