@relipa/ai-flow-kit 0.1.0-beta.0 → 0.1.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/README.md +497 -497
  2. package/bin/aiflow.js +525 -525
  3. package/bin/ak.js +0 -0
  4. package/custom/mcp-presets/README.md +0 -0
  5. package/custom/mcp-presets/backlog.json +0 -0
  6. package/custom/mcp-presets/figma-desktop.json +0 -0
  7. package/custom/mcp-presets/figma.json +0 -0
  8. package/custom/mcp-presets/gitnexus.json +0 -0
  9. package/custom/mcp-presets/google-sheets.json +0 -0
  10. package/custom/mcp-presets/jira.json +0 -0
  11. package/custom/prompts/bug-fix.md +0 -0
  12. package/custom/prompts/feature.md +0 -0
  13. package/custom/prompts/investigation.md +0 -0
  14. package/custom/rules/code-style.md +0 -0
  15. package/custom/rules/java/code-style.md +0 -0
  16. package/custom/rules/java/naming.md +0 -0
  17. package/custom/rules/java/review-checklist.md +0 -0
  18. package/custom/rules/java/spring-boot-examples.md +0 -0
  19. package/custom/rules/javascript/code-style.md +0 -0
  20. package/custom/rules/javascript/naming.md +0 -0
  21. package/custom/rules/naming.md +0 -0
  22. package/custom/rules/php/code-style.md +0 -0
  23. package/custom/rules/php/naming.md +0 -0
  24. package/custom/rules/project-conventions.md +0 -0
  25. package/custom/rules/review-checklist.md +0 -0
  26. package/custom/skills/figma-to-component/SKILL.md +294 -207
  27. package/custom/skills/generate-spec/SKILL.md +0 -0
  28. package/custom/skills/impact-analysis/SKILL.md +0 -0
  29. package/custom/skills/investigate-bug/SKILL.md +0 -0
  30. package/custom/skills/read-study-requirement/SKILL.md +334 -334
  31. package/custom/skills/report-customer/SKILL.md +0 -0
  32. package/custom/skills/review-plan/SKILL.md +0 -0
  33. package/custom/templates/laravel.md +0 -0
  34. package/custom/templates/nestjs.md +0 -0
  35. package/custom/templates/nextjs.md +0 -0
  36. package/custom/templates/nodejs-express.md +0 -0
  37. package/custom/templates/php-plain.md +0 -0
  38. package/custom/templates/php.md +0 -0
  39. package/custom/templates/python-django.md +0 -0
  40. package/custom/templates/python-fastapi.md +0 -0
  41. package/custom/templates/python.md +0 -0
  42. package/custom/templates/reactjs.md +0 -0
  43. package/custom/templates/shared/gate-workflow.md +91 -91
  44. package/custom/templates/spring-boot.md +0 -0
  45. package/custom/templates/tools/claude.md +0 -0
  46. package/custom/templates/tools/copilot.md +0 -0
  47. package/custom/templates/tools/cursor.md +0 -0
  48. package/custom/templates/tools/gemini.md +0 -0
  49. package/custom/templates/tools/generic.md +0 -0
  50. package/custom/templates/vue-nuxt.md +0 -0
  51. package/docs/common/AIFLOW.md +0 -0
  52. package/docs/common/CHANGELOG.md +334 -334
  53. package/docs/common/QUICK_START.md +537 -537
  54. package/docs/common/ai-integration.md +0 -0
  55. package/docs/common/cli-reference.md +657 -657
  56. package/docs/common/configuration.md +0 -0
  57. package/docs/common/getting-started.md +0 -0
  58. package/docs/common/troubleshooting.md +0 -0
  59. package/docs/common/workflows/bug-fix.md +0 -0
  60. package/docs/common/workflows/feature.md +0 -0
  61. package/docs/common/workflows/figma.md +0 -0
  62. package/docs/common/workflows/impact-analysis.md +0 -0
  63. package/docs/common/workflows/investigation.md +0 -0
  64. package/docs/common/workflows/refactor.md +0 -0
  65. package/docs/project/ARCHITECTURE.md +0 -0
  66. package/index.js +0 -0
  67. package/package.json +68 -67
  68. package/scripts/checkpoint.js +0 -0
  69. package/scripts/config.js +0 -0
  70. package/scripts/context.js +0 -0
  71. package/scripts/create-score-excel.js +0 -0
  72. package/scripts/detect.js +0 -0
  73. package/scripts/doctor.js +26 -0
  74. package/scripts/gitnexus-worker.js +0 -0
  75. package/scripts/guide.js +314 -314
  76. package/scripts/hooks/block-git-write.js +0 -0
  77. package/scripts/hooks/session-start.js +315 -315
  78. package/scripts/hooks/session-stop.js +0 -0
  79. package/scripts/init.js +0 -0
  80. package/scripts/link-resolver.js +0 -0
  81. package/scripts/memory.js +0 -0
  82. package/scripts/prompt.js +95 -9
  83. package/scripts/remove.js +0 -0
  84. package/scripts/score_members.js +320 -0
  85. package/scripts/task.js +0 -0
  86. package/scripts/telemetry/cli.js +0 -0
  87. package/scripts/telemetry/config.js +0 -0
  88. package/scripts/telemetry/crypto.js +0 -0
  89. package/scripts/telemetry/flush.js +0 -0
  90. package/scripts/telemetry/record.js +0 -0
  91. package/scripts/update.js +0 -0
  92. package/scripts/use.js +1162 -1162
  93. package/scripts/validate.js +0 -0
  94. package/upstream/.claude-plugin/marketplace.json +0 -0
  95. package/upstream/.claude-plugin/plugin.json +0 -0
  96. package/upstream/.codex/INSTALL.md +0 -0
  97. package/upstream/.cursor-plugin/plugin.json +0 -0
  98. package/upstream/.gitattributes +0 -0
  99. package/upstream/.github/FUNDING.yml +0 -0
  100. package/upstream/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  101. package/upstream/.github/ISSUE_TEMPLATE/config.yml +0 -0
  102. package/upstream/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  103. package/upstream/.github/ISSUE_TEMPLATE/platform_support.md +0 -0
  104. package/upstream/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  105. package/upstream/.opencode/INSTALL.md +0 -0
  106. package/upstream/.opencode/plugins/superpowers.js +0 -0
  107. package/upstream/.version-bump.json +0 -0
  108. package/upstream/AGENTS.md +0 -0
  109. package/upstream/CHANGELOG.md +0 -0
  110. package/upstream/CLAUDE.md +0 -0
  111. package/upstream/CODE_OF_CONDUCT.md +0 -0
  112. package/upstream/GEMINI.md +0 -0
  113. package/upstream/LICENSE +0 -0
  114. package/upstream/README.md +0 -0
  115. package/upstream/RELEASE-NOTES.md +0 -0
  116. package/upstream/agents/code-reviewer.md +0 -0
  117. package/upstream/commands/brainstorm.md +0 -0
  118. package/upstream/commands/execute-plan.md +0 -0
  119. package/upstream/commands/write-plan.md +0 -0
  120. package/upstream/docs/README.codex.md +0 -0
  121. package/upstream/docs/README.opencode.md +0 -0
  122. package/upstream/docs/plans/2025-11-22-opencode-support-design.md +0 -0
  123. package/upstream/docs/plans/2025-11-22-opencode-support-implementation.md +0 -0
  124. package/upstream/docs/plans/2025-11-28-skills-improvements-from-user-feedback.md +0 -0
  125. package/upstream/docs/plans/2026-01-17-visual-brainstorming.md +0 -0
  126. package/upstream/docs/superpowers/plans/2026-01-22-document-review-system.md +0 -0
  127. package/upstream/docs/superpowers/plans/2026-02-19-visual-brainstorming-refactor.md +0 -0
  128. package/upstream/docs/superpowers/plans/2026-03-11-zero-dep-brainstorm-server.md +0 -0
  129. package/upstream/docs/superpowers/plans/2026-03-23-codex-app-compatibility.md +0 -0
  130. package/upstream/docs/superpowers/specs/2026-01-22-document-review-system-design.md +0 -0
  131. package/upstream/docs/superpowers/specs/2026-02-19-visual-brainstorming-refactor-design.md +0 -0
  132. package/upstream/docs/superpowers/specs/2026-03-11-zero-dep-brainstorm-server-design.md +0 -0
  133. package/upstream/docs/superpowers/specs/2026-03-23-codex-app-compatibility-design.md +0 -0
  134. package/upstream/docs/testing.md +0 -0
  135. package/upstream/docs/windows/polyglot-hooks.md +0 -0
  136. package/upstream/gemini-extension.json +0 -0
  137. package/upstream/hooks/hooks-cursor.json +0 -0
  138. package/upstream/hooks/hooks.json +0 -0
  139. package/upstream/hooks/run-hook.cmd +0 -0
  140. package/upstream/hooks/session-start +0 -0
  141. package/upstream/package.json +0 -0
  142. package/upstream/scripts/bump-version.sh +0 -0
  143. package/upstream/skills/brainstorming/SKILL.md +0 -0
  144. package/upstream/skills/brainstorming/scripts/frame-template.html +0 -0
  145. package/upstream/skills/brainstorming/scripts/helper.js +0 -0
  146. package/upstream/skills/brainstorming/scripts/server.cjs +0 -0
  147. package/upstream/skills/brainstorming/scripts/start-server.sh +0 -0
  148. package/upstream/skills/brainstorming/scripts/stop-server.sh +0 -0
  149. package/upstream/skills/brainstorming/spec-document-reviewer-prompt.md +0 -0
  150. package/upstream/skills/brainstorming/visual-companion.md +0 -0
  151. package/upstream/skills/dispatching-parallel-agents/SKILL.md +0 -0
  152. package/upstream/skills/executing-plans/SKILL.md +0 -0
  153. package/upstream/skills/finishing-a-development-branch/SKILL.md +0 -0
  154. package/upstream/skills/receiving-code-review/SKILL.md +0 -0
  155. package/upstream/skills/requesting-code-review/SKILL.md +0 -0
  156. package/upstream/skills/requesting-code-review/code-reviewer.md +0 -0
  157. package/upstream/skills/subagent-driven-development/SKILL.md +0 -0
  158. package/upstream/skills/subagent-driven-development/code-quality-reviewer-prompt.md +0 -0
  159. package/upstream/skills/subagent-driven-development/implementer-prompt.md +0 -0
  160. package/upstream/skills/subagent-driven-development/spec-reviewer-prompt.md +0 -0
  161. package/upstream/skills/systematic-debugging/CREATION-LOG.md +0 -0
  162. package/upstream/skills/systematic-debugging/SKILL.md +0 -0
  163. package/upstream/skills/systematic-debugging/condition-based-waiting-example.ts +0 -0
  164. package/upstream/skills/systematic-debugging/condition-based-waiting.md +0 -0
  165. package/upstream/skills/systematic-debugging/defense-in-depth.md +0 -0
  166. package/upstream/skills/systematic-debugging/find-polluter.sh +0 -0
  167. package/upstream/skills/systematic-debugging/root-cause-tracing.md +0 -0
  168. package/upstream/skills/systematic-debugging/test-academic.md +0 -0
  169. package/upstream/skills/systematic-debugging/test-pressure-1.md +0 -0
  170. package/upstream/skills/systematic-debugging/test-pressure-2.md +0 -0
  171. package/upstream/skills/systematic-debugging/test-pressure-3.md +0 -0
  172. package/upstream/skills/tdd-lean/SKILL.md +0 -0
  173. package/upstream/skills/test-driven-development/SKILL.md +0 -0
  174. package/upstream/skills/test-driven-development/testing-anti-patterns.md +0 -0
  175. package/upstream/skills/using-git-worktrees/SKILL.md +0 -0
  176. package/upstream/skills/using-superpowers/SKILL.md +0 -0
  177. package/upstream/skills/using-superpowers/references/codex-tools.md +0 -0
  178. package/upstream/skills/using-superpowers/references/copilot-tools.md +0 -0
  179. package/upstream/skills/using-superpowers/references/gemini-tools.md +0 -0
  180. package/upstream/skills/verification-before-completion/SKILL.md +0 -0
  181. package/upstream/skills/writing-plans/SKILL.md +0 -0
  182. package/upstream/skills/writing-plans/plan-document-reviewer-prompt.md +0 -0
  183. package/upstream/skills/writing-skills/SKILL.md +0 -0
  184. package/upstream/skills/writing-skills/anthropic-best-practices.md +0 -0
  185. package/upstream/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -0
  186. package/upstream/skills/writing-skills/graphviz-conventions.dot +0 -0
  187. package/upstream/skills/writing-skills/persuasion-principles.md +0 -0
  188. package/upstream/skills/writing-skills/render-graphs.js +0 -0
  189. package/upstream/skills/writing-skills/testing-skills-with-subagents.md +0 -0
  190. package/upstream/tests/brainstorm-server/package-lock.json +0 -0
  191. package/upstream/tests/brainstorm-server/package.json +0 -0
  192. package/upstream/tests/brainstorm-server/server.test.js +0 -0
  193. package/upstream/tests/brainstorm-server/windows-lifecycle.test.sh +0 -0
  194. package/upstream/tests/brainstorm-server/ws-protocol.test.js +0 -0
  195. package/upstream/tests/claude-code/README.md +0 -0
  196. package/upstream/tests/claude-code/analyze-token-usage.py +0 -0
  197. package/upstream/tests/claude-code/run-skill-tests.sh +0 -0
  198. package/upstream/tests/claude-code/test-document-review-system.sh +0 -0
  199. package/upstream/tests/claude-code/test-helpers.sh +0 -0
  200. package/upstream/tests/claude-code/test-subagent-driven-development-integration.sh +0 -0
  201. package/upstream/tests/claude-code/test-subagent-driven-development.sh +0 -0
  202. package/upstream/tests/explicit-skill-requests/prompts/action-oriented.txt +0 -0
  203. package/upstream/tests/explicit-skill-requests/prompts/after-planning-flow.txt +0 -0
  204. package/upstream/tests/explicit-skill-requests/prompts/claude-suggested-it.txt +0 -0
  205. package/upstream/tests/explicit-skill-requests/prompts/i-know-what-sdd-means.txt +0 -0
  206. package/upstream/tests/explicit-skill-requests/prompts/mid-conversation-execute-plan.txt +0 -0
  207. package/upstream/tests/explicit-skill-requests/prompts/please-use-brainstorming.txt +0 -0
  208. package/upstream/tests/explicit-skill-requests/prompts/skip-formalities.txt +0 -0
  209. package/upstream/tests/explicit-skill-requests/prompts/subagent-driven-development-please.txt +0 -0
  210. package/upstream/tests/explicit-skill-requests/prompts/use-systematic-debugging.txt +0 -0
  211. package/upstream/tests/explicit-skill-requests/run-all.sh +0 -0
  212. package/upstream/tests/explicit-skill-requests/run-claude-describes-sdd.sh +0 -0
  213. package/upstream/tests/explicit-skill-requests/run-extended-multiturn-test.sh +0 -0
  214. package/upstream/tests/explicit-skill-requests/run-haiku-test.sh +0 -0
  215. package/upstream/tests/explicit-skill-requests/run-multiturn-test.sh +0 -0
  216. package/upstream/tests/explicit-skill-requests/run-test.sh +0 -0
  217. package/upstream/tests/opencode/run-tests.sh +0 -0
  218. package/upstream/tests/opencode/setup.sh +0 -0
  219. package/upstream/tests/opencode/test-plugin-loading.sh +0 -0
  220. package/upstream/tests/opencode/test-priority.sh +0 -0
  221. package/upstream/tests/opencode/test-tools.sh +0 -0
  222. package/upstream/tests/skill-triggering/prompts/dispatching-parallel-agents.txt +0 -0
  223. package/upstream/tests/skill-triggering/prompts/executing-plans.txt +0 -0
  224. package/upstream/tests/skill-triggering/prompts/requesting-code-review.txt +0 -0
  225. package/upstream/tests/skill-triggering/prompts/systematic-debugging.txt +0 -0
  226. package/upstream/tests/skill-triggering/prompts/test-driven-development.txt +0 -0
  227. package/upstream/tests/skill-triggering/prompts/writing-plans.txt +0 -0
  228. package/upstream/tests/skill-triggering/run-all.sh +0 -0
  229. package/upstream/tests/skill-triggering/run-test.sh +0 -0
  230. package/upstream/tests/subagent-driven-dev/go-fractals/design.md +0 -0
  231. package/upstream/tests/subagent-driven-dev/go-fractals/plan.md +0 -0
  232. package/upstream/tests/subagent-driven-dev/go-fractals/scaffold.sh +0 -0
  233. package/upstream/tests/subagent-driven-dev/run-test.sh +0 -0
  234. package/upstream/tests/subagent-driven-dev/svelte-todo/design.md +0 -0
  235. package/upstream/tests/subagent-driven-dev/svelte-todo/plan.md +0 -0
  236. package/upstream/tests/subagent-driven-dev/svelte-todo/scaffold.sh +0 -0
