@relipa/ai-flow-kit 0.1.0 → 0.1.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,537 +1,537 @@
1
- # Quick Start — AI Flow Kit
2
-
3
- > Full workflow: [AIFLOW.md](./AIFLOW.md)
4
-
5
- ---
6
-
7
- ## Installation
8
-
9
- ```bash
10
- npm install -g @relipa/ai-flow-kit
11
-
12
- # Beta version (recommend for newest features)
13
- npm install -g @relipa/ai-flow-kit@beta
14
-
15
- # Verification
16
- aiflow --version # or short: aiflow -v
17
-
18
- # Uninstall
19
- npm uninstall -g @relipa/ai-flow-kit
20
- ```
21
-
22
- ---
23
-
24
- ## Project Setup (One-time)
25
-
26
- ```bash
27
- cd your-project
28
-
29
- # Single framework + adapter
30
- aiflow init --framework spring-boot --adapter backlog
31
-
32
- # Or multiple
33
- aiflow init --framework spring-boot,reactjs --adapter backlog,jira
34
- ```
35
-
36
- During init:
37
- - Enter `BACKLOG_API_KEY` and `BACKLOG_SPACE_KEY` when prompted
38
- - Press Enter to keep the old value (if previously set up)
39
- - The package automatically verifies credentials right after input
40
-
41
- Results after init:
42
- ```
43
- ✓ Superpowers skills ready (built-in)
44
- ✓ Applied java rules
45
- ✓ CLAUDE.md updated for framework: spring-boot
46
- ✓ Credentials verified successfully
47
- ✓ Superpowers SessionStart hook configured
48
- ✨ Initialized AI Flow Kit successfully!
49
- ```
50
-
51
- Check setup:
52
- ```bash
53
- aiflow doctor
54
- ```
55
-
56
- ---
57
-
58
- ## Complete Developer Workflow (Start → Finish)
59
-
60
- > **5-Gate workflow: Gate must pass in order. No skipping.**
61
- >
62
- > See [AIFLOW.md](./AIFLOW.md) for full details on each gate.
63
-
64
- ### Step 1: Load ticket context
65
-
66
- ```bash
67
- # Load from Backlog (description only)
68
- aiflow use PROJ-33
69
-
70
- # Load with comments (recommended for bug-fix)
71
- aiflow use PROJ-33 -c
72
-
73
- # Load from Backlog URL
74
- aiflow use https://mycompany.backlog.com/view/PROJ-33
75
-
76
- # Load newest 5 comments
77
- aiflow use PROJ-33 --clast 5
78
-
79
- # Multi-target — primary ticket + supplementary sources (v0.1.0+)
80
- aiflow use PROJ-33 PROJ-10 docs/arch.md
81
- # PROJ-33 drives Gate 1; PROJ-10 + docs/arch.md become supplementary context
82
-
83
- # Manual input (no Backlog/Jira)
84
- aiflow use --manual
85
-
86
- # Load from local file (JSON or plain text)
87
- aiflow use --file task-description.txt
88
- ```
89
-
90
- > **Auto Link Resolution (v0.1.0+):** Backlog/Jira URLs in the primary ticket's description are auto-fetched and added to `supplementaryContext[]`. Comment links (`#comment-456`, `?focusedCommentId=456`) fetch **only that comment**. AI integrates these supplementary sources in Gate 1 analysis automatically.
91
-
92
- Output:
93
- ```
94
- ✓ Context loaded
95
-
96
- Ticket: PROJ-33
97
- Type: bug-fix
98
- Title: [ticket title]
99
- Status: In Progress
100
- Assignee: yourname
101
- ```
102
-
103
- ### Step 2: Open Claude — AI auto-starts
104
-
105
- ```bash
106
- claude # AI auto-starts Gate 1 immediately
107
- ```
108
-
109
- ### Step 3: Approval & Session Refresh
110
-
111
- After the AI finishes its task at any Gate (e.g., Gate 1 Requirement Analysis), and you are ready to move to the next gate:
112
-
113
- 1. Review the output.
114
- 2. Type **APPROVED** to finish the current gate.
115
- 3. Run **`aiflow task next`**. This command will:
116
- - Finalize the current gate state.
117
- - Generate a `task-summary.md` report.
118
- - Prepare the task for the next stage.
119
- 4. **Important:** Open a **fresh chat session** (new chatbox) and type `continue` to start the next gate. This ensures the AI has a clean context.
120
-
121
- ### Step 4: Resume Task
122
-
123
- If you switched tasks or started a new session:
124
-
125
- ```bash
126
- # Resume the most recent task
127
- aiflow task resume
128
-
129
- # Or resume a specific task
130
- aiflow task resume PROJ-33
131
- ```
132
- Then open Claude and the AI will auto-detect the current gate and resume exactly where you left off.
133
-
134
- > **Note:** `aiflow prompt` is optional — only needed when pasting into Claude Desktop/Web.
135
- >
136
- > **Multi-Tool Support:**
137
- > - If using **Cursor**: Gate Workflow is enforced via `.cursorrules`.
138
- > - If using **Gemini CLI**: Rules are loaded from `GEMINI.md`.
139
- > - The AI will automatically detect if you are mid-task by reading `.aiflow/context/current.json`.
140
-
141
- ### Step 3: GATE 1 — AI Analyzes Requirement
142
-
143
- **What happens:** AI reads your ticket + source code + asks questions.
144
-
145
- > [!NOTE]
146
- > **Fast Mode** is now the default. AI aims for a quick scan and minimal Q&A to get you coding in < 5 mins.
147
- > Use `aiflow use TICKET --full` if you want the AI to perform a deep, exhaustive analysis (Gate 1 Full).
148
-
149
- When you open Claude, AI will **automatically** start analyzing:
150
-
151
- 1. **Read ticket** from `.aiflow/context/current.json`
152
- 2. **Read source code** — understand architecture, related files, data flow
153
- 3. **Ask clarifying questions** (one at a time) if anything is unclear
154
- 4. **Output** `plan/PROJ-33/requirement.md` containing:
155
- - Requirements summary (AI's technical understanding)
156
- - Source code analysis (related files, data flow, patterns)
157
- - **Proposed solution** with recommendation
158
- - **Impact analysis** — what areas are affected, risks
159
- - **Effort estimate** (S/M/L/XL)
160
- - Testing plan
161
-
162
- **Your action:** Review the requirement document.
163
-
164
- ```
165
- # If satisfied:
166
- APPROVED
167
-
168
- # If something needs to change:
169
- "The solution should use Redis cache instead of in-memory"
170
- → AI updates the document and asks again
171
- ```
172
-
173
- ### Step 4: GATE 2 — Review Implementation Plan
174
-
175
- **What happens:** AI creates a detailed coding plan based on the approved requirement.
176
-
177
- AI outputs:
178
- - TDD task breakdown (test first → implement → verify)
179
- - Verification strategy (evidence before claims)
180
- - Test commands
181
-
182
- **Your action:**
183
-
184
- ```
185
- # If the plan looks good:
186
- APPROVED
187
-
188
- # If you want changes:
189
- "Split task 3 into smaller steps"
190
- → AI adjusts the plan
191
- ```
192
-
193
- ### Step 5: GATE 3 — AI Generates Code (TDD)
194
-
195
- **What happens:** AI writes code following the approved plan.
196
-
197
- - Writes tests FIRST → runs → confirms FAIL
198
- - Implements code → tests PASS
199
- - Verifies implementation works
200
-
201
- **Your action:** Monitor. No action needed unless AI asks a question.
202
-
203
- ### Step 6: GATE 4 — Review AI's Work
204
-
205
- **What happens:** AI self-reviews before showing you.
206
-
207
- AI runs automatically:
208
- 1. `verification-before-completion` — all tests PASS
209
- 2. `impact-analysis` — no breaking changes
210
- 3. Review checklist — all items checked
211
- 4. Creates `plan/PROJ-33/summary.md`
212
-
213
- Then shows you:
214
- ```
215
- ⏸️ GATE 4: WAITING FOR DEV REVIEW
216
-
217
- Tests: ✅ 12 passed
218
- Impact: 🟢 Low
219
- Checklist: 7/7 ✅
220
- Summary: plan/PROJ-33/summary.md
221
- ```
222
-
223
- **Your action:**
224
-
225
- ```
226
- # If everything is OK:
227
- APPROVED
228
-
229
- # If there's a bug in the code:
230
- BUG: The cache invalidation doesn't handle concurrent writes
231
-
232
- # If the requirement was wrong:
233
- BUG: Actually we need to support pagination, not just single page
234
- → AI goes back to Gate 1 to update requirement
235
- ```
236
-
237
- ### Step 7: GATE 5 — Create PR & Peer Review
238
-
239
- **What happens:** AI helps create the Pull Request.
240
-
241
- ```bash
242
- git push origin feature/PROJ-33-description
243
- # AI suggests PR title, description, and checklist
244
- ```
245
-
246
- Ask a teammate to review. They can use `superpowers:receiving-code-review` skill.
247
-
248
- After peer reviewer approves → merge → task complete.
249
-
250
- ### Step 9: Task Management & Session Continuity
251
-
252
- Manage multiple tasks and ensure clean transitions between gates to prevent "context pollution" in long AI sessions.
253
-
254
- ```bash
255
- # Pause current task (saves gate progress)
256
- aiflow task pause --note "Waiting for PM clarification"
257
-
258
- # List all tasks
259
- aiflow task list
260
-
261
- # Resume a previously paused task
262
- aiflow task resume PROJ-33
263
-
264
- # Approve gate and prepare for fresh session (Recommended)
265
- aiflow task next
266
- ```
267
-
268
- #### Best Practice: Refreshing Sessions
269
- To keep the AI focused and avoid context pollution (where the AI gets confused by long chat history), it is recommended to start a **fresh chat session** after completing each gate.
270
-
271
- 1. Run `aiflow task next` in your terminal to approve the current gate.
272
- 2. Open a **NEW chatbox** (Claude UI, Cursor, etc.).
273
- 3. Run `aiflow task resume [ticket-id]` (if not already active).
274
- 4. Type **"continue"** — the AI will read the latest state and start the next gate with a clean slate.
275
-
276
- #### Resuming Gate 3 (Code Generation)
277
- If you need to switch chatboxes in the middle of a complex coding task (Gate 3):
278
- - Gate 3 progress is saved via `[x]` checkboxes in the plan file (`plan/[id]/plan.md`).
279
- - Simply open a new chatbox, run `aiflow task resume`, and tell the AI to **"continue executing the plan"**.
280
- - The AI will automatically skip finished tasks and pick up exactly where you left off.
281
-
282
-
283
- ---
284
-
285
- ## Workflow Summary Diagram
286
-
287
- ```
288
- Developer AI Peer
289
- │ │ │
290
- │ aiflow use PROJ-33 │ │
291
- │ claude │ │
292
- │ │ │
293
- │ ─── GATE 1 ──────────────────►│ │
294
- │ │ Read ticket + source code │
295
- │ │ Ask questions (1 at a time) │
296
- │ ◄─── requirement.md ─────────│ │
297
- │ │ │
298
- │ "APPROVED" ──────────────────►│ │
299
- │ │ │
300
- │ ─── GATE 2 ──────────────────►│ │
301
- │ │ Create implementation plan │
302
- │ ◄─── plan ───────────────────│ │
303
- │ │ │
304
- │ "APPROVED" ──────────────────►│ │
305
- │ │ │
306
- │ GATE 3 │ Write tests → implement │
307
- │ (monitor) │ Verify implementation works │
308
- │ │ │
309
- │ ─── GATE 4 ──────────────────►│ │
310
- │ │ Self-review + summary │
311
- │ ◄─── summary.md ────────────│ │
312
- │ │ │
313
- │ "APPROVED" ──────────────────►│ │
314
- │ │ │
315
- │ ─── GATE 5 ─────────────────────────────────────────────────►│
316
- │ │ Review PR
317
- │ ◄──────────────────────────────────────────── APPROVED ──────│
318
- │ │ │
319
- │ Merge ✅ │ │
320
- ```
321
-
322
- ---
323
-
324
- ## Use Cases
325
-
326
- ### Bug Fix
327
-
328
- ```bash
329
- aiflow use PROJ-33 --with-comments
330
- claude # AI auto-starts: analyze bug → trace root cause → propose fix
331
- ```
332
-
333
- ### New Feature
334
-
335
- ```bash
336
- aiflow use PROJ-99
337
- claude # AI auto-starts: analyze requirements → propose architecture
338
- ```
339
-
340
- ### Investigation (no coding)
341
-
342
- ```bash
343
- aiflow use PROJ-50
344
- claude # AI auto-starts: investigate → output findings report
345
- ```
346
-
347
- ### Refactoring
348
-
349
- ```bash
350
- aiflow use PROJ-77
351
- claude # AI auto-starts: analyze impact → plan refactor steps
352
- ```
353
-
354
- ### Impact Analysis (no coding)
355
-
356
- ```bash
357
- aiflow use PROJ-88
358
- claude # AI auto-starts: map dependencies → assess risk → output report
359
- ```
360
-
361
- ### Figma Design → Code
362
-
363
- Turn a Figma design into a React / Next.js / Vue / Angular component automatically.
364
-
365
- **Step 1: Set up Figma MCP adapter (one-time)**
366
-
367
- Choose one option:
368
-
369
- | Option | Command | Requirement |
370
- |--------|---------|-------------|
371
- | Figma Desktop (recommended) | `ak init -a figma-desktop` | Figma Desktop app installed and open |
372
- | Figma REST API | `ak init -a figma` | Figma Personal Access Token (`figd_...`) |
373
-
374
- ```bash
375
- # Option A: Figma Desktop — no API token needed, uses Desktop session
376
- ak init -a figma-desktop
377
-
378
- # Option B: Figma REST API — requires Personal Access Token
379
- ak init -a figma
380
- # Enter your token when prompted (Settings → Security → Personal access tokens)
381
- ```
382
-
383
- **Step 2: Get the Figma node URL**
384
-
385
- In Figma Desktop or web, right-click the frame/component → **Copy link to selection**.
386
-
387
- URL format: `https://www.figma.com/design/<fileKey>/...?node-id=<nodeId>`
388
-
389
- **Step 3: Trigger the skill in Claude**
390
-
391
- ```
392
- Generate component from this Figma frame:
393
- https://www.figma.com/design/abc123/MyDesign?node-id=12:34
394
- ```
395
-
396
- Claude uses the `figma-to-component` skill and auto-detects your framework (Next.js App Router, React, Vue, Angular).
397
-
398
- > Full guide: [docs/common/workflows/figma.md](./workflows/figma.md)
399
-
400
- ---
401
-
402
- ## All Commands
403
-
404
- > **Tip:** All commands support a short alias. Use `ak` instead of `aiflow` and the alias instead of the full command name (e.g. `ak t st` = `ak task status`).
405
-
406
- ```bash
407
- # Setup
408
- ak init --framework nestjs --adapter backlog # (ak i -f nestjs -a backlog)
409
- ak init --fw spring-boot --with-rtk # --fw alias for --framework, RTK: bash compression (60–90%)
410
- ak init --no-rtk # skip RTK setup
411
- ak dr # health check (ak doctor)
412
- ak g # multi-tool guide (ak guide)
413
- ak g -f # architecture diagram (ak guide --flow)
414
- ak g -c # command reference (ak guide --commands)
415
- ak sync # sync aiflow instruction files (ak sync-skills)
416
-
417
- # Per task
418
- ak use PROJ-33 # load context (Fast Mode, default) — alias: ak u PROJ-33
419
- ak use PROJ-33 PROJ-10 docs/arch.md # multi-target: primary + supplementary (v0.1.0+)
420
- ak use PROJ-33 -F # Fast Mode explicit (--fast)
421
- ak use PROJ-33 -U # Full Mode (--full)
422
- ak use -f task.md # load from local file (--file)
423
- ak use PROJ-33 -c # load with all comments (--coms)
424
- ak use PROJ-33 --clast 5 # newest 5 comments
425
- ak use -m # manual input (--manual)
426
- ak fetch-links "<backlog-or-jira-url>" # fetch single link → JSON (used by AI runtime, v0.1.0+)
427
- ak p bug-fix # generate prompt (ak prompt)
428
- ak p feature -o p.md # save prompt to file (--output)
429
- ak p -L vietnamese # Vietnamese prompt (--lang)
430
- ak p -l # list prompt types (--list)
431
-
432
- # Task management
433
- ak t st # show active and pending tasks (ak task status)
434
- ak t ls # list all saved tasks (ak task list)
435
- ak t p # pause current task (ak task pause)
436
- ak t p -n "waiting for PM" # pause with note (--note)
437
- ak t sw PROJ-99 # switch to another task (ak task switch)
438
- ak t r PROJ-33 # resume a paused task (ak task resume)
439
- ak t rst PROJ-33 # reset to Gate 1 (ak task reset)
440
- ak t rm PROJ-33 # permanently delete task data (ak task remove)
441
- ak t n # approve gate & prep next session (ak task next)
442
-
443
- # Context management
444
- ak ctx show # view active context (ak context show)
445
- ak ctx list # list saved contexts
446
- ak ctx save my-snapshot # save named snapshot
447
- ak ctx -l my-snapshot # load named snapshot (--load)
448
- ak ctx clear # clear active context
449
-
450
- # Team knowledge
451
- ak mem s "key" "value" # save knowledge (ak memory save)
452
- ak mem g "key" # retrieve (ak memory get)
453
- ak mem sr "keyword" # search (ak memory search)
454
- ak mem ls # list all (ak memory list)
455
- ak mem d "key" # delete (ak memory delete)
456
- ak mem cl # clear all (ak memory clear)
457
-
458
- # Utilities
459
- ak vl src/File.java # validate code (ak validate)
460
- ak vl src/File.java -x # validate and auto-fix (--fix)
461
- ak d "description" # detect task type (ak detect)
462
-
463
- # Maintenance
464
- ak rm # remove from project (ak remove)
465
- ak rm -g # uninstall globally (--global)
466
- ak up # update to latest (ak update)
467
- ak up -f # force update (--force)
468
- npm uninstall -g @relipa/ai-flow-kit # standard npm uninstall
469
- ```
470
-
471
- ---
472
-
473
- ## Documentation Files
474
-
475
- After installing `ai-flow-kit`, these docs are available:
476
-
477
- | File | Description |
478
- |------|-------------|
479
- | [QUICK_START.md](./QUICK_START.md) | This file — step-by-step guide for developers |
480
- | [AIFLOW.md](./AIFLOW.md) | Complete 5-Gate workflow: who does what, outputs, templates |
481
- | [README.md](./README.md) | Package overview, architecture, all features |
482
- | [CHANGELOG.md](./CHANGELOG.md) | Version history |
483
- | [IMPLEMENTATION_SUMMARY.md](./IMPLEMENTATION_SUMMARY.md) | Technical implementation details |
484
- | [workflows/](./workflows/) | Per-task-type workflow guides |
485
- | [architecture.md](./architecture.md) | System architecture |
486
- | [cli-reference.md](./cli-reference.md) | CLI command reference |
487
- | [configuration.md](./configuration.md) | Configuration guide |
488
- | [troubleshooting.md](./troubleshooting.md) | Common issues & fixes |
489
- | [getting-started.md](./getting-started.md) | Getting started guide |
490
-
491
- Access docs after install:
492
- ```bash
493
- # Docs are in the package directory
494
- npm root -g # find global packages directory
495
- # → <path>/@relipa/ai-flow-kit/AIFLOW.md, QUICK_START.md, etc.
496
-
497
- # Or use the built-in guide
498
- aiflow guide
499
- ```
500
-
501
- ---
502
-
503
- ## Troubleshooting
504
-
505
- **`aiflow` not found:**
506
- ```bash
507
- npm install -g @relipa/ai-flow-kit
508
- ```
509
-
510
- **Incorrect credentials:**
511
- ```bash
512
- # Re-running will prompt again; press Enter to keep the old value
513
- aiflow init --adapter backlog
514
- ```
515
-
516
- **Context not loading:**
517
- ```bash
518
- # Check if credentials are saved
519
- cat .aiflow/credentials.json
520
-
521
- # Try loading again
522
- aiflow use PROJ-33
523
- ```
524
-
525
- **Skills not working in Claude:**
526
- ```bash
527
- # init must be run outside the Claude terminal (once)
528
- # Then reopen Claude
529
- aiflow doctor
530
- ```
531
-
532
- **Need to see all available prompt types:**
533
- ```bash
534
- aiflow prompt --list
535
- ```
536
-
537
- See more: [docs/troubleshooting.md](./docs/troubleshooting.md)
1
+ # Quick Start — AI Flow Kit
2
+
3
+ > Full workflow: [AIFLOW.md](./AIFLOW.md)
4
+
5
+ ---
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install -g @relipa/ai-flow-kit
11
+
12
+ # Beta version (recommend for newest features)
13
+ npm install -g @relipa/ai-flow-kit@beta
14
+
15
+ # Verification
16
+ aiflow --version # or short: aiflow -v
17
+
18
+ # Uninstall
19
+ npm uninstall -g @relipa/ai-flow-kit
20
+ ```
21
+
22
+ ---
23
+
24
+ ## Project Setup (One-time)
25
+
26
+ ```bash
27
+ cd your-project
28
+
29
+ # Single framework + adapter
30
+ aiflow init --framework spring-boot --adapter backlog
31
+
32
+ # Or multiple
33
+ aiflow init --framework spring-boot,reactjs --adapter backlog,jira
34
+ ```
35
+
36
+ During init:
37
+ - Enter `BACKLOG_API_KEY` and `BACKLOG_SPACE_KEY` when prompted
38
+ - Press Enter to keep the old value (if previously set up)
39
+ - The package automatically verifies credentials right after input
40
+
41
+ Results after init:
42
+ ```
43
+ ✓ Superpowers skills ready (built-in)
44
+ ✓ Applied java rules
45
+ ✓ CLAUDE.md updated for framework: spring-boot
46
+ ✓ Credentials verified successfully
47
+ ✓ Superpowers SessionStart hook configured
48
+ ✨ Initialized AI Flow Kit successfully!
49
+ ```
50
+
51
+ Check setup:
52
+ ```bash
53
+ aiflow doctor
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Complete Developer Workflow (Start → Finish)
59
+
60
+ > **5-Gate workflow: Gate must pass in order. No skipping.**
61
+ >
62
+ > See [AIFLOW.md](./AIFLOW.md) for full details on each gate.
63
+
64
+ ### Step 1: Load ticket context
65
+
66
+ ```bash
67
+ # Load from Backlog (description only)
68
+ aiflow use PROJ-33
69
+
70
+ # Load with comments (recommended for bug-fix)
71
+ aiflow use PROJ-33 -c
72
+
73
+ # Load from Backlog URL
74
+ aiflow use https://mycompany.backlog.com/view/PROJ-33
75
+
76
+ # Load newest 5 comments
77
+ aiflow use PROJ-33 --clast 5
78
+
79
+ # Multi-target — primary ticket + supplementary sources (v0.1.0+)
80
+ aiflow use PROJ-33 PROJ-10 docs/arch.md
81
+ # PROJ-33 drives Gate 1; PROJ-10 + docs/arch.md become supplementary context
82
+
83
+ # Manual input (no Backlog/Jira)
84
+ aiflow use --manual
85
+
86
+ # Load from local file (JSON or plain text)
87
+ aiflow use --file task-description.txt
88
+ ```
89
+
90
+ > **Auto Link Resolution (v0.1.0+):** Backlog/Jira URLs in the primary ticket's description are auto-fetched and added to `supplementaryContext[]`. Comment links (`#comment-456`, `?focusedCommentId=456`) fetch **only that comment**. AI integrates these supplementary sources in Gate 1 analysis automatically.
91
+
92
+ Output:
93
+ ```
94
+ ✓ Context loaded
95
+
96
+ Ticket: PROJ-33
97
+ Type: bug-fix
98
+ Title: [ticket title]
99
+ Status: In Progress
100
+ Assignee: yourname
101
+ ```
102
+
103
+ ### Step 2: Open Claude — AI auto-starts
104
+
105
+ ```bash
106
+ claude # AI auto-starts Gate 1 immediately
107
+ ```
108
+
109
+ ### Step 3: Approval & Session Refresh
110
+
111
+ After the AI finishes its task at any Gate (e.g., Gate 1 Requirement Analysis), and you are ready to move to the next gate:
112
+
113
+ 1. Review the output.
114
+ 2. Type **APPROVED** to finish the current gate.
115
+ 3. Run **`aiflow task next`**. This command will:
116
+ - Finalize the current gate state.
117
+ - Generate a `task-summary.md` report.
118
+ - Prepare the task for the next stage.
119
+ 4. **Important:** Open a **fresh chat session** (new chatbox) and type `continue` to start the next gate. This ensures the AI has a clean context.
120
+
121
+ ### Step 4: Resume Task
122
+
123
+ If you switched tasks or started a new session:
124
+
125
+ ```bash
126
+ # Resume the most recent task
127
+ aiflow task resume
128
+
129
+ # Or resume a specific task
130
+ aiflow task resume PROJ-33
131
+ ```
132
+ Then open Claude and the AI will auto-detect the current gate and resume exactly where you left off.
133
+
134
+ > **Note:** `aiflow prompt` is optional — only needed when pasting into Claude Desktop/Web.
135
+ >
136
+ > **Multi-Tool Support:**
137
+ > - If using **Cursor**: Gate Workflow is enforced via `.cursorrules`.
138
+ > - If using **Gemini CLI**: Rules are loaded from `GEMINI.md`.
139
+ > - The AI will automatically detect if you are mid-task by reading `.aiflow/context/current.json`.
140
+
141
+ ### Step 3: GATE 1 — AI Analyzes Requirement
142
+
143
+ **What happens:** AI reads your ticket + source code + asks questions.
144
+
145
+ > [!NOTE]
146
+ > **Fast Mode** is now the default. AI aims for a quick scan and minimal Q&A to get you coding in < 5 mins.
147
+ > Use `aiflow use TICKET --full` if you want the AI to perform a deep, exhaustive analysis (Gate 1 Full).
148
+
149
+ When you open Claude, AI will **automatically** start analyzing:
150
+
151
+ 1. **Read ticket** from `.aiflow/context/current.json`
152
+ 2. **Read source code** — understand architecture, related files, data flow
153
+ 3. **Ask clarifying questions** (one at a time) if anything is unclear
154
+ 4. **Output** `plan/PROJ-33/requirement.md` containing:
155
+ - Requirements summary (AI's technical understanding)
156
+ - Source code analysis (related files, data flow, patterns)
157
+ - **Proposed solution** with recommendation
158
+ - **Impact analysis** — what areas are affected, risks
159
+ - **Effort estimate** (S/M/L/XL)
160
+ - Testing plan
161
+
162
+ **Your action:** Review the requirement document.
163
+
164
+ ```
165
+ # If satisfied:
166
+ APPROVED
167
+
168
+ # If something needs to change:
169
+ "The solution should use Redis cache instead of in-memory"
170
+ → AI updates the document and asks again
171
+ ```
172
+
173
+ ### Step 4: GATE 2 — Review Implementation Plan
174
+
175
+ **What happens:** AI creates a detailed coding plan based on the approved requirement.
176
+
177
+ AI outputs:
178
+ - TDD task breakdown (test first → implement → verify)
179
+ - Verification strategy (evidence before claims)
180
+ - Test commands
181
+
182
+ **Your action:**
183
+
184
+ ```
185
+ # If the plan looks good:
186
+ APPROVED
187
+
188
+ # If you want changes:
189
+ "Split task 3 into smaller steps"
190
+ → AI adjusts the plan
191
+ ```
192
+
193
+ ### Step 5: GATE 3 — AI Generates Code (TDD)
194
+
195
+ **What happens:** AI writes code following the approved plan.
196
+
197
+ - Writes tests FIRST → runs → confirms FAIL
198
+ - Implements code → tests PASS
199
+ - Verifies implementation works
200
+
201
+ **Your action:** Monitor. No action needed unless AI asks a question.
202
+
203
+ ### Step 6: GATE 4 — Review AI's Work
204
+
205
+ **What happens:** AI self-reviews before showing you.
206
+
207
+ AI runs automatically:
208
+ 1. `verification-before-completion` — all tests PASS
209
+ 2. `impact-analysis` — no breaking changes
210
+ 3. Review checklist — all items checked
211
+ 4. Creates `plan/PROJ-33/summary.md`
212
+
213
+ Then shows you:
214
+ ```
215
+ ⏸️ GATE 4: WAITING FOR DEV REVIEW
216
+
217
+ Tests: ✅ 12 passed
218
+ Impact: 🟢 Low
219
+ Checklist: 7/7 ✅
220
+ Summary: plan/PROJ-33/summary.md
221
+ ```
222
+
223
+ **Your action:**
224
+
225
+ ```
226
+ # If everything is OK:
227
+ APPROVED
228
+
229
+ # If there's a bug in the code:
230
+ BUG: The cache invalidation doesn't handle concurrent writes
231
+
232
+ # If the requirement was wrong:
233
+ BUG: Actually we need to support pagination, not just single page
234
+ → AI goes back to Gate 1 to update requirement
235
+ ```
236
+
237
+ ### Step 7: GATE 5 — Create PR & Peer Review
238
+
239
+ **What happens:** AI helps create the Pull Request.
240
+
241
+ ```bash
242
+ git push origin feature/PROJ-33-description
243
+ # AI suggests PR title, description, and checklist
244
+ ```
245
+
246
+ Ask a teammate to review. They can use `superpowers:receiving-code-review` skill.
247
+
248
+ After peer reviewer approves → merge → task complete.
249
+
250
+ ### Step 9: Task Management & Session Continuity
251
+
252
+ Manage multiple tasks and ensure clean transitions between gates to prevent "context pollution" in long AI sessions.
253
+
254
+ ```bash
255
+ # Pause current task (saves gate progress)
256
+ aiflow task pause --note "Waiting for PM clarification"
257
+
258
+ # List all tasks
259
+ aiflow task list
260
+
261
+ # Resume a previously paused task
262
+ aiflow task resume PROJ-33
263
+
264
+ # Approve gate and prepare for fresh session (Recommended)
265
+ aiflow task next
266
+ ```
267
+
268
+ #### Best Practice: Refreshing Sessions
269
+ To keep the AI focused and avoid context pollution (where the AI gets confused by long chat history), it is recommended to start a **fresh chat session** after completing each gate.
270
+
271
+ 1. Run `aiflow task next` in your terminal to approve the current gate.
272
+ 2. Open a **NEW chatbox** (Claude UI, Cursor, etc.).
273
+ 3. Run `aiflow task resume [ticket-id]` (if not already active).
274
+ 4. Type **"continue"** — the AI will read the latest state and start the next gate with a clean slate.
275
+
276
+ #### Resuming Gate 3 (Code Generation)
277
+ If you need to switch chatboxes in the middle of a complex coding task (Gate 3):
278
+ - Gate 3 progress is saved via `[x]` checkboxes in the plan file (`plan/[id]/plan.md`).
279
+ - Simply open a new chatbox, run `aiflow task resume`, and tell the AI to **"continue executing the plan"**.
280
+ - The AI will automatically skip finished tasks and pick up exactly where you left off.
281
+
282
+
283
+ ---
284
+
285
+ ## Workflow Summary Diagram
286
+
287
+ ```
288
+ Developer AI Peer
289
+ │ │ │
290
+ │ aiflow use PROJ-33 │ │
291
+ │ claude │ │
292
+ │ │ │
293
+ │ ─── GATE 1 ──────────────────►│ │
294
+ │ │ Read ticket + source code │
295
+ │ │ Ask questions (1 at a time) │
296
+ │ ◄─── requirement.md ─────────│ │
297
+ │ │ │
298
+ │ "APPROVED" ──────────────────►│ │
299
+ │ │ │
300
+ │ ─── GATE 2 ──────────────────►│ │
301
+ │ │ Create implementation plan │
302
+ │ ◄─── plan ───────────────────│ │
303
+ │ │ │
304
+ │ "APPROVED" ──────────────────►│ │
305
+ │ │ │
306
+ │ GATE 3 │ Write tests → implement │
307
+ │ (monitor) │ Verify implementation works │
308
+ │ │ │
309
+ │ ─── GATE 4 ──────────────────►│ │
310
+ │ │ Self-review + summary │
311
+ │ ◄─── summary.md ────────────│ │
312
+ │ │ │
313
+ │ "APPROVED" ──────────────────►│ │
314
+ │ │ │
315
+ │ ─── GATE 5 ─────────────────────────────────────────────────►│
316
+ │ │ Review PR
317
+ │ ◄──────────────────────────────────────────── APPROVED ──────│
318
+ │ │ │
319
+ │ Merge ✅ │ │
320
+ ```
321
+
322
+ ---
323
+
324
+ ## Use Cases
325
+
326
+ ### Bug Fix
327
+
328
+ ```bash
329
+ aiflow use PROJ-33 --with-comments
330
+ claude # AI auto-starts: analyze bug → trace root cause → propose fix
331
+ ```
332
+
333
+ ### New Feature
334
+
335
+ ```bash
336
+ aiflow use PROJ-99
337
+ claude # AI auto-starts: analyze requirements → propose architecture
338
+ ```
339
+
340
+ ### Investigation (no coding)
341
+
342
+ ```bash
343
+ aiflow use PROJ-50
344
+ claude # AI auto-starts: investigate → output findings report
345
+ ```
346
+
347
+ ### Refactoring
348
+
349
+ ```bash
350
+ aiflow use PROJ-77
351
+ claude # AI auto-starts: analyze impact → plan refactor steps
352
+ ```
353
+
354
+ ### Impact Analysis (no coding)
355
+
356
+ ```bash
357
+ aiflow use PROJ-88
358
+ claude # AI auto-starts: map dependencies → assess risk → output report
359
+ ```
360
+
361
+ ### Figma Design → Code
362
+
363
+ Turn a Figma design into a React / Next.js / Vue / Angular component automatically.
364
+
365
+ **Step 1: Set up Figma MCP adapter (one-time)**
366
+
367
+ Choose one option:
368
+
369
+ | Option | Command | Requirement |
370
+ |--------|---------|-------------|
371
+ | Figma Desktop (recommended) | `ak init -a figma-desktop` | Figma Desktop app installed and open |
372
+ | Figma REST API | `ak init -a figma` | Figma Personal Access Token (`figd_...`) |
373
+
374
+ ```bash
375
+ # Option A: Figma Desktop — no API token needed, uses Desktop session
376
+ ak init -a figma-desktop
377
+
378
+ # Option B: Figma REST API — requires Personal Access Token
379
+ ak init -a figma
380
+ # Enter your token when prompted (Settings → Security → Personal access tokens)
381
+ ```
382
+
383
+ **Step 2: Get the Figma node URL**
384
+
385
+ In Figma Desktop or web, right-click the frame/component → **Copy link to selection**.
386
+
387
+ URL format: `https://www.figma.com/design/<fileKey>/...?node-id=<nodeId>`
388
+
389
+ **Step 3: Trigger the skill in Claude**
390
+
391
+ ```
392
+ Generate component from this Figma frame:
393
+ https://www.figma.com/design/abc123/MyDesign?node-id=12:34
394
+ ```
395
+
396
+ Claude uses the `figma-to-component` skill and auto-detects your framework (Next.js App Router, React, Vue, Angular).
397
+
398
+ > Full guide: [docs/common/workflows/figma.md](./workflows/figma.md)
399
+
400
+ ---
401
+
402
+ ## All Commands
403
+
404
+ > **Tip:** All commands support a short alias. Use `ak` instead of `aiflow` and the alias instead of the full command name (e.g. `ak t st` = `ak task status`).
405
+
406
+ ```bash
407
+ # Setup
408
+ ak init --framework nestjs --adapter backlog # (ak i -f nestjs -a backlog)
409
+ ak init --fw spring-boot --with-rtk # --fw alias for --framework, RTK: bash compression (60–90%)
410
+ ak init --no-rtk # skip RTK setup
411
+ ak dr # health check (ak doctor)
412
+ ak g # multi-tool guide (ak guide)
413
+ ak g -f # architecture diagram (ak guide --flow)
414
+ ak g -c # command reference (ak guide --commands)
415
+ ak sync # sync aiflow instruction files (ak sync-skills)
416
+
417
+ # Per task
418
+ ak use PROJ-33 # load context (Fast Mode, default) — alias: ak u PROJ-33
419
+ ak use PROJ-33 PROJ-10 docs/arch.md # multi-target: primary + supplementary (v0.1.0+)
420
+ ak use PROJ-33 -F # Fast Mode explicit (--fast)
421
+ ak use PROJ-33 -U # Full Mode (--full)
422
+ ak use -f task.md # load from local file (--file)
423
+ ak use PROJ-33 -c # load with all comments (--coms)
424
+ ak use PROJ-33 --clast 5 # newest 5 comments
425
+ ak use -m # manual input (--manual)
426
+ ak fetch-links "<backlog-or-jira-url>" # fetch single link → JSON (used by AI runtime, v0.1.0+)
427
+ ak p bug-fix # generate prompt (ak prompt)
428
+ ak p feature -o p.md # save prompt to file (--output)
429
+ ak p -L vietnamese # Vietnamese prompt (--lang)
430
+ ak p -l # list prompt types (--list)
431
+
432
+ # Task management
433
+ ak t st # show active and pending tasks (ak task status)
434
+ ak t ls # list all saved tasks (ak task list)
435
+ ak t p # pause current task (ak task pause)
436
+ ak t p -n "waiting for PM" # pause with note (--note)
437
+ ak t sw PROJ-99 # switch to another task (ak task switch)
438
+ ak t r PROJ-33 # resume a paused task (ak task resume)
439
+ ak t rst PROJ-33 # reset to Gate 1 (ak task reset)
440
+ ak t rm PROJ-33 # permanently delete task data (ak task remove)
441
+ ak t n # approve gate & prep next session (ak task next)
442
+
443
+ # Context management
444
+ ak ctx show # view active context (ak context show)
445
+ ak ctx list # list saved contexts
446
+ ak ctx save my-snapshot # save named snapshot
447
+ ak ctx -l my-snapshot # load named snapshot (--load)
448
+ ak ctx clear # clear active context
449
+
450
+ # Team knowledge
451
+ ak mem s "key" "value" # save knowledge (ak memory save)
452
+ ak mem g "key" # retrieve (ak memory get)
453
+ ak mem sr "keyword" # search (ak memory search)
454
+ ak mem ls # list all (ak memory list)
455
+ ak mem d "key" # delete (ak memory delete)
456
+ ak mem cl # clear all (ak memory clear)
457
+
458
+ # Utilities
459
+ ak vl src/File.java # validate code (ak validate)
460
+ ak vl src/File.java -x # validate and auto-fix (--fix)
461
+ ak d "description" # detect task type (ak detect)
462
+
463
+ # Maintenance
464
+ ak rm # remove from project (ak remove)
465
+ ak rm -g # uninstall globally (--global)
466
+ ak up # update to latest (ak update)
467
+ ak up -f # force update (--force)
468
+ npm uninstall -g @relipa/ai-flow-kit # standard npm uninstall
469
+ ```
470
+
471
+ ---
472
+
473
+ ## Documentation Files
474
+
475
+ After installing `ai-flow-kit`, these docs are available:
476
+
477
+ | File | Description |
478
+ |------|-------------|
479
+ | [QUICK_START.md](./QUICK_START.md) | This file — step-by-step guide for developers |
480
+ | [AIFLOW.md](./AIFLOW.md) | Complete 5-Gate workflow: who does what, outputs, templates |
481
+ | [README.md](./README.md) | Package overview, architecture, all features |
482
+ | [CHANGELOG.md](./CHANGELOG.md) | Version history |
483
+ | [IMPLEMENTATION_SUMMARY.md](./IMPLEMENTATION_SUMMARY.md) | Technical implementation details |
484
+ | [workflows/](./workflows/) | Per-task-type workflow guides |
485
+ | [architecture.md](./architecture.md) | System architecture |
486
+ | [cli-reference.md](./cli-reference.md) | CLI command reference |
487
+ | [configuration.md](./configuration.md) | Configuration guide |
488
+ | [troubleshooting.md](./troubleshooting.md) | Common issues & fixes |
489
+ | [getting-started.md](./getting-started.md) | Getting started guide |
490
+
491
+ Access docs after install:
492
+ ```bash
493
+ # Docs are in the package directory
494
+ npm root -g # find global packages directory
495
+ # → <path>/@relipa/ai-flow-kit/AIFLOW.md, QUICK_START.md, etc.
496
+
497
+ # Or use the built-in guide
498
+ aiflow guide
499
+ ```
500
+
501
+ ---
502
+
503
+ ## Troubleshooting
504
+
505
+ **`aiflow` not found:**
506
+ ```bash
507
+ npm install -g @relipa/ai-flow-kit
508
+ ```
509
+
510
+ **Incorrect credentials:**
511
+ ```bash
512
+ # Re-running will prompt again; press Enter to keep the old value
513
+ aiflow init --adapter backlog
514
+ ```
515
+
516
+ **Context not loading:**
517
+ ```bash
518
+ # Check if credentials are saved
519
+ cat .aiflow/credentials.json
520
+
521
+ # Try loading again
522
+ aiflow use PROJ-33
523
+ ```
524
+
525
+ **Skills not working in Claude:**
526
+ ```bash
527
+ # init must be run outside the Claude terminal (once)
528
+ # Then reopen Claude
529
+ aiflow doctor
530
+ ```
531
+
532
+ **Need to see all available prompt types:**
533
+ ```bash
534
+ aiflow prompt --list
535
+ ```
536
+
537
+ See more: [docs/troubleshooting.md](./docs/troubleshooting.md)