@@ -1,334 +1,334 @@
1
- ---
2
- name: read-study-requirement
3
- description: Gate 1 — AI reads ticket from Backlog/Jira + reads source code, then uses collaborative Q&A and solution proposal. Adds impact analysis and effort estimate. Outputs requirement.md for DEV to approve.
4
- keywords: ticket, requirement, study, read, context, backlog, jira, analyze, understand, solution, estimate
5
- ---
6
-
7
- # Analyze Requirement — Gate 1
8
-
9
- > **GATE 1: Must run before any other gate. Auto-starts when ticket context exists.**
10
- >
11
- > Principle: AI actively participates in understanding requirements — reading ticket + source code, clarifying via collaborative dialogue, proposing solutions, analyzing impact, and estimating effort.
12
-
13
- ---
14
-
15
- ## Mode Selection
16
-
17
- Check `mode` in `.aiflow/context/current.json` before starting:
18
-
19
- | Mode | Trigger | Behaviour |
20
- |------|---------|-----------|
21
- | `fast` | `aiflow use TICKET --fast` | Jump to **[Fast Track](#fast-track-mode-fast)** below |
22
- | `full` | `aiflow use TICKET --full` | Use standard steps — full Q&A + all 6 sections |
23
- | `auto` (default) | `aiflow use TICKET` | Standard steps |
24
-
25
- ---
26
-
27
- ## Fast Track (mode: fast)
28
-
29
- > Target: Gate 1 complete in **< 5 minutes**, minimum token usage.
30
-
31
- ## Fast Mode Output Rules (CRITICAL)
32
-
33
- When creating `plan/[ticket-id]/summary.md` during Gate 1:
34
- - You must create the `summary.md` file after Gate 1 is APPROVED, to track session progress.
35
- - Keep `summary.md` concise. Only include short bullet points tracking Gates.
36
- - Do not write verbose implementation details in `summary.md` at Gate 1.
37
-
38
- 0. **Pre-flight — Sync with remote** (before reading any source file):
39
- - Run `git status --porcelain` to check for uncommitted changes.
40
- - Working tree clean → run `git pull --ff-only` to fetch the latest code.
41
- - Uncommitted changes detected → SKIP pull and notify DEV: `⚠️ Uncommitted changes detected — skipping git pull. Analysing local state.`
42
- - `git pull --ff-only` fails (branch diverged from remote) → notify DEV: `⚠️ Local branch diverged from remote — skipping pull. Resolve manually before next ticket.` Then continue with local state.
43
- 1. Read `.aiflow/context/current.json` — ticket title, description, acceptance criteria
44
- 2. Identify **directly affected files** from ticket text and file names only.
45
- DO NOT trace data flow or read unrelated source files.
46
- 3. Q&A: Ask at most **ONE** question if there is a blocking ambiguity.
47
- If the ticket + source file names make intent clear → skip Q&A entirely.
48
- Wait for answer before writing the requirement doc.
49
- 4. Output `plan/[ticket-id]/requirement.md` with **3 sections only**:
50
-
51
- ```markdown
52
- # Requirement: [Ticket ID] — [Title]
53
-
54
- **Date:** [YYYY-MM-DD] **Mode:** fast **Status:** ⏸️ Waiting for DEV Approval
55
-
56
- ## 1. Requirements Summary
57
- [2–4 sentence restatement of what needs to change and why]
58
-
59
- **Acceptance Criteria:**
60
- - [ ] [each AC from ticket]
61
-
62
- ## 3. Files to Create / Modify
63
- | Action | File | Change |
64
- |--------|------|--------|
65
- | Modify | [path] | [what changes] |
66
-
67
- ## 5. Effort Estimate
68
- | Task | Size |
69
- |------|------|
70
- | Tests | S/M/L |
71
- | Implementation | S/M/L |
72
- | **Total** | **S/M/L** |
73
- ```
74
-
75
- 5. Display Gate 1 prompt and wait for `APPROVED`.
76
-
77
- > After APPROVED, proceed to Gate 2. The lean doc is intentional — Gate 2 plan will fill in the details.
78
-
79
- ---
80
-
81
- ## Steps
82
-
83
- ### Step 1: Load Ticket & Read Source Code
84
-
85
- 0. **Pre-flight — Sync with remote** (run BEFORE reading any source file):
86
- - Run `git status --porcelain` first. Empty output = clean working tree.
87
- - Clean working tree → run `git pull --ff-only` to pull the latest code from remote. This guarantees the analysis is based on current source, not stale local state.
88
- - Uncommitted changes → SKIP pull and notify DEV: `⚠️ Uncommitted changes detected — skipping git pull. Analysing local state.`
89
- - `git pull --ff-only` fails because the branch has diverged → notify DEV: `⚠️ Local branch diverged from remote — skipping pull. Resolve manually before next ticket.` Continue with local state.
90
- - Repo has no remote tracking branch (detached HEAD or local-only branch) → skip silently and proceed.
91
- 1. Read `.aiflow/context/current.json` — ticket info from Backlog/Jira
92
- 2. **Supplementary Context:** If `current.json` has a `supplementaryContext[]` array, read each item and integrate it as supporting context for your analysis. Items may be:
93
- - `[ticket]` — linked tickets (related features, dependencies, parent tickets)
94
- - `[comment]` — specific comments from PM/QA/stakeholders
95
- - `[file]` — architecture docs, business logic specs, API references
96
- - `[text]` — any other supplementary information
97
-
98
- If you encounter a backlog/jira URL in the ticket description that is **not** already in `supplementaryContext[]`, run `ak fetch-links <url>` and use the JSON output in your analysis without saving.
99
- 3. Read `CLAUDE.md` — understand project architecture, tech stack, conventions
100
- 4. Read related source files — trace data flow, identify patterns, dependencies
101
- - **If GitNexus MCP is available** (`.mcp.json` has `gitnexus` entry): invoke GitNexus MCP tools instead of reading files directly — one call returns full context without multi-file exploration:
102
- - `gitnexus: context("ClassName")` → 360° view of a symbol (dependencies, callers, methods)
103
- - `gitnexus: query("keyword or description")` → hybrid search across codebase
104
- - Saves ~50% of token cost at this step vs reading files manually
105
- - **If task is a Bug Fix:** Invoke `superpowers:systematic-debugging` to trace root cause before proposing fixes.
106
- 5. Read ticket comments — additional context from PM/team
107
-
108
- Do this investigation **before** asking any questions. Come prepared.
109
-
110
- ---
111
-
112
- ### Step 2: Clarify Requirements via Q&A
113
-
114
- Ask clarifying questions directly — **one question at a time**, wait for the developer's response before asking the next.
115
-
116
- **When to ask:**
117
- - Business requirements are vague or ambiguous
118
- - Acceptance criteria are not measurable
119
- - Edge cases discovered in source code need input
120
- - Multiple approaches exist and the developer's preference matters
121
-
122
- **When NOT to ask:**
123
- - The ticket and source code together make the intent clear → proceed directly
124
-
125
- Once you have sufficient clarity, propose **2–3 solution approaches** with trade-offs and a recommendation:
126
- - Present options conversationally, lead with your recommendation
127
- - Get developer confirmation on the chosen approach
128
-
129
- **Do NOT proceed to Step 3 until the developer has confirmed the design direction.**
130
-
131
- > ⚠️ **DO NOT invoke `superpowers:brainstorming`** — brainstorming's terminal state invokes
132
- > `writing-plans` (Gate 2), which would bypass Gate 1's approval gate. All Q&A happens here.
133
-
134
- ---
135
-
136
- ### Step 3: Extend with Impact Analysis & Effort Estimate
137
-
138
- After the developer confirms the design direction (Step 2), extend with:
139
-
140
- **Impact Analysis:**
141
- - Which services, modules, and jobs are affected?
142
- - Any breaking changes to APIs, DB schema, or shared components?
143
- - Risk level: 🟢 Low / 🟡 Medium / 🔴 High
144
- - Mitigation for each risk
145
-
146
- **Effort Estimate:**
147
- - Break down into tasks: tests, implementation, migration
148
- - Size each task: S (< 1h) / M (1–4h) / L (4–8h) / XL (8h+, consider splitting)
149
- - If XL → suggest sub-task breakdown
150
-
151
- ---
152
-
153
- ### Step 4: Write Requirement Document
154
-
155
- Save to `plan/[ticket-id]/requirement.md`:
156
-
157
- ```markdown
158
- # Requirement: [Ticket ID] — [Title]
159
-
160
- **Date:** [YYYY-MM-DD]
161
- **Type:** [feature | bug-fix | refactor | investigation]
162
- **Status:** ⏸️ Waiting for DEV Approval
163
-
164
- ---
165
-
166
- ## 1. Requirements Summary
167
-
168
- ### Description
169
- [Clear technical restatement of the requirement, incorporating all clarifications from Q&A]
170
-
171
- ### Current Behavior / Business Goal
172
- [What exists now vs what is needed]
173
-
174
- ### Acceptance Criteria
175
- - [ ] [Criteria 1 — specific, measurable]
176
- - [ ] [Criteria 2]
177
-
178
- ### Context & Constraints
179
- [Environment, business rules, dependencies, deadlines]
180
-
181
- ---
182
-
183
- ## 2. Source Code Analysis
184
-
185
- ### Related Files
186
- | File | Role | Current State |
187
- |------|------|---------------|
188
- | [path] | [Controller/Service/...] | [what it does now] |
189
-
190
- ### Data Flow
191
- ```
192
- [Entry point] → [Service] → [Repository] → [DB/External]
193
- ```
194
-
195
- ### Existing Patterns to Follow
196
- [Patterns in the codebase this change must follow]
197
-
198
- ### Current Test Coverage
199
- | Area | Test File | Status |
200
- |------|-----------|--------|
201
- | [area] | [file] | [exists / missing] |
202
-
203
- ---
204
-
205
- ## 3. Proposed Solution
206
-
207
- ### Chosen Approach: [Name]
208
- [From brainstorming session — the approach the developer confirmed]
209
-
210
- ### Alternatives Considered
211
- | Option | Pros | Cons | Why Not Chosen |
212
- |--------|------|------|----------------|
213
- | [Option B] | ... | ... | ... |
214
-
215
- ### Files to Create / Modify
216
- | Action | File | Change |
217
- |--------|------|--------|
218
- | Create | [path] | [purpose] |
219
- | Modify | [path] | [what changes] |
220
-
221
- ### Database Changes
222
- | Table | Change | Details |
223
- |-------|--------|---------|
224
- | [table] | [migration type] | [description] |
225
-
226
- ---
227
-
228
- ## 4. Impact Analysis
229
-
230
- **Impact Level:** 🟢 Low / 🟡 Medium / 🔴 High
231
-
232
- | Area | Impact | Reason |
233
- |------|--------|--------|
234
- | [Module] | 🟢 None / 🟡 Minor / 🔴 Major | [why] |
235
-
236
- **Breaking Changes:**
237
- - [ ] None expected
238
- - [ ] [Breaking change if any]
239
-
240
- **Risks:**
241
- | Risk | Severity | Mitigation |
242
- |------|----------|------------|
243
- | [description] | Low / Medium / High | [mitigation] |
244
-
245
- ---
246
-
247
- ## 5. Effort Estimate
248
-
249
- | Task | Size | Notes |
250
- |------|------|-------|
251
- | Tests (TDD) | S/M/L | [N scenarios] |
252
- | Implementation | S/M/L | [complexity] |
253
- | Migration / Integration | S/M/L | [if applicable] |
254
- | **Total** | **S/M/L/XL** | |
255
-
256
- > S = <1h · M = 1–4h · L = 4–8h · XL = 8h+ (split recommended)
257
-
258
- **Sub-tasks (if XL):**
259
- - [ ] [Sub-task 1]
260
- - [ ] [Sub-task 2]
261
-
262
- ---
263
-
264
- ## 6. Testing Plan
265
-
266
- ### Unit Tests
267
- - [ ] [Scenario to test]
268
-
269
- ### Integration Tests
270
- - [ ] [API/service flow to test]
271
-
272
- ### Manual Test Cases
273
- - [ ] [Step-by-step]
274
- ```
275
-
276
- ---
277
-
278
- ### Step 5: Present to Developer
279
-
280
- ```
281
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
282
- ⏸️ GATE 1: REQUIREMENT DOCUMENT READY
283
-
284
- Ticket: [ticket-id] — [title]
285
- File: plan/[ticket-id]/requirement.md
286
-
287
- Summary:
288
- Type: [feature / bug-fix / refactor]
289
- Impact: [Low / Medium / High]
290
- Estimate: [S / M / L / XL]
291
- Approach: [one-line description]
292
-
293
- Please review the requirement document.
294
- → Type APPROVED to proceed to implementation plan
295
- → Or provide feedback to update the document
296
-
297
- ⚠️ I will NOT generate code until I receive "APPROVED".
298
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
299
- ```
300
-
301
- ---
302
-
303
- ### Step 6: Handle Feedback
304
-
305
- - DEV provides feedback → update `requirement.md` → re-show Gate 1 prompt
306
- - DEV types `APPROVED` → proceed to Gate 2 (Implementation Plan)
307
-
308
- ---
309
-
310
- ## What This Skill Delegates vs Owns
311
-
312
- | Concern | Handled by |
313
- |---------|-----------|
314
- | Q&A loop (one question at a time) | This skill (inline) |
315
- | Propose 2–3 solution approaches | This skill (inline) |
316
- | Root cause tracing (bug tasks) | `superpowers:systematic-debugging` |
317
- | Impact analysis | This skill |
318
- | Effort estimate | This skill |
319
- | requirement.md template & output | This skill |
320
- | Gate 1 APPROVED gate | This skill |
321
-
322
- ---
323
-
324
- ## Mandatory Rules
325
-
326
- - ❌ **DO NOT** invoke `superpowers:brainstorming` — its terminal state calls `writing-plans` and bypasses Gate 1 approval
327
- - ❌ **DO NOT** invoke `superpowers:writing-plans` — that belongs to Gate 2 (`generate-spec` skill)
328
- - ❌ **DO NOT** proceed past Step 2 if design is not confirmed by developer
329
- - ❌ **DO NOT** write code at any point in this skill
330
- - ❌ **DO NOT** skip impact analysis and effort estimate
331
- - ✅ **MUST** run `git status` + `git pull --ff-only` (Pre-flight) before reading source code, when working tree is clean
332
- - ✅ **MUST** read source code before Q&A begins
333
- - ✅ **MUST** save `plan/[ticket-id]/requirement.md`
334
- - ✅ **MUST** display Gate 1 prompt and wait for `APPROVED`
1
+ ---
2
+ name: read-study-requirement
3
+ description: Gate 1 — AI reads ticket from Backlog/Jira + reads source code, then uses collaborative Q&A and solution proposal. Adds impact analysis and effort estimate. Outputs requirement.md for DEV to approve.
4
+ keywords: ticket, requirement, study, read, context, backlog, jira, analyze, understand, solution, estimate
5
+ ---
6
+
7
+ # Analyze Requirement — Gate 1
8
+
9
+ > **GATE 1: Must run before any other gate. Auto-starts when ticket context exists.**
10
+ >
11
+ > Principle: AI actively participates in understanding requirements — reading ticket + source code, clarifying via collaborative dialogue, proposing solutions, analyzing impact, and estimating effort.
12
+
13
+ ---
14
+
15
+ ## Mode Selection
16
+
17
+ Check `mode` in `.aiflow/context/current.json` before starting:
18
+
19
+ | Mode | Trigger | Behaviour |
20
+ |------|---------|-----------|
21
+ | `fast` | `aiflow use TICKET --fast` | Jump to **[Fast Track](#fast-track-mode-fast)** below |
22
+ | `full` | `aiflow use TICKET --full` | Use standard steps — full Q&A + all 6 sections |
23
+ | `auto` (default) | `aiflow use TICKET` | Standard steps |
24
+
25
+ ---
26
+
27
+ ## Fast Track (mode: fast)
28
+
29
+ > Target: Gate 1 complete in **< 5 minutes**, minimum token usage.
30
+
31
+ ## Fast Mode Output Rules (CRITICAL)
32
+
33
+ When creating `plan/[ticket-id]/summary.md` during Gate 1:
34
+ - You must create the `summary.md` file after Gate 1 is APPROVED, to track session progress.
35
+ - Keep `summary.md` concise. Only include short bullet points tracking Gates.
36
+ - Do not write verbose implementation details in `summary.md` at Gate 1.
37
+
38
+ 0. **Pre-flight — Sync with remote** (before reading any source file):
39
+ - Run `git status --porcelain` to check for uncommitted changes.
40
+ - Working tree clean → run `git pull --ff-only` to fetch the latest code.
41
+ - Uncommitted changes detected → SKIP pull and notify DEV: `⚠️ Uncommitted changes detected — skipping git pull. Analysing local state.`
42
+ - `git pull --ff-only` fails (branch diverged from remote) → notify DEV: `⚠️ Local branch diverged from remote — skipping pull. Resolve manually before next ticket.` Then continue with local state.
43
+ 1. Read `.aiflow/context/current.json` — ticket title, description, acceptance criteria
44
+ 2. Identify **directly affected files** from ticket text and file names only.
45
+ DO NOT trace data flow or read unrelated source files.
46
+ 3. Q&A: Ask at most **ONE** question if there is a blocking ambiguity.
47
+ If the ticket + source file names make intent clear → skip Q&A entirely.
48
+ Wait for answer before writing the requirement doc.
49
+ 4. Output `plan/[ticket-id]/requirement.md` with **3 sections only**:
50
+
51
+ ```markdown
52
+ # Requirement: [Ticket ID] — [Title]
53
+
54
+ **Date:** [YYYY-MM-DD] **Mode:** fast **Status:** ⏸️ Waiting for DEV Approval
55
+
56
+ ## 1. Requirements Summary
57
+ [2–4 sentence restatement of what needs to change and why]
58
+
59
+ **Acceptance Criteria:**
60
+ - [ ] [each AC from ticket]
61
+
62
+ ## 3. Files to Create / Modify
63
+ | Action | File | Change |
64
+ |--------|------|--------|
65
+ | Modify | [path] | [what changes] |
66
+
67
+ ## 5. Effort Estimate
68
+ | Task | Size |
69
+ |------|------|
70
+ | Tests | S/M/L |
71
+ | Implementation | S/M/L |
72
+ | **Total** | **S/M/L** |
73
+ ```
74
+
75
+ 5. Display Gate 1 prompt and wait for `APPROVED`.
76
+
77
+ > After APPROVED, proceed to Gate 2. The lean doc is intentional — Gate 2 plan will fill in the details.
78
+
79
+ ---
80
+
81
+ ## Steps
82
+
83
+ ### Step 1: Load Ticket & Read Source Code
84
+
85
+ 0. **Pre-flight — Sync with remote** (run BEFORE reading any source file):
86
+ - Run `git status --porcelain` first. Empty output = clean working tree.
87
+ - Clean working tree → run `git pull --ff-only` to pull the latest code from remote. This guarantees the analysis is based on current source, not stale local state.
88
+ - Uncommitted changes → SKIP pull and notify DEV: `⚠️ Uncommitted changes detected — skipping git pull. Analysing local state.`
89
+ - `git pull --ff-only` fails because the branch has diverged → notify DEV: `⚠️ Local branch diverged from remote — skipping pull. Resolve manually before next ticket.` Continue with local state.
90
+ - Repo has no remote tracking branch (detached HEAD or local-only branch) → skip silently and proceed.
91
+ 1. Read `.aiflow/context/current.json` — ticket info from Backlog/Jira
92
+ 2. **Supplementary Context:** If `current.json` has a `supplementaryContext[]` array, read each item and integrate it as supporting context for your analysis. Items may be:
93
+ - `[ticket]` — linked tickets (related features, dependencies, parent tickets)
94
+ - `[comment]` — specific comments from PM/QA/stakeholders
95
+ - `[file]` — architecture docs, business logic specs, API references
96
+ - `[text]` — any other supplementary information
97
+
98
+ If you encounter a backlog/jira URL in the ticket description that is **not** already in `supplementaryContext[]`, run `ak fetch-links <url>` and use the JSON output in your analysis without saving.
99
+ 3. Read `CLAUDE.md` — understand project architecture, tech stack, conventions
100
+ 4. Read related source files — trace data flow, identify patterns, dependencies
101
+ - **If GitNexus MCP is available** (`.mcp.json` has `gitnexus` entry): invoke GitNexus MCP tools instead of reading files directly — one call returns full context without multi-file exploration:
102
+ - `gitnexus: context("ClassName")` → 360° view of a symbol (dependencies, callers, methods)
103
+ - `gitnexus: query("keyword or description")` → hybrid search across codebase
104
+ - Saves ~50% of token cost at this step vs reading files manually
105
+ - **If task is a Bug Fix:** Invoke `superpowers:systematic-debugging` to trace root cause before proposing fixes.
106
+ 5. Read ticket comments — additional context from PM/team
107
+
108
+ Do this investigation **before** asking any questions. Come prepared.
109
+
110
+ ---
111
+
112
+ ### Step 2: Clarify Requirements via Q&A
113
+
114
+ Ask clarifying questions directly — **one question at a time**, wait for the developer's response before asking the next.
115
+
116
+ **When to ask:**
117
+ - Business requirements are vague or ambiguous
118
+ - Acceptance criteria are not measurable
119
+ - Edge cases discovered in source code need input
120
+ - Multiple approaches exist and the developer's preference matters
121
+
122
+ **When NOT to ask:**
123
+ - The ticket and source code together make the intent clear → proceed directly
124
+
125
+ Once you have sufficient clarity, propose **2–3 solution approaches** with trade-offs and a recommendation:
126
+ - Present options conversationally, lead with your recommendation
127
+ - Get developer confirmation on the chosen approach
128
+
129
+ **Do NOT proceed to Step 3 until the developer has confirmed the design direction.**
130
+
131
+ > ⚠️ **DO NOT invoke `superpowers:brainstorming`** — brainstorming's terminal state invokes
132
+ > `writing-plans` (Gate 2), which would bypass Gate 1's approval gate. All Q&A happens here.
133
+
134
+ ---
135
+
136
+ ### Step 3: Extend with Impact Analysis & Effort Estimate
137
+
138
+ After the developer confirms the design direction (Step 2), extend with:
139
+
140
+ **Impact Analysis:**
141
+ - Which services, modules, and jobs are affected?
142
+ - Any breaking changes to APIs, DB schema, or shared components?
143
+ - Risk level: 🟢 Low / 🟡 Medium / 🔴 High
144
+ - Mitigation for each risk
145
+
146
+ **Effort Estimate:**
147
+ - Break down into tasks: tests, implementation, migration
148
+ - Size each task: S (< 1h) / M (1–4h) / L (4–8h) / XL (8h+, consider splitting)
149
+ - If XL → suggest sub-task breakdown
150
+
151
+ ---
152
+
153
+ ### Step 4: Write Requirement Document
154
+
155
+ Save to `plan/[ticket-id]/requirement.md`:
156
+
157
+ ```markdown
158
+ # Requirement: [Ticket ID] — [Title]
159
+
160
+ **Date:** [YYYY-MM-DD]
161
+ **Type:** [feature | bug-fix | refactor | investigation]
162
+ **Status:** ⏸️ Waiting for DEV Approval
163
+
164
+ ---
165
+
166
+ ## 1. Requirements Summary
167
+
168
+ ### Description
169
+ [Clear technical restatement of the requirement, incorporating all clarifications from Q&A]
170
+
171
+ ### Current Behavior / Business Goal
172
+ [What exists now vs what is needed]
173
+
174
+ ### Acceptance Criteria
175
+ - [ ] [Criteria 1 — specific, measurable]
176
+ - [ ] [Criteria 2]
177
+
178
+ ### Context & Constraints
179
+ [Environment, business rules, dependencies, deadlines]
180
+
181
+ ---
182
+
183
+ ## 2. Source Code Analysis
184
+
185
+ ### Related Files
186
+ | File | Role | Current State |
187
+ |------|------|---------------|
188
+ | [path] | [Controller/Service/...] | [what it does now] |
189
+
190
+ ### Data Flow
191
+ ```
192
+ [Entry point] → [Service] → [Repository] → [DB/External]
193
+ ```
194
+
195
+ ### Existing Patterns to Follow
196
+ [Patterns in the codebase this change must follow]
197
+
198
+ ### Current Test Coverage
199
+ | Area | Test File | Status |
200
+ |------|-----------|--------|
201
+ | [area] | [file] | [exists / missing] |
202
+
203
+ ---
204
+
205
+ ## 3. Proposed Solution
206
+
207
+ ### Chosen Approach: [Name]
208
+ [From brainstorming session — the approach the developer confirmed]
209
+
210
+ ### Alternatives Considered
211
+ | Option | Pros | Cons | Why Not Chosen |
212
+ |--------|------|------|----------------|
213
+ | [Option B] | ... | ... | ... |
214
+
215
+ ### Files to Create / Modify
216
+ | Action | File | Change |
217
+ |--------|------|--------|
218
+ | Create | [path] | [purpose] |
219
+ | Modify | [path] | [what changes] |
220
+
221
+ ### Database Changes
222
+ | Table | Change | Details |
223
+ |-------|--------|---------|
224
+ | [table] | [migration type] | [description] |
225
+
226
+ ---
227
+
228
+ ## 4. Impact Analysis
229
+
230
+ **Impact Level:** 🟢 Low / 🟡 Medium / 🔴 High
231
+
232
+ | Area | Impact | Reason |
233
+ |------|--------|--------|
234
+ | [Module] | 🟢 None / 🟡 Minor / 🔴 Major | [why] |
235
+
236
+ **Breaking Changes:**
237
+ - [ ] None expected
238
+ - [ ] [Breaking change if any]
239
+
240
+ **Risks:**
241
+ | Risk | Severity | Mitigation |
242
+ |------|----------|------------|
243
+ | [description] | Low / Medium / High | [mitigation] |
244
+
245
+ ---
246
+
247
+ ## 5. Effort Estimate
248
+
249
+ | Task | Size | Notes |
250
+ |------|------|-------|
251
+ | Tests (TDD) | S/M/L | [N scenarios] |
252
+ | Implementation | S/M/L | [complexity] |
253
+ | Migration / Integration | S/M/L | [if applicable] |
254
+ | **Total** | **S/M/L/XL** | |
255
+
256
+ > S = <1h · M = 1–4h · L = 4–8h · XL = 8h+ (split recommended)
257
+
258
+ **Sub-tasks (if XL):**
259
+ - [ ] [Sub-task 1]
260
+ - [ ] [Sub-task 2]
261
+
262
+ ---
263
+
264
+ ## 6. Testing Plan
265
+
266
+ ### Unit Tests
267
+ - [ ] [Scenario to test]
268
+
269
+ ### Integration Tests
270
+ - [ ] [API/service flow to test]
271
+
272
+ ### Manual Test Cases
273
+ - [ ] [Step-by-step]
274
+ ```
275
+
276
+ ---
277
+
278
+ ### Step 5: Present to Developer
279
+
280
+ ```
281
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
282
+ ⏸️ GATE 1: REQUIREMENT DOCUMENT READY
283
+
284
+ Ticket: [ticket-id] — [title]
285
+ File: plan/[ticket-id]/requirement.md
286
+
287
+ Summary:
288
+ Type: [feature / bug-fix / refactor]
289
+ Impact: [Low / Medium / High]
290
+ Estimate: [S / M / L / XL]
291
+ Approach: [one-line description]
292
+
293
+ Please review the requirement document.
294
+ → Type APPROVED to proceed to implementation plan
295
+ → Or provide feedback to update the document
296
+
297
+ ⚠️ I will NOT generate code until I receive "APPROVED".
298
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
299
+ ```
300
+
301
+ ---
302
+
303
+ ### Step 6: Handle Feedback
304
+
305
+ - DEV provides feedback → update `requirement.md` → re-show Gate 1 prompt
306
+ - DEV types `APPROVED` → proceed to Gate 2 (Implementation Plan)
307
+
308
+ ---
309
+
310
+ ## What This Skill Delegates vs Owns
311
+
312
+ | Concern | Handled by |
313
+ |---------|-----------|
314
+ | Q&A loop (one question at a time) | This skill (inline) |
315
+ | Propose 2–3 solution approaches | This skill (inline) |
316
+ | Root cause tracing (bug tasks) | `superpowers:systematic-debugging` |
317
+ | Impact analysis | This skill |
318
+ | Effort estimate | This skill |
319
+ | requirement.md template & output | This skill |
320
+ | Gate 1 APPROVED gate | This skill |
321
+
322
+ ---
323
+
324
+ ## Mandatory Rules
325
+
326
+ - ❌ **DO NOT** invoke `superpowers:brainstorming` — its terminal state calls `writing-plans` and bypasses Gate 1 approval
327
+ - ❌ **DO NOT** invoke `superpowers:writing-plans` — that belongs to Gate 2 (`generate-spec` skill)
328
+ - ❌ **DO NOT** proceed past Step 2 if design is not confirmed by developer
329
+ - ❌ **DO NOT** write code at any point in this skill
330
+ - ❌ **DO NOT** skip impact analysis and effort estimate
331
+ - ✅ **MUST** run `git status` + `git pull --ff-only` (Pre-flight) before reading source code, when working tree is clean
332
+ - ✅ **MUST** read source code before Q&A begins
333
+ - ✅ **MUST** save `plan/[ticket-id]/requirement.md`
334
+ - ✅ **MUST** display Gate 1 prompt and wait for `APPROVED`
File without changes