@su-record/vibe 2.5.7 → 2.5.8

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 (188) hide show
  1. package/CLAUDE.md +338 -338
  2. package/LICENSE +21 -21
  3. package/README.md +262 -262
  4. package/agents/build-error-resolver.md +115 -0
  5. package/agents/compounder.md +261 -261
  6. package/agents/diagrammer.md +178 -178
  7. package/agents/e2e-tester.md +266 -266
  8. package/agents/explorer.md +48 -48
  9. package/agents/implementer.md +54 -54
  10. package/agents/refactor-cleaner.md +143 -0
  11. package/agents/research/best-practices-agent.md +189 -189
  12. package/agents/research/codebase-patterns-agent.md +147 -147
  13. package/agents/research/framework-docs-agent.md +178 -178
  14. package/agents/research/security-advisory-agent.md +203 -203
  15. package/agents/review/architecture-reviewer.md +107 -107
  16. package/agents/review/complexity-reviewer.md +116 -116
  17. package/agents/review/data-integrity-reviewer.md +88 -88
  18. package/agents/review/git-history-reviewer.md +103 -103
  19. package/agents/review/performance-reviewer.md +86 -86
  20. package/agents/review/python-reviewer.md +150 -150
  21. package/agents/review/rails-reviewer.md +139 -139
  22. package/agents/review/react-reviewer.md +144 -144
  23. package/agents/review/security-reviewer.md +80 -80
  24. package/agents/review/simplicity-reviewer.md +140 -140
  25. package/agents/review/test-coverage-reviewer.md +116 -116
  26. package/agents/review/typescript-reviewer.md +127 -127
  27. package/agents/searcher.md +54 -54
  28. package/agents/simplifier.md +120 -120
  29. package/agents/tester.md +49 -49
  30. package/agents/ui-previewer.md +129 -129
  31. package/commands/vibe.analyze.md +356 -356
  32. package/commands/vibe.reason.md +329 -329
  33. package/commands/vibe.review.md +326 -326
  34. package/commands/vibe.run.md +1031 -1031
  35. package/commands/vibe.spec.md +1022 -1022
  36. package/commands/vibe.utils.md +296 -202
  37. package/commands/vibe.verify.md +375 -375
  38. package/dist/cli/collaborator.js +52 -52
  39. package/dist/cli/detect.js +32 -32
  40. package/dist/cli/index.js +112 -112
  41. package/dist/cli/llm.js +144 -144
  42. package/dist/cli/mcp.d.ts +49 -0
  43. package/dist/cli/mcp.d.ts.map +1 -0
  44. package/dist/cli/mcp.js +169 -0
  45. package/dist/cli/mcp.js.map +1 -0
  46. package/dist/lib/PythonParser.js +108 -108
  47. package/dist/lib/gemini-mcp.d.ts +10 -0
  48. package/dist/lib/gemini-mcp.d.ts.map +1 -0
  49. package/dist/lib/gemini-mcp.js +353 -0
  50. package/dist/lib/gemini-mcp.js.map +1 -0
  51. package/dist/lib/gpt-api.js +4 -4
  52. package/dist/lib/gpt-mcp.d.ts +10 -0
  53. package/dist/lib/gpt-mcp.d.ts.map +1 -0
  54. package/dist/lib/gpt-mcp.js +352 -0
  55. package/dist/lib/gpt-mcp.js.map +1 -0
  56. package/dist/lib/memory/KnowledgeGraph.js +4 -4
  57. package/dist/lib/memory/MemorySearch.js +20 -20
  58. package/dist/lib/memory/MemoryStorage.js +64 -64
  59. package/dist/tools/analytics/getUsageAnalytics.d.ts +10 -0
  60. package/dist/tools/analytics/getUsageAnalytics.d.ts.map +1 -0
  61. package/dist/tools/analytics/getUsageAnalytics.js +246 -0
  62. package/dist/tools/analytics/getUsageAnalytics.js.map +1 -0
  63. package/dist/tools/analytics/index.d.ts +5 -0
  64. package/dist/tools/analytics/index.d.ts.map +1 -0
  65. package/dist/tools/analytics/index.js +5 -0
  66. package/dist/tools/analytics/index.js.map +1 -0
  67. package/dist/tools/convention/analyzeComplexity.test.js +115 -115
  68. package/dist/tools/convention/getCodingGuide.d.ts +7 -0
  69. package/dist/tools/convention/getCodingGuide.d.ts.map +1 -0
  70. package/dist/tools/convention/getCodingGuide.js +69 -0
  71. package/dist/tools/convention/getCodingGuide.js.map +1 -0
  72. package/dist/tools/convention/validateCodeQuality.test.js +104 -104
  73. package/dist/tools/planning/analyzeRequirements.d.ts +9 -0
  74. package/dist/tools/planning/analyzeRequirements.d.ts.map +1 -0
  75. package/dist/tools/planning/analyzeRequirements.js +171 -0
  76. package/dist/tools/planning/analyzeRequirements.js.map +1 -0
  77. package/dist/tools/planning/createUserStories.d.ts +9 -0
  78. package/dist/tools/planning/createUserStories.d.ts.map +1 -0
  79. package/dist/tools/planning/createUserStories.js +124 -0
  80. package/dist/tools/planning/createUserStories.js.map +1 -0
  81. package/dist/tools/planning/featureRoadmap.d.ts +10 -0
  82. package/dist/tools/planning/featureRoadmap.d.ts.map +1 -0
  83. package/dist/tools/planning/featureRoadmap.js +207 -0
  84. package/dist/tools/planning/featureRoadmap.js.map +1 -0
  85. package/dist/tools/planning/generatePrd.d.ts +11 -0
  86. package/dist/tools/planning/generatePrd.d.ts.map +1 -0
  87. package/dist/tools/planning/generatePrd.js +161 -0
  88. package/dist/tools/planning/generatePrd.js.map +1 -0
  89. package/dist/tools/planning/index.d.ts +8 -0
  90. package/dist/tools/planning/index.d.ts.map +1 -0
  91. package/dist/tools/planning/index.js +8 -0
  92. package/dist/tools/planning/index.js.map +1 -0
  93. package/dist/tools/prompt/analyzePrompt.d.ts +7 -0
  94. package/dist/tools/prompt/analyzePrompt.d.ts.map +1 -0
  95. package/dist/tools/prompt/analyzePrompt.js +150 -0
  96. package/dist/tools/prompt/analyzePrompt.js.map +1 -0
  97. package/dist/tools/prompt/enhancePrompt.d.ts +8 -0
  98. package/dist/tools/prompt/enhancePrompt.d.ts.map +1 -0
  99. package/dist/tools/prompt/enhancePrompt.js +110 -0
  100. package/dist/tools/prompt/enhancePrompt.js.map +1 -0
  101. package/dist/tools/prompt/enhancePromptGemini.d.ts +8 -0
  102. package/dist/tools/prompt/enhancePromptGemini.d.ts.map +1 -0
  103. package/dist/tools/prompt/enhancePromptGemini.js +332 -0
  104. package/dist/tools/prompt/enhancePromptGemini.js.map +1 -0
  105. package/dist/tools/prompt/index.d.ts +7 -0
  106. package/dist/tools/prompt/index.d.ts.map +1 -0
  107. package/dist/tools/prompt/index.js +7 -0
  108. package/dist/tools/prompt/index.js.map +1 -0
  109. package/dist/tools/reasoning/applyReasoningFramework.d.ts +8 -0
  110. package/dist/tools/reasoning/applyReasoningFramework.d.ts.map +1 -0
  111. package/dist/tools/reasoning/applyReasoningFramework.js +266 -0
  112. package/dist/tools/reasoning/applyReasoningFramework.js.map +1 -0
  113. package/dist/tools/reasoning/index.d.ts +5 -0
  114. package/dist/tools/reasoning/index.d.ts.map +1 -0
  115. package/dist/tools/reasoning/index.js +5 -0
  116. package/dist/tools/reasoning/index.js.map +1 -0
  117. package/dist/tools/thinking/analyzeProblem.d.ts +7 -0
  118. package/dist/tools/thinking/analyzeProblem.d.ts.map +1 -0
  119. package/dist/tools/thinking/analyzeProblem.js +55 -0
  120. package/dist/tools/thinking/analyzeProblem.js.map +1 -0
  121. package/dist/tools/thinking/breakDownProblem.d.ts +8 -0
  122. package/dist/tools/thinking/breakDownProblem.d.ts.map +1 -0
  123. package/dist/tools/thinking/breakDownProblem.js +145 -0
  124. package/dist/tools/thinking/breakDownProblem.js.map +1 -0
  125. package/dist/tools/thinking/createThinkingChain.d.ts +7 -0
  126. package/dist/tools/thinking/createThinkingChain.d.ts.map +1 -0
  127. package/dist/tools/thinking/createThinkingChain.js +44 -0
  128. package/dist/tools/thinking/createThinkingChain.js.map +1 -0
  129. package/dist/tools/thinking/formatAsPlan.d.ts +9 -0
  130. package/dist/tools/thinking/formatAsPlan.d.ts.map +1 -0
  131. package/dist/tools/thinking/formatAsPlan.js +78 -0
  132. package/dist/tools/thinking/formatAsPlan.js.map +1 -0
  133. package/dist/tools/thinking/index.d.ts +10 -0
  134. package/dist/tools/thinking/index.d.ts.map +1 -0
  135. package/dist/tools/thinking/index.js +10 -0
  136. package/dist/tools/thinking/index.js.map +1 -0
  137. package/dist/tools/thinking/stepByStepAnalysis.d.ts +8 -0
  138. package/dist/tools/thinking/stepByStepAnalysis.d.ts.map +1 -0
  139. package/dist/tools/thinking/stepByStepAnalysis.js +63 -0
  140. package/dist/tools/thinking/stepByStepAnalysis.js.map +1 -0
  141. package/dist/tools/thinking/thinkAloudProcess.d.ts +8 -0
  142. package/dist/tools/thinking/thinkAloudProcess.d.ts.map +1 -0
  143. package/dist/tools/thinking/thinkAloudProcess.js +80 -0
  144. package/dist/tools/thinking/thinkAloudProcess.js.map +1 -0
  145. package/hooks/hooks.json +204 -195
  146. package/hooks/scripts/code-check.js +22 -22
  147. package/hooks/scripts/code-review.js +22 -22
  148. package/hooks/scripts/complexity.js +22 -22
  149. package/hooks/scripts/compound.js +23 -23
  150. package/hooks/scripts/context-save.js +33 -33
  151. package/hooks/scripts/llm-orchestrate.js +171 -171
  152. package/hooks/scripts/post-edit.js +97 -0
  153. package/hooks/scripts/recall.js +22 -22
  154. package/hooks/scripts/session-start.js +30 -30
  155. package/hooks/scripts/utils.js +97 -65
  156. package/languages/csharp-unity.md +515 -515
  157. package/languages/gdscript-godot.md +470 -470
  158. package/languages/ruby-rails.md +489 -489
  159. package/languages/typescript-angular.md +433 -433
  160. package/languages/typescript-astro.md +416 -416
  161. package/languages/typescript-electron.md +406 -406
  162. package/languages/typescript-nestjs.md +524 -524
  163. package/languages/typescript-svelte.md +407 -407
  164. package/languages/typescript-tauri.md +365 -365
  165. package/package.json +83 -83
  166. package/skills/context7-usage.md +102 -102
  167. package/skills/git-worktree.md +181 -181
  168. package/skills/parallel-research.md +77 -77
  169. package/skills/priority-todos.md +239 -239
  170. package/skills/tool-fallback.md +190 -190
  171. package/skills/vibe-capabilities.md +161 -161
  172. package/vibe/constitution.md +227 -227
  173. package/vibe/rules/core/communication-guide.md +98 -98
  174. package/vibe/rules/core/development-philosophy.md +52 -52
  175. package/vibe/rules/core/quick-start.md +102 -102
  176. package/vibe/rules/quality/bdd-contract-testing.md +393 -393
  177. package/vibe/rules/quality/checklist.md +276 -276
  178. package/vibe/rules/quality/testing-strategy.md +440 -440
  179. package/vibe/rules/standards/anti-patterns.md +541 -369
  180. package/vibe/rules/standards/code-structure.md +291 -291
  181. package/vibe/rules/standards/complexity-metrics.md +313 -313
  182. package/vibe/rules/standards/naming-conventions.md +198 -198
  183. package/vibe/setup.sh +31 -31
  184. package/vibe/templates/constitution-template.md +252 -252
  185. package/vibe/templates/contract-backend-template.md +526 -526
  186. package/vibe/templates/contract-frontend-template.md +599 -599
  187. package/vibe/templates/feature-template.md +96 -96
  188. package/vibe/templates/spec-template.md +221 -221
@@ -1,1022 +1,1022 @@
1
- ---
2
- description: Create SPEC document with Specification Agent
3
- argument-hint: "feature name"
4
- ---
5
-
6
- # /vibe.spec
7
-
8
- Create a SPEC document (Specification Agent).
9
-
10
- ## Usage
11
-
12
- ```
13
- /vibe.spec "feature-name" # Conversation mode (requirements gathering)
14
- /vibe.spec "docs/login-prd.md" # File path input (auto-detected)
15
- /vibe.spec + 📎 file attachment # Use attached file
16
- ```
17
-
18
- ## Input Mode Detection (Auto-detect)
19
-
20
- **Input priority:**
21
-
22
- ```
23
- 1. Attachment exists? → Use attached file
24
- 2. Argument is file path? (existence check) → Read file
25
- 3. Otherwise → Conversation mode (start with feature name)
26
- ```
27
-
28
- | Input | Result |
29
- |-------|--------|
30
- | 📎 Attached file | → Analyze attached file |
31
- | File path (exists) | → Read file (Read tool) |
32
- | Feature name | → Start conversation mode |
33
-
34
- **All supported files:**
35
- - Text: `.md`, `.txt`, `.rst`, `.html`, `.json`, `.yaml`, etc.
36
- - Documents: `.pdf` (page-by-page analysis)
37
- - Images: `.png`, `.jpg`, `.jpeg`, `.gif`, `.webp`, `.svg`, etc.
38
- - Notebooks: `.ipynb` (Jupyter)
39
- - **All formats Claude can read**
40
-
41
- **File input mode flow:**
42
-
43
- ```
44
- /vibe.spec "docs/login-prd.md"
45
-
46
- 📄 File loaded: docs/login-prd.md (2.3KB)
47
-
48
- 📋 Parsed requirements:
49
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
50
- Feature: Login
51
- - Email/password login
52
- - Social login (Google, Apple)
53
- - Password recovery
54
- - Auto login persistence
55
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
56
-
57
- ❓ Additional confirmation needed:
58
- 1. Session expiration time? (default: 24 hours)
59
- 2. Allow concurrent login?
60
- 3. Confirm tech stack? (current: React + Supabase)
61
-
62
- User: 1 hour, disallow, confirm
63
-
64
- ✅ Requirements confirmed → Run research → Generate SPEC → Review
65
- ```
66
-
67
- **Supported file formats:**
68
-
69
- | Format | Extension | Purpose |
70
- |--------|-----------|---------|
71
- | Markdown | `.md` | PRD, planning docs, README |
72
- | Text | `.txt` | Requirements list |
73
- | PDF | `.pdf` | Planning docs, design documents |
74
- | Image | `.png`, `.jpg`, `.jpeg`, `.webp` | Wireframes, UI design, screenshots |
75
-
76
- **Image input example:**
77
- ```
78
- /vibe.spec "designs/login-wireframe.png"
79
-
80
- 🖼️ Image analysis: designs/login-wireframe.png
81
-
82
- 📋 Detected UI elements:
83
- - Email input field
84
- - Password input field
85
- - "Login" button
86
- - "Forgot password" link
87
- - Social login buttons (Google, Apple)
88
-
89
- ❓ Confirmation needed:
90
- 1. Feature name? (e.g., "login")
91
- 2. Additional requirements?
92
-
93
- → Generate SPEC
94
- ```
95
-
96
- ## Rules Reference
97
-
98
- **Must follow `~/.claude/vibe/rules/` (global):**
99
- - `core/development-philosophy.md` - Surgical precision, simplicity
100
- - `core/quick-start.md` - Korean first, DRY, SRP
101
- - `core/communication-guide.md` - Communication principles
102
-
103
- ## Description
104
-
105
- Collect requirements through conversation with the user and create an **AI-executable PTCF structured SPEC document**.
106
-
107
- > **PTCF**: Persona, Task, Context, Format - Google Gemini prompt optimization framework
108
-
109
- ## External LLM Integration (GPT/Gemini)
110
-
111
- When GPT/Gemini are enabled, they are automatically utilized during SPEC creation:
112
-
113
- ```
114
- /vibe.spec "feature"
115
-
116
- [Claude] Draft SPEC
117
-
118
- [Parallel Research] GPT + Gemini + Claude agents (8 parallel)
119
-
120
- [SPEC Review] GPT + Gemini parallel review
121
-
122
- [Claude] Finalize SPEC
123
- ```
124
-
125
- **Setup:**
126
- ```bash
127
- vibe gpt auth # Enable GPT (OAuth)
128
- vibe gemini auth # Enable Gemini (OAuth)
129
- vibe status # Check current settings
130
- ```
131
-
132
- ## Process
133
-
134
- ### 0. Git Branch Setup (Automatic)
135
-
136
- **CRITICAL: Always create feature branch before starting SPEC**
137
-
138
- ```bash
139
- # Check current branch
140
- current=$(git branch --show-current 2>/dev/null || echo "main")
141
-
142
- # Sanitize feature name (spaces → hyphens, lowercase)
143
- branch_name="feature/$(echo "{feature-name}" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')"
144
-
145
- # Create feature branch if on main/master
146
- if [[ "$current" == "main" || "$current" == "master" ]]; then
147
- git checkout -b "$branch_name"
148
- echo "✅ Created and switched to: $branch_name"
149
- else
150
- echo "ℹ️ Already on feature branch: $current"
151
- echo " Continue on this branch? (Y/n)"
152
- # If user says no, create new branch
153
- fi
154
- ```
155
-
156
- **Rules:**
157
- - If on `main`/`master` → **Always** create `feature/{feature-name}` branch
158
- - If already on feature branch → Ask user to confirm or create new branch
159
- - Branch naming: `feature/passkey-auth`, `feature/dark-mode`, etc.
160
- - Git check BEFORE starting requirements gathering
161
-
162
- ### 1. Project Analysis
163
-
164
- **Existing project** (`vibe init`):
165
- - Source code analysis: `package.json`, `pyproject.toml`, `pubspec.yaml`, `go.mod`, etc.
166
- - Reference `CLAUDE.md` file (tech stack)
167
- - Infer framework from file structure
168
- - **Use `findSymbol` tool** to locate relevant existing implementations
169
-
170
- **New project** (`vibe init <project-name>`):
171
- - Suggest tech stack (2-3 options)
172
-
173
- ### 2. Collect Requirements via Conversation
174
-
175
- **Principles:**
176
- - Ask **one question at a time**
177
- - Present options **with numbers** + "Feel free to describe in your own words"
178
- - **Natural conversation** without fixed order
179
-
180
- **Required confirmations:**
181
- - Purpose (Why): Why is it needed?
182
- - User (Who): Who will use it?
183
- - Feature scope (What): What features are needed?
184
- - Tech stack: Confirm existing stack or suggest new
185
- - Design reference: UI/UX to reference
186
-
187
- ### 2.5. Reference Documents via config.json (MANDATORY after tech stack confirmed)
188
-
189
- **🚨 CRITICAL: Read config.json references IMMEDIATELY after tech stack is confirmed**
190
-
191
- Reference documents are automatically generated in `config.json` based on the stack detected during `vibe init`:
192
-
193
- ```json
194
- // .claude/vibe/config.json
195
- {
196
- "language": "ko",
197
- "stacks": [
198
- { "type": "typescript-react", "path": "package.json" }
199
- ],
200
- "references": {
201
- "rules": [
202
- "~/.claude/vibe/rules/code-quality.md",
203
- "~/.claude/vibe/rules/error-handling.md",
204
- "~/.claude/vibe/rules/security.md"
205
- ],
206
- "languages": [
207
- "~/.claude/vibe/languages/typescript-react.md"
208
- ],
209
- "templates": [
210
- "~/.claude/vibe/templates/spec-template.md",
211
- "~/.claude/vibe/templates/feature-template.md",
212
- "~/.claude/vibe/templates/constitution-template.md"
213
- ]
214
- }
215
- }
216
- ```
217
-
218
- **Workflow:**
219
-
220
- 1. Read `.claude/vibe/config.json`
221
- 2. Extract `references.languages[]` paths
222
- 3. Read each language document for stack-specific guidelines
223
-
224
- **Example:**
225
- ```bash
226
- # 1. Check references in config.json
227
- Read .claude/vibe/config.json
228
-
229
- # 2. Reference documents specified in references.languages
230
- Read ~/.claude/vibe/languages/typescript-react.md
231
- ```
232
-
233
- **Important:**
234
-
235
- - No manual mapping needed - config.json contains all reference paths
236
- - `config.json.references` is automatically referenced when running `/vibe.run`
237
- - Not copied to project (referenced from global package)
238
-
239
- ### 3. Parallel Research (v2.5.0) - MANDATORY AFTER requirements confirmed
240
-
241
- **🚨🚨🚨 ABSOLUTE RULE: YOU MUST USE BASH TOOL FOR RESEARCH 🚨🚨🚨**
242
-
243
- **STOP! Before doing ANY research, read this carefully:**
244
-
245
- 1. **DO NOT** use Task tool to spawn research agents
246
- 2. **DO NOT** use context7 MCP directly for research
247
- 3. **DO NOT** use WebSearch tool directly for research
248
- 4. **YOU MUST** use Bash tool to call llm-orchestrate.js directly
249
-
250
- **When to trigger:**
251
- 1. ✅ Feature type decided (e.g., "passkey authentication")
252
- 2. ✅ Tech stack confirmed (e.g., "React + Supabase")
253
- 3. ✅ Language guide copied (step 2.5)
254
- 4. ✅ Core requirements collected
255
-
256
- **→ IMMEDIATELY run these 4 Bash commands IN PARALLEL (all at once):**
257
-
258
- ```bash
259
- # Cross-platform path (works on Windows/macOS/Linux)
260
- VIBE_SCRIPTS="$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts"
261
-
262
- # 1. GPT: Best practices
263
- node "$VIBE_SCRIPTS/llm-orchestrate.js" gpt orchestrate-json "Best practices for [FEATURE] with [STACK]. Focus: architecture patterns, code conventions. Return JSON: {patterns: [], antiPatterns: [], libraries: []}"
264
-
265
- # 2. GPT: Security
266
- node "$VIBE_SCRIPTS/llm-orchestrate.js" gpt orchestrate-json "Security vulnerabilities for [FEATURE] with [STACK]. Focus: CVE database, known exploits. Return JSON: {vulnerabilities: [], mitigations: [], checklist: []}"
267
-
268
- # 3. Gemini: Best practices
269
- node "$VIBE_SCRIPTS/llm-orchestrate.js" gemini orchestrate-json "Best practices for [FEATURE] with [STACK]. Focus: latest trends, framework updates. Return JSON: {patterns: [], antiPatterns: [], libraries: []}"
270
-
271
- # 4. Gemini: Security
272
- node "$VIBE_SCRIPTS/llm-orchestrate.js" gemini orchestrate-json "Security advisories for [FEATURE] with [STACK]. Focus: latest patches, recent incidents. Return JSON: {advisories: [], patches: [], incidents: []}"
273
- ```
274
-
275
- **Concrete example - run all 4 in parallel:**
276
- ```bash
277
- # GPT best practices
278
- node "$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts/llm-orchestrate.js" gpt orchestrate-json "Best practices for passkey authentication with React, Supabase. Focus: architecture patterns, code conventions. Return JSON: {patterns: [], antiPatterns: [], libraries: []}"
279
-
280
- # GPT security
281
- node "$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts/llm-orchestrate.js" gpt orchestrate-json "Security vulnerabilities for passkey authentication with React, Supabase. Focus: CVE database, known exploits. Return JSON: {vulnerabilities: [], mitigations: [], checklist: []}"
282
-
283
- # Gemini best practices
284
- node "$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts/llm-orchestrate.js" gemini orchestrate-json "Best practices for passkey authentication with React, Supabase. Focus: latest trends, framework updates. Return JSON: {patterns: [], antiPatterns: [], libraries: []}"
285
-
286
- # Gemini security
287
- node "$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts/llm-orchestrate.js" gemini orchestrate-json "Security advisories for passkey authentication with React, Supabase. Focus: latest patches, recent incidents. Return JSON: {advisories: [], patches: [], incidents: []}"
288
- ```
289
-
290
- **ALSO run Claude research agents in parallel using Task tool:**
291
-
292
- | Claude Agent | Role | Source |
293
- |--------------|------|--------|
294
- | `best-practices-agent` | Best practices for [feature] + [stack] | WebSearch |
295
- | `framework-docs-agent` | Latest docs via context7 | context7 MCP |
296
- | `codebase-patterns-agent` | Similar patterns in existing codebase | Glob, Grep |
297
- | `security-advisory-agent` | Security advisories for [feature] | WebSearch |
298
-
299
- **Total: 4 GPT/Gemini calls (Bash) + 4 Claude agents (Task) = 8 parallel research tasks**
300
-
301
- **🚨 GPT/Gemini MUST be called via Bash with llm-orchestrate.js! 🚨**
302
-
303
- #### 3.1 Result Merge Rules
304
-
305
- | Area | Merge Strategy |
306
- |------|----------------|
307
- | Best Practices | Deduplicate, keep most detailed |
308
- | Security | ALL included (no dedup for safety) |
309
- | Libraries | Consensus recommendations |
310
-
311
- **IMPORTANT:**
312
- - ❌ DO NOT skip research step
313
- - ❌ DO NOT ask user "should I run research?"
314
- - ✅ ALWAYS run after requirements confirmed
315
- - ✅ Show "Running parallel research (Claude + GPT + Gemini)..." message
316
- - ✅ Include all agent + LLM results in SPEC Context
317
- - ✅ Run all 4 Bash LLM calls in parallel + 4 Task agents in parallel
318
-
319
- **Research results are reflected in SPEC's Context section.**
320
-
321
- ### 4. Write SPEC Document (PTCF Structure)
322
-
323
- #### 4.0 Large Scope Detection & Auto-Split (MANDATORY)
324
-
325
- **🚨 CRITICAL: Automatically split SPEC when scope is large**
326
-
327
- **❌ DO NOT ask user for confirmation - auto-split silently**
328
-
329
- **Detection criteria (ANY triggers split):**
330
-
331
- | Criteria | Threshold |
332
- |----------|-----------|
333
- | Phases | 5+ phases |
334
- | Files to create | 15+ files |
335
- | Platforms | 2+ platforms |
336
- | Major features | 4+ distinct features |
337
-
338
- **Auto-split output (SPEC + Feature files must match):**
339
-
340
- ```
341
- .claude/vibe/specs/{feature-name}/
342
- ├── _index.md # Master SPEC
343
- ├── phase-1-setup.md
344
- ├── phase-2-core.md
345
- └── ...
346
-
347
- .claude/vibe/features/{feature-name}/
348
- ├── _index.feature # Master Feature
349
- ├── phase-1-setup.feature
350
- ├── phase-2-core.feature
351
- └── ...
352
- ```
353
-
354
- **🚨 CRITICAL: Each SPEC phase file MUST have a matching Feature file**
355
-
356
- **Master SPEC (`_index.md`):**
357
-
358
- ```markdown
359
- # SPEC: {feature-name} (Master)
360
-
361
- ## Overview
362
- - Total phases: N
363
- - Dependencies: [list]
364
-
365
- ## Sub-SPECs
366
-
367
- | Order | SPEC File | Feature File | Status |
368
- |-------|-----------|--------------|--------|
369
- | 1 | phase-1-setup.md | phase-1-setup.feature | ⬜ |
370
- | 2 | phase-2-core.md | phase-2-core.feature | ⬜ |
371
-
372
- ## Shared Context
373
- - Tech Stack: [all phases]
374
- - Constraints: [all phases]
375
- ```
376
-
377
- **Master Feature (`_index.feature`):**
378
-
379
- ```markdown
380
- # Feature: {feature-name} (Master)
381
-
382
- **Master SPEC**: `.claude/vibe/specs/{feature-name}/_index.md`
383
-
384
- ## Sub-Features
385
-
386
- | Order | Feature File | SPEC File | Status |
387
- |-------|--------------|-----------|--------|
388
- | 1 | phase-1-setup.feature | phase-1-setup.md | ⬜ |
389
- | 2 | phase-2-core.feature | phase-2-core.md | ⬜ |
390
-
391
- ## Overall User Story
392
- **As a** {user}
393
- **I want** {complete feature}
394
- **So that** {value}
395
- ```
396
-
397
- **Small scope (default):**
398
-
399
- Create `.claude/vibe/specs/{feature-name}.md`:
400
-
401
- ```markdown
402
- # SPEC: {feature-name}
403
-
404
- ## Persona
405
- <role>
406
- Define AI role and expertise for implementation
407
- - Senior developer on the project
408
- - Follow existing code patterns
409
- - Write testable code
410
- </role>
411
-
412
- ## Context
413
- <context>
414
- ### Background
415
- - Why this feature is needed
416
- - Who will use it
417
-
418
- ### Tech Stack
419
- - Backend: {technology}
420
- - Frontend: {technology}
421
- - Database: {technology}
422
-
423
- ### Related Code
424
- - `src/xxx/`: Existing implementation to reference
425
- - `src/yyy/`: Files to modify
426
-
427
- ### Design Reference
428
- - {Reference app/service}
429
- </context>
430
-
431
- ## Task
432
- <task>
433
- ### Phase 1: {phase-name}
434
- 1. [ ] {specific task}
435
- - File: `path/to/file`
436
- - Verify: `command`
437
- 2. [ ] {specific task}
438
-
439
- ### Phase 2: {phase-name}
440
- 1. [ ] {specific task}
441
- 2. [ ] {specific task}
442
-
443
- ### Phase 3: Testing and Verification
444
- 1. [ ] Unit Tests
445
- 2. [ ] Integration Tests
446
- </task>
447
-
448
- ## Constraints
449
- <constraints>
450
- - Follow existing code patterns
451
- - Localize error messages
452
- - Separate configuration via environment variables
453
- - {other constraints}
454
- </constraints>
455
-
456
- ## Output Format
457
- <output_format>
458
- ### Files to Create
459
- - `path/to/new/file.ts`
460
- - `path/to/new/file.test.ts`
461
-
462
- ### Files to Modify
463
- - `path/to/existing/file.ts`
464
-
465
- ### Verification Commands
466
- - `npm test`
467
- - `npm run build`
468
- </output_format>
469
-
470
- ## Acceptance Criteria
471
- <acceptance>
472
- - [ ] {verifiable criterion 1}
473
- - [ ] {verifiable criterion 2}
474
- - [ ] All tests pass
475
- - [ ] Build succeeds
476
- </acceptance>
477
- ```
478
-
479
- ### 5. Create Feature File (BDD) - Required
480
-
481
- **🚨 CRITICAL: Feature files MUST match SPEC file structure**
482
-
483
- | SPEC Structure | Feature Structure |
484
- |----------------|-------------------|
485
- | Single file (`{feature}.md`) | Single file (`{feature}.feature`) |
486
- | Split (`{feature}/_index.md` + phases) | Split (`{feature}/_index.feature` + phases) |
487
-
488
- #### 5.1 Single File (Small Scope)
489
-
490
- Create `.claude/vibe/features/{feature-name}.feature`:
491
-
492
- **Creation rules:**
493
- 1. Convert each SPEC Acceptance Criteria → one Scenario
494
- 2. Include Happy Path (normal case) + Edge Case (exception case)
495
- 3. Follow Given-When-Then format
496
-
497
- ```markdown
498
- # Feature: {feature-name}
499
-
500
- **SPEC**: `.claude/vibe/specs/{feature-name}.md`
501
-
502
- ## User Story
503
- **As a** {user}
504
- **I want** {feature}
505
- **So that** {value}
506
-
507
- ## Scenarios
508
-
509
- ### Scenario 1: {Happy Path}
510
- \`\`\`gherkin
511
- Scenario: {title}
512
- Given {precondition}
513
- When {action}
514
- Then {result}
515
- \`\`\`
516
- **Verification**: SPEC AC #1
517
-
518
- ### Scenario 2: {Edge Case}
519
- ...
520
-
521
- ## Coverage
522
- | Scenario | SPEC AC | Status |
523
- |----------|---------|--------|
524
- | 1 | AC-1 | ⬜ |
525
- ```
526
-
527
- #### 5.2 Split Files (Large Scope)
528
-
529
- When SPEC is split into phases, Feature files MUST also be split:
530
-
531
- ```
532
- .claude/vibe/features/{feature-name}/
533
- ├── _index.feature # Master: links to all phase features
534
- ├── phase-1-setup.feature # Scenarios for phase-1-setup.md
535
- ├── phase-2-core.feature # Scenarios for phase-2-core.md
536
- └── ...
537
- ```
538
-
539
- **Phase Feature file structure:**
540
-
541
- ```markdown
542
- # Feature: {feature-name} - Phase {N}: {phase-name}
543
-
544
- **SPEC**: `.claude/vibe/specs/{feature-name}/phase-{N}-{name}.md`
545
- **Master Feature**: `.claude/vibe/features/{feature-name}/_index.feature`
546
-
547
- ## User Story (Phase Scope)
548
- **As a** {user}
549
- **I want** {phase-specific feature}
550
- **So that** {phase-specific value}
551
-
552
- ## Scenarios
553
-
554
- ### Scenario 1: {Phase Happy Path}
555
- ...
556
-
557
- ## Coverage
558
- | Scenario | SPEC AC | Status |
559
- |----------|---------|--------|
560
- | 1 | Phase {N} AC-1 | ⬜ |
561
- ```
562
-
563
- ### 6. Ambiguity Scan - Required
564
-
565
- After creating SPEC draft, **must perform systematic ambiguity check**.
566
-
567
- #### 6.1 Mandatory Check Categories
568
-
569
- | Category | Check Items | Red Flags |
570
- |----------|-------------|-----------|
571
- | **Functional Scope** | Missing features, unclear behavior | "etc.", "other", "if needed" |
572
- | **Data Model** | Undefined entities, relationships | Undefined types, missing fields |
573
- | **Non-Functional** | Performance, security requirements | Performance requirements without numbers |
574
- | **Edge Cases** | Boundary conditions, errors | 0 failure scenarios |
575
- | **Integration Points** | External APIs, contracts | API version/endpoint undefined |
576
- | **User Input** | Validation rules, limits | Input limits not specified |
577
- | **State Management** | State transitions, persistence | Missing state diagram |
578
-
579
- #### 6.2 Forbidden Ambiguous Terms
580
-
581
- If the following terms exist in SPEC, **clarification is mandatory**:
582
-
583
- | Forbidden Term | Replacement Method |
584
- |----------------|-------------------|
585
- | "appropriately", "properly" | Provide specific criteria (e.g., "within 3 seconds") |
586
- | "quickly", "rapidly" | Specify with numbers (e.g., "under 100ms") |
587
- | "various", "multiple" | List specific items |
588
- | "etc.", "other" | Specify complete list or limit scope |
589
- | "if needed", "depending on situation" | Specify conditions (e.g., "when credits < 10") |
590
- | "later", "in the future" | Explicitly exclude from current scope |
591
-
592
- #### 6.3 Check Process
593
-
594
- ```
595
- 1. Write SPEC draft
596
-
597
- 2. Auto-scan for forbidden terms
598
-
599
- 3. Review checklist by category
600
-
601
- 4. List discovered ambiguities
602
-
603
- 5. Auto-fixable items → Fix immediately
604
- Needs user confirmation → Ask question
605
-
606
- 6. Re-verify (repeat until 0 ambiguities)
607
- ```
608
-
609
- #### 6.4 Auto-Fix for Common Ambiguities
610
-
611
- | Ambiguity Type | Auto-Fix Method |
612
- |----------------|-----------------|
613
- | Timeout undefined | Apply default 30 seconds |
614
- | Retry count undefined | Apply default 3 retries |
615
- | Pagination undefined | Apply default 20 items/page |
616
- | Input length undefined | Text 500 chars, password 8-64 chars |
617
- | File size undefined | Image 5MB, video 100MB |
618
-
619
- #### 6.5 Ambiguity Output Format
620
-
621
- ```markdown
622
- ## 🔍 Ambiguity Scan Results
623
-
624
- ### Found Issues: 3
625
-
626
- #### 1. Functional Scope
627
- - ⚠️ "Login failure behavior" not defined
628
- → **Auto-fix**: Apply 5-minute lockout after 3 failures
629
- - ⚠️ "Session expiration handling" unclear
630
- → **Question**: Session expiration time? (30min/1hour/24hours)
631
-
632
- #### 2. Edge Cases
633
- - ⚠️ Concurrent login permission undefined
634
- → **Question**: Allow concurrent login? (Y/N)
635
-
636
- ### Auto-fixed: 1
637
- ### Needs clarification: 2
638
- ```
639
-
640
- ### 7. Quality Validation (Self-Check)
641
-
642
- **Must perform self-quality check after SPEC completion**
643
-
644
- #### 7.1 Quality Checklist (Required Items)
645
-
646
- | Category | Check Item | Weight |
647
- |----------|------------|--------|
648
- | **Completeness** | All user flows included in Task | 15% |
649
- | **Completeness** | All ACs converted to Feature scenarios | 10% |
650
- | **Clarity** | No ambiguous terms (e.g., "appropriately", "quickly") | 10% |
651
- | **Clarity** | All numbers/limits specified (e.g., "max 500 chars") | 10% |
652
- | **Testability** | All ACs are auto-testable | 10% |
653
- | **Security** | Authentication/authorization requirements defined | 10% |
654
- | **Security** | Sensitive data handling method specified | 5% |
655
- | **Error Handling** | Major failure scenarios defined | 10% |
656
- | **Error Handling** | User error messages specified | 5% |
657
- | **Performance** | Response time/throughput targets specified | 5% |
658
- | **Edge Cases** | Boundary condition handling defined | 5% |
659
- | **Dependencies** | External systems/APIs specified | 5% |
660
-
661
- #### 7.2 Quality Score Calculation
662
-
663
- ```
664
- Score = Σ(Check item met × Weight) / 100
665
-
666
- Grades:
667
- - 95-100: ✅ EXCELLENT - Ready to start implementation
668
- - 85-94: ✅ GOOD - Implementation possible (minor improvements recommended)
669
- - 70-84: ⚠️ FAIR - Improve before implementation
670
- - 0-69: ❌ POOR - Rewrite required
671
- ```
672
-
673
- #### 7.3 Quality Gate (Auto-verification)
674
-
675
- **Minimum 85 points required to proceed to next step (GPT+Gemini review)**
676
-
677
- ```
678
- SPEC writing complete
679
-
680
- [Calculate Quality Score]
681
-
682
- Score < 85? → Show missing items → Attempt auto-fix
683
-
684
- Score ≥ 85 → Proceed to GPT + Gemini review
685
- ```
686
-
687
- #### 7.4 Auto-Fix for Low Score
688
-
689
- If score is below 85, attempt automatic fixes:
690
-
691
- | Missing Item | Auto-Fix Method |
692
- |--------------|-----------------|
693
- | Missing AC | Auto-generate AC based on Task |
694
- | Numbers not specified | Apply project defaults (e.g., timeout 30s) |
695
- | Missing error handling | Add common error scenarios |
696
- | Missing performance targets | Apply industry standard criteria |
697
-
698
- ### 8. SPEC Review (GPT/Gemini) - Iterative Review Loop
699
-
700
- **Default: Iterative review until convergence (max 3 rounds)**
701
-
702
- ```bash
703
- /vibe.spec "feature" # Default: Iterative review (max 3 rounds)
704
- /vibe.spec "feature" --quick # Quick mode: Single review round
705
- ```
706
-
707
- **Iterative Review Flow:**
708
-
709
- ```
710
- SPEC Draft
711
-
712
- ┌─────────────────────────────────────────┐
713
- │ Round 1: GPT + Gemini parallel review │
714
- │ ↓ │
715
- │ Apply feedback → Update SPEC │
716
- │ ↓ │
717
- │ Round 2: Re-review updated SPEC │
718
- │ ↓ │
719
- │ Apply feedback → Update SPEC │
720
- │ ↓ │
721
- │ Round 3: Final review (if needed) │
722
- └─────────────────────────────────────────┘
723
-
724
- Convergence check:
725
- - Both models: "no major issues" → Done
726
- - Same feedback as previous round → Done
727
- - Max 3 rounds reached → Done
728
-
729
- Final SPEC + Feature files
730
- ```
731
-
732
- **Convergence Criteria:**
733
- - Both GPT and Gemini respond with no P1/P2 issues
734
- - Feedback is identical to previous round (no new improvements)
735
- - Maximum 3 rounds completed
736
-
737
- **After SPEC completion, external LLM review → Auto-apply:**
738
-
739
- ```
740
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
741
- 🔍 SPEC REVIEW
742
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
743
-
744
- [Step 1] Sending SPEC to Gemini/GPT...
745
- - Full SPEC content
746
- - Feature file (scenarios)
747
- - Project context
748
-
749
- [Step 2] Review feedback:
750
- ┌─────────────────────────────────────────┐
751
- │ 📝 SPEC Review Feedback │
752
- │ │
753
- │ 1. [Missing] Error handling scenarios │
754
- │ → Recommend adding "retry on network │
755
- │ error" │
756
- │ │
757
- │ 2. [Security] Auth token expiry │
758
- │ handling undefined │
759
- │ → Recommend adding refresh token │
760
- │ flow │
761
- │ │
762
- │ 3. [Edge] Concurrent login policy │
763
- │ undefined │
764
- │ → Need to specify existing session │
765
- │ handling method │
766
- └─────────────────────────────────────────┘
767
-
768
- [Step 3] Auto-applying...
769
- ✅ Added error handling Phase to SPEC Task
770
- ✅ Added token expiry scenario to Feature
771
- ✅ Added concurrent login policy to Constraints
772
-
773
- [Step 4] Re-verifying...
774
- ✅ Ambiguity Scan: 0 issues
775
- ✅ Quality Score: 95/100
776
-
777
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
778
- ✅ SPEC Review complete! 3 improvements applied
779
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
780
- ```
781
-
782
- **MUST: SPEC Review (Required) - GPT + Gemini Parallel Execution**
783
-
784
- 🚨 **Run GPT and Gemini in parallel for cross-validation to ensure quality**
785
-
786
- **Parallel execution (2 Bash calls simultaneously):**
787
-
788
- ```bash
789
- # Cross-platform path (works on Windows/macOS/Linux)
790
- VIBE_SCRIPTS="$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts"
791
-
792
- # GPT review (code patterns, architecture perspective)
793
- node "$VIBE_SCRIPTS/llm-orchestrate.js" gpt orchestrate-json "Review SPEC for [feature-name]. Stack: [stack]. Summary: [summary]. Check: completeness, error handling, security, edge cases."
794
-
795
- # Gemini review (latest docs, best practices perspective)
796
- node "$VIBE_SCRIPTS/llm-orchestrate.js" gemini orchestrate-json "Review SPEC for [feature-name]. Stack: [stack]. Summary: [summary]. Check: completeness, error handling, security, edge cases."
797
- ```
798
-
799
- **Important:**
800
-
801
- - **Must call both GPT and Gemini** (parallel execution)
802
- - Merge feedback from both models and apply to SPEC
803
- - If one model fails, apply only the remaining result
804
- - Don't send full SPEC, send only **key summary** (save tokens)
805
- - Parse JSON response and auto-apply to SPEC
806
-
807
- **Why parallel execution:**
808
-
809
- | Model | Strengths |
810
- |-------|-----------|
811
- | GPT | Code patterns, architecture, logic validation |
812
- | Gemini | Latest web info, doc search, best practices |
813
-
814
- **Result merge:** Combine feedback from both models for more thorough review
815
-
816
- **Review items:**
817
-
818
- | Category | Check Point |
819
- |----------|-------------|
820
- | Completeness | All user flows covered? |
821
- | Error Handling | Failure scenarios defined? |
822
- | Security | Auth/authorization/data protection? |
823
- | Edge Cases | Boundary conditions handled? |
824
- | Testability | ACs verifiable? |
825
-
826
- **Auto-apply rules:**
827
-
828
- | Feedback Type | Action |
829
- |---------------|--------|
830
- | Missing scenario | Auto-add to Feature |
831
- | Security considerations | Auto-add to Constraints |
832
- | Edge cases | Auto-add to Task Phase |
833
- | Lack of clarity | Supplement the section |
834
-
835
- **Fallback handling:**
836
- - On `"status": "fallback"` response → Skip and proceed to next step
837
- - On network error → Retry once then skip
838
-
839
- ## Output (MANDATORY File Creation)
840
-
841
- **🚨 CRITICAL: Files MUST be created in these EXACT paths. NO exceptions.**
842
-
843
- ### Small Scope (Single File)
844
-
845
- | File | Path | When |
846
- |------|------|------|
847
- | SPEC | `.claude/vibe/specs/{feature-name}.md` | After quality validation (Step 7) |
848
- | Feature | `.claude/vibe/features/{feature-name}.feature` | Immediately after SPEC |
849
-
850
- ### Large Scope (Split Files)
851
-
852
- | File | Path | When |
853
- |------|------|------|
854
- | Master SPEC | `.claude/vibe/specs/{feature-name}/_index.md` | After quality validation |
855
- | Phase SPEC | `.claude/vibe/specs/{feature-name}/phase-{N}-{name}.md` | Per phase |
856
- | Master Feature | `.claude/vibe/features/{feature-name}/_index.feature` | After Master SPEC |
857
- | Phase Feature | `.claude/vibe/features/{feature-name}/phase-{N}-{name}.feature` | Per phase SPEC |
858
-
859
- **❌ FORBIDDEN:**
860
-
861
- - Creating files in project root (e.g., `feature-name.md`)
862
- - Creating files outside `.claude/vibe/` directory
863
- - Skipping file creation
864
- - Using different file names than feature-name
865
- - Creating split SPEC without matching split Feature files
866
-
867
- **✅ REQUIRED:**
868
-
869
- - Use Write tool to create files
870
- - Verify directories exist (create if needed)
871
- - Confirm file creation in response
872
- - **Each SPEC file must have a matching Feature file**
873
-
874
- ### File Creation Template
875
-
876
- **Single file:**
877
- ```
878
- 1. Write .claude/vibe/specs/{feature-name}.md
879
- 2. Write .claude/vibe/features/{feature-name}.feature
880
- 3. Confirm: "✅ Created: specs/{feature-name}.md + features/{feature-name}.feature"
881
- ```
882
-
883
- **Split files:**
884
- ```
885
- 1. Write .claude/vibe/specs/{feature-name}/_index.md
886
- 2. Write .claude/vibe/specs/{feature-name}/phase-1-setup.md
887
- 3. Write .claude/vibe/specs/{feature-name}/phase-2-core.md
888
- 4. Write .claude/vibe/features/{feature-name}/_index.feature
889
- 5. Write .claude/vibe/features/{feature-name}/phase-1-setup.feature
890
- 6. Write .claude/vibe/features/{feature-name}/phase-2-core.feature
891
- 7. Confirm: "✅ Created: {N} SPEC files + {N} Feature files"
892
- ```
893
-
894
- ## Example
895
-
896
- ```
897
- User: /vibe.spec "brick-game"
898
-
899
- Claude:
900
- You're making a brick game! What style are you thinking of?
901
-
902
- 1. Classic Breakout style
903
- 2. Arkanoid (with power-up items)
904
- 3. Custom style with special gameplay
905
-
906
- Feel free to describe in your own words.
907
-
908
- User: 1
909
-
910
- Claude: What platform will it run on?
911
-
912
- 1. Web (browser)
913
- 2. Mobile (iOS/Android)
914
- 3. Desktop
915
-
916
- User: 1
917
-
918
- Claude:
919
- Here are tech stack suggestions for web game development:
920
-
921
- 1. **Phaser.js** (Recommended) - Game framework with built-in physics engine
922
- 2. **Canvas + JavaScript** - Lightweight with fine control
923
- 3. **PixiJS + Matter.js** - High-performance rendering
924
-
925
- User: 1
926
-
927
- Claude: What design style?
928
-
929
- 1. Retro pixel (Atari Breakout)
930
- 2. Neon graphics (Arkanoid)
931
- 3. Modern 3D effects
932
-
933
- User: 2
934
-
935
- [Conversation continues...]
936
-
937
- Claude: SPEC draft created. Running ambiguity scan.
938
-
939
- ## 🔍 Ambiguity Scan Results
940
-
941
- ### Functional Scope
942
- - ⚠️ Game over condition not defined (ball drop vs lives system)
943
- - ⚠️ Stage clear condition unclear
944
-
945
- ### Edge Cases
946
- - ⚠️ Ball reflection angle when hitting paddle edge
947
- - ⚠️ Multiple brick collision handling
948
-
949
- Please clarify the above items.
950
-
951
- User: 3 lives, clear when all bricks destroyed, edge reflects at 45 degrees
952
-
953
- Claude: Thank you. SPEC has been refined.
954
-
955
- 🔍 Re-check result: 0 ambiguities
956
- 📊 Quality score: 92/100 (A)
957
-
958
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
959
- 🔍 SPEC REVIEW (Gemini)
960
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
961
-
962
- 📤 Sending SPEC...
963
- 📝 Gemini feedback:
964
- 1. [Edge] Ball speed increase logic undefined
965
- 2. [Security] Need score manipulation prevention
966
-
967
- ✅ 2 improvements auto-applied
968
- 🔍 Re-verifying... ✅ Passed
969
-
970
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
971
- ✅ SPEC Complete!
972
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
973
-
974
- 📄 .claude/vibe/specs/brick-game.md (PTCF structure)
975
- 📄 .claude/vibe/features/brick-game.feature
976
- 📊 Quality score: 95/100 (A) ← Improved after review
977
- ```
978
-
979
- ## Vibe Tools (Semantic Analysis & Memory)
980
-
981
- ### Tool Invocation
982
- All tools are called via:
983
- ```bash
984
- node -e "import('@su-record/vibe/tools').then(t => t.TOOL_NAME({...args}).then(r => console.log(r.content[0].text)))"
985
- ```
986
-
987
- ### Recommended Tools for SPEC Creation
988
-
989
- | Tool | Purpose | When to Use |
990
- |------|---------|-------------|
991
- | `findSymbol` | Find symbol definitions | Locate existing implementations to reference |
992
- | `findReferences` | Find all references | Understand how existing code is used |
993
- | `analyzeComplexity` | Code complexity analysis | Evaluate complexity of code to modify |
994
- | `saveMemory` | Save important decisions | Store confirmed requirements, design decisions |
995
- | `recallMemory` | Recall saved memory | Retrieve previous project decisions |
996
-
997
- ### Example Tool Usage in SPEC Creation
998
-
999
- **1. Find existing auth implementation:**
1000
- ```bash
1001
- node -e "import('@su-record/vibe/tools').then(t => t.findSymbol({symbolName: 'login', searchPath: 'src/'}).then(r => console.log(r.content[0].text)))"
1002
- ```
1003
-
1004
- **2. Save confirmed requirements:**
1005
- ```bash
1006
- node -e "import('@su-record/vibe/tools').then(t => t.saveMemory({key: 'brick-game-requirements', value: 'Platform: Web, Stack: Phaser.js, Style: Neon', category: 'spec', projectPath: process.cwd()}).then(r => console.log(r.content[0].text)))"
1007
- ```
1008
-
1009
- **3. Recall previous decisions:**
1010
- ```bash
1011
- node -e "import('@su-record/vibe/tools').then(t => t.recallMemory({key: 'brick-game-requirements', projectPath: process.cwd()}).then(r => console.log(r.content[0].text)))"
1012
- ```
1013
-
1014
- ## Next Step
1015
-
1016
- ```
1017
- /vibe.run "brick-game"
1018
- ```
1019
-
1020
- ---
1021
-
1022
- ARGUMENTS: $ARGUMENTS
1
+ ---
2
+ description: Create SPEC document with Specification Agent
3
+ argument-hint: "feature name"
4
+ ---
5
+
6
+ # /vibe.spec
7
+
8
+ Create a SPEC document (Specification Agent).
9
+
10
+ ## Usage
11
+
12
+ ```
13
+ /vibe.spec "feature-name" # Conversation mode (requirements gathering)
14
+ /vibe.spec "docs/login-prd.md" # File path input (auto-detected)
15
+ /vibe.spec + 📎 file attachment # Use attached file
16
+ ```
17
+
18
+ ## Input Mode Detection (Auto-detect)
19
+
20
+ **Input priority:**
21
+
22
+ ```
23
+ 1. Attachment exists? → Use attached file
24
+ 2. Argument is file path? (existence check) → Read file
25
+ 3. Otherwise → Conversation mode (start with feature name)
26
+ ```
27
+
28
+ | Input | Result |
29
+ |-------|--------|
30
+ | 📎 Attached file | → Analyze attached file |
31
+ | File path (exists) | → Read file (Read tool) |
32
+ | Feature name | → Start conversation mode |
33
+
34
+ **All supported files:**
35
+ - Text: `.md`, `.txt`, `.rst`, `.html`, `.json`, `.yaml`, etc.
36
+ - Documents: `.pdf` (page-by-page analysis)
37
+ - Images: `.png`, `.jpg`, `.jpeg`, `.gif`, `.webp`, `.svg`, etc.
38
+ - Notebooks: `.ipynb` (Jupyter)
39
+ - **All formats Claude can read**
40
+
41
+ **File input mode flow:**
42
+
43
+ ```
44
+ /vibe.spec "docs/login-prd.md"
45
+
46
+ 📄 File loaded: docs/login-prd.md (2.3KB)
47
+
48
+ 📋 Parsed requirements:
49
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
50
+ Feature: Login
51
+ - Email/password login
52
+ - Social login (Google, Apple)
53
+ - Password recovery
54
+ - Auto login persistence
55
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
56
+
57
+ ❓ Additional confirmation needed:
58
+ 1. Session expiration time? (default: 24 hours)
59
+ 2. Allow concurrent login?
60
+ 3. Confirm tech stack? (current: React + Supabase)
61
+
62
+ User: 1 hour, disallow, confirm
63
+
64
+ ✅ Requirements confirmed → Run research → Generate SPEC → Review
65
+ ```
66
+
67
+ **Supported file formats:**
68
+
69
+ | Format | Extension | Purpose |
70
+ |--------|-----------|---------|
71
+ | Markdown | `.md` | PRD, planning docs, README |
72
+ | Text | `.txt` | Requirements list |
73
+ | PDF | `.pdf` | Planning docs, design documents |
74
+ | Image | `.png`, `.jpg`, `.jpeg`, `.webp` | Wireframes, UI design, screenshots |
75
+
76
+ **Image input example:**
77
+ ```
78
+ /vibe.spec "designs/login-wireframe.png"
79
+
80
+ 🖼️ Image analysis: designs/login-wireframe.png
81
+
82
+ 📋 Detected UI elements:
83
+ - Email input field
84
+ - Password input field
85
+ - "Login" button
86
+ - "Forgot password" link
87
+ - Social login buttons (Google, Apple)
88
+
89
+ ❓ Confirmation needed:
90
+ 1. Feature name? (e.g., "login")
91
+ 2. Additional requirements?
92
+
93
+ → Generate SPEC
94
+ ```
95
+
96
+ ## Rules Reference
97
+
98
+ **Must follow `~/.claude/vibe/rules/` (global):**
99
+ - `core/development-philosophy.md` - Surgical precision, simplicity
100
+ - `core/quick-start.md` - Korean first, DRY, SRP
101
+ - `core/communication-guide.md` - Communication principles
102
+
103
+ ## Description
104
+
105
+ Collect requirements through conversation with the user and create an **AI-executable PTCF structured SPEC document**.
106
+
107
+ > **PTCF**: Persona, Task, Context, Format - Google Gemini prompt optimization framework
108
+
109
+ ## External LLM Integration (GPT/Gemini)
110
+
111
+ When GPT/Gemini are enabled, they are automatically utilized during SPEC creation:
112
+
113
+ ```
114
+ /vibe.spec "feature"
115
+
116
+ [Claude] Draft SPEC
117
+
118
+ [Parallel Research] GPT + Gemini + Claude agents (8 parallel)
119
+
120
+ [SPEC Review] GPT + Gemini parallel review
121
+
122
+ [Claude] Finalize SPEC
123
+ ```
124
+
125
+ **Setup:**
126
+ ```bash
127
+ vibe gpt auth # Enable GPT (OAuth)
128
+ vibe gemini auth # Enable Gemini (OAuth)
129
+ vibe status # Check current settings
130
+ ```
131
+
132
+ ## Process
133
+
134
+ ### 0. Git Branch Setup (Automatic)
135
+
136
+ **CRITICAL: Always create feature branch before starting SPEC**
137
+
138
+ ```bash
139
+ # Check current branch
140
+ current=$(git branch --show-current 2>/dev/null || echo "main")
141
+
142
+ # Sanitize feature name (spaces → hyphens, lowercase)
143
+ branch_name="feature/$(echo "{feature-name}" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')"
144
+
145
+ # Create feature branch if on main/master
146
+ if [[ "$current" == "main" || "$current" == "master" ]]; then
147
+ git checkout -b "$branch_name"
148
+ echo "✅ Created and switched to: $branch_name"
149
+ else
150
+ echo "ℹ️ Already on feature branch: $current"
151
+ echo " Continue on this branch? (Y/n)"
152
+ # If user says no, create new branch
153
+ fi
154
+ ```
155
+
156
+ **Rules:**
157
+ - If on `main`/`master` → **Always** create `feature/{feature-name}` branch
158
+ - If already on feature branch → Ask user to confirm or create new branch
159
+ - Branch naming: `feature/passkey-auth`, `feature/dark-mode`, etc.
160
+ - Git check BEFORE starting requirements gathering
161
+
162
+ ### 1. Project Analysis
163
+
164
+ **Existing project** (`vibe init`):
165
+ - Source code analysis: `package.json`, `pyproject.toml`, `pubspec.yaml`, `go.mod`, etc.
166
+ - Reference `CLAUDE.md` file (tech stack)
167
+ - Infer framework from file structure
168
+ - **Use `findSymbol` tool** to locate relevant existing implementations
169
+
170
+ **New project** (`vibe init <project-name>`):
171
+ - Suggest tech stack (2-3 options)
172
+
173
+ ### 2. Collect Requirements via Conversation
174
+
175
+ **Principles:**
176
+ - Ask **one question at a time**
177
+ - Present options **with numbers** + "Feel free to describe in your own words"
178
+ - **Natural conversation** without fixed order
179
+
180
+ **Required confirmations:**
181
+ - Purpose (Why): Why is it needed?
182
+ - User (Who): Who will use it?
183
+ - Feature scope (What): What features are needed?
184
+ - Tech stack: Confirm existing stack or suggest new
185
+ - Design reference: UI/UX to reference
186
+
187
+ ### 2.5. Reference Documents via config.json (MANDATORY after tech stack confirmed)
188
+
189
+ **🚨 CRITICAL: Read config.json references IMMEDIATELY after tech stack is confirmed**
190
+
191
+ Reference documents are automatically generated in `config.json` based on the stack detected during `vibe init`:
192
+
193
+ ```json
194
+ // .claude/vibe/config.json
195
+ {
196
+ "language": "ko",
197
+ "stacks": [
198
+ { "type": "typescript-react", "path": "package.json" }
199
+ ],
200
+ "references": {
201
+ "rules": [
202
+ "~/.claude/vibe/rules/code-quality.md",
203
+ "~/.claude/vibe/rules/error-handling.md",
204
+ "~/.claude/vibe/rules/security.md"
205
+ ],
206
+ "languages": [
207
+ "~/.claude/vibe/languages/typescript-react.md"
208
+ ],
209
+ "templates": [
210
+ "~/.claude/vibe/templates/spec-template.md",
211
+ "~/.claude/vibe/templates/feature-template.md",
212
+ "~/.claude/vibe/templates/constitution-template.md"
213
+ ]
214
+ }
215
+ }
216
+ ```
217
+
218
+ **Workflow:**
219
+
220
+ 1. Read `.claude/vibe/config.json`
221
+ 2. Extract `references.languages[]` paths
222
+ 3. Read each language document for stack-specific guidelines
223
+
224
+ **Example:**
225
+ ```bash
226
+ # 1. Check references in config.json
227
+ Read .claude/vibe/config.json
228
+
229
+ # 2. Reference documents specified in references.languages
230
+ Read ~/.claude/vibe/languages/typescript-react.md
231
+ ```
232
+
233
+ **Important:**
234
+
235
+ - No manual mapping needed - config.json contains all reference paths
236
+ - `config.json.references` is automatically referenced when running `/vibe.run`
237
+ - Not copied to project (referenced from global package)
238
+
239
+ ### 3. Parallel Research (v2.5.0) - MANDATORY AFTER requirements confirmed
240
+
241
+ **🚨🚨🚨 ABSOLUTE RULE: YOU MUST USE BASH TOOL FOR RESEARCH 🚨🚨🚨**
242
+
243
+ **STOP! Before doing ANY research, read this carefully:**
244
+
245
+ 1. **DO NOT** use Task tool to spawn research agents
246
+ 2. **DO NOT** use context7 MCP directly for research
247
+ 3. **DO NOT** use WebSearch tool directly for research
248
+ 4. **YOU MUST** use Bash tool to call llm-orchestrate.js directly
249
+
250
+ **When to trigger:**
251
+ 1. ✅ Feature type decided (e.g., "passkey authentication")
252
+ 2. ✅ Tech stack confirmed (e.g., "React + Supabase")
253
+ 3. ✅ Language guide copied (step 2.5)
254
+ 4. ✅ Core requirements collected
255
+
256
+ **→ IMMEDIATELY run these 4 Bash commands IN PARALLEL (all at once):**
257
+
258
+ ```bash
259
+ # Cross-platform path (works on Windows/macOS/Linux)
260
+ VIBE_SCRIPTS="$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts"
261
+
262
+ # 1. GPT: Best practices
263
+ node "$VIBE_SCRIPTS/llm-orchestrate.js" gpt orchestrate-json "Best practices for [FEATURE] with [STACK]. Focus: architecture patterns, code conventions. Return JSON: {patterns: [], antiPatterns: [], libraries: []}"
264
+
265
+ # 2. GPT: Security
266
+ node "$VIBE_SCRIPTS/llm-orchestrate.js" gpt orchestrate-json "Security vulnerabilities for [FEATURE] with [STACK]. Focus: CVE database, known exploits. Return JSON: {vulnerabilities: [], mitigations: [], checklist: []}"
267
+
268
+ # 3. Gemini: Best practices
269
+ node "$VIBE_SCRIPTS/llm-orchestrate.js" gemini orchestrate-json "Best practices for [FEATURE] with [STACK]. Focus: latest trends, framework updates. Return JSON: {patterns: [], antiPatterns: [], libraries: []}"
270
+
271
+ # 4. Gemini: Security
272
+ node "$VIBE_SCRIPTS/llm-orchestrate.js" gemini orchestrate-json "Security advisories for [FEATURE] with [STACK]. Focus: latest patches, recent incidents. Return JSON: {advisories: [], patches: [], incidents: []}"
273
+ ```
274
+
275
+ **Concrete example - run all 4 in parallel:**
276
+ ```bash
277
+ # GPT best practices
278
+ node "$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts/llm-orchestrate.js" gpt orchestrate-json "Best practices for passkey authentication with React, Supabase. Focus: architecture patterns, code conventions. Return JSON: {patterns: [], antiPatterns: [], libraries: []}"
279
+
280
+ # GPT security
281
+ node "$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts/llm-orchestrate.js" gpt orchestrate-json "Security vulnerabilities for passkey authentication with React, Supabase. Focus: CVE database, known exploits. Return JSON: {vulnerabilities: [], mitigations: [], checklist: []}"
282
+
283
+ # Gemini best practices
284
+ node "$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts/llm-orchestrate.js" gemini orchestrate-json "Best practices for passkey authentication with React, Supabase. Focus: latest trends, framework updates. Return JSON: {patterns: [], antiPatterns: [], libraries: []}"
285
+
286
+ # Gemini security
287
+ node "$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts/llm-orchestrate.js" gemini orchestrate-json "Security advisories for passkey authentication with React, Supabase. Focus: latest patches, recent incidents. Return JSON: {advisories: [], patches: [], incidents: []}"
288
+ ```
289
+
290
+ **ALSO run Claude research agents in parallel using Task tool:**
291
+
292
+ | Claude Agent | Role | Source |
293
+ |--------------|------|--------|
294
+ | `best-practices-agent` | Best practices for [feature] + [stack] | WebSearch |
295
+ | `framework-docs-agent` | Latest docs via context7 | context7 MCP |
296
+ | `codebase-patterns-agent` | Similar patterns in existing codebase | Glob, Grep |
297
+ | `security-advisory-agent` | Security advisories for [feature] | WebSearch |
298
+
299
+ **Total: 4 GPT/Gemini calls (Bash) + 4 Claude agents (Task) = 8 parallel research tasks**
300
+
301
+ **🚨 GPT/Gemini MUST be called via Bash with llm-orchestrate.js! 🚨**
302
+
303
+ #### 3.1 Result Merge Rules
304
+
305
+ | Area | Merge Strategy |
306
+ |------|----------------|
307
+ | Best Practices | Deduplicate, keep most detailed |
308
+ | Security | ALL included (no dedup for safety) |
309
+ | Libraries | Consensus recommendations |
310
+
311
+ **IMPORTANT:**
312
+ - ❌ DO NOT skip research step
313
+ - ❌ DO NOT ask user "should I run research?"
314
+ - ✅ ALWAYS run after requirements confirmed
315
+ - ✅ Show "Running parallel research (Claude + GPT + Gemini)..." message
316
+ - ✅ Include all agent + LLM results in SPEC Context
317
+ - ✅ Run all 4 Bash LLM calls in parallel + 4 Task agents in parallel
318
+
319
+ **Research results are reflected in SPEC's Context section.**
320
+
321
+ ### 4. Write SPEC Document (PTCF Structure)
322
+
323
+ #### 4.0 Large Scope Detection & Auto-Split (MANDATORY)
324
+
325
+ **🚨 CRITICAL: Automatically split SPEC when scope is large**
326
+
327
+ **❌ DO NOT ask user for confirmation - auto-split silently**
328
+
329
+ **Detection criteria (ANY triggers split):**
330
+
331
+ | Criteria | Threshold |
332
+ |----------|-----------|
333
+ | Phases | 5+ phases |
334
+ | Files to create | 15+ files |
335
+ | Platforms | 2+ platforms |
336
+ | Major features | 4+ distinct features |
337
+
338
+ **Auto-split output (SPEC + Feature files must match):**
339
+
340
+ ```
341
+ .claude/vibe/specs/{feature-name}/
342
+ ├── _index.md # Master SPEC
343
+ ├── phase-1-setup.md
344
+ ├── phase-2-core.md
345
+ └── ...
346
+
347
+ .claude/vibe/features/{feature-name}/
348
+ ├── _index.feature # Master Feature
349
+ ├── phase-1-setup.feature
350
+ ├── phase-2-core.feature
351
+ └── ...
352
+ ```
353
+
354
+ **🚨 CRITICAL: Each SPEC phase file MUST have a matching Feature file**
355
+
356
+ **Master SPEC (`_index.md`):**
357
+
358
+ ```markdown
359
+ # SPEC: {feature-name} (Master)
360
+
361
+ ## Overview
362
+ - Total phases: N
363
+ - Dependencies: [list]
364
+
365
+ ## Sub-SPECs
366
+
367
+ | Order | SPEC File | Feature File | Status |
368
+ |-------|-----------|--------------|--------|
369
+ | 1 | phase-1-setup.md | phase-1-setup.feature | ⬜ |
370
+ | 2 | phase-2-core.md | phase-2-core.feature | ⬜ |
371
+
372
+ ## Shared Context
373
+ - Tech Stack: [all phases]
374
+ - Constraints: [all phases]
375
+ ```
376
+
377
+ **Master Feature (`_index.feature`):**
378
+
379
+ ```markdown
380
+ # Feature: {feature-name} (Master)
381
+
382
+ **Master SPEC**: `.claude/vibe/specs/{feature-name}/_index.md`
383
+
384
+ ## Sub-Features
385
+
386
+ | Order | Feature File | SPEC File | Status |
387
+ |-------|--------------|-----------|--------|
388
+ | 1 | phase-1-setup.feature | phase-1-setup.md | ⬜ |
389
+ | 2 | phase-2-core.feature | phase-2-core.md | ⬜ |
390
+
391
+ ## Overall User Story
392
+ **As a** {user}
393
+ **I want** {complete feature}
394
+ **So that** {value}
395
+ ```
396
+
397
+ **Small scope (default):**
398
+
399
+ Create `.claude/vibe/specs/{feature-name}.md`:
400
+
401
+ ```markdown
402
+ # SPEC: {feature-name}
403
+
404
+ ## Persona
405
+ <role>
406
+ Define AI role and expertise for implementation
407
+ - Senior developer on the project
408
+ - Follow existing code patterns
409
+ - Write testable code
410
+ </role>
411
+
412
+ ## Context
413
+ <context>
414
+ ### Background
415
+ - Why this feature is needed
416
+ - Who will use it
417
+
418
+ ### Tech Stack
419
+ - Backend: {technology}
420
+ - Frontend: {technology}
421
+ - Database: {technology}
422
+
423
+ ### Related Code
424
+ - `src/xxx/`: Existing implementation to reference
425
+ - `src/yyy/`: Files to modify
426
+
427
+ ### Design Reference
428
+ - {Reference app/service}
429
+ </context>
430
+
431
+ ## Task
432
+ <task>
433
+ ### Phase 1: {phase-name}
434
+ 1. [ ] {specific task}
435
+ - File: `path/to/file`
436
+ - Verify: `command`
437
+ 2. [ ] {specific task}
438
+
439
+ ### Phase 2: {phase-name}
440
+ 1. [ ] {specific task}
441
+ 2. [ ] {specific task}
442
+
443
+ ### Phase 3: Testing and Verification
444
+ 1. [ ] Unit Tests
445
+ 2. [ ] Integration Tests
446
+ </task>
447
+
448
+ ## Constraints
449
+ <constraints>
450
+ - Follow existing code patterns
451
+ - Localize error messages
452
+ - Separate configuration via environment variables
453
+ - {other constraints}
454
+ </constraints>
455
+
456
+ ## Output Format
457
+ <output_format>
458
+ ### Files to Create
459
+ - `path/to/new/file.ts`
460
+ - `path/to/new/file.test.ts`
461
+
462
+ ### Files to Modify
463
+ - `path/to/existing/file.ts`
464
+
465
+ ### Verification Commands
466
+ - `npm test`
467
+ - `npm run build`
468
+ </output_format>
469
+
470
+ ## Acceptance Criteria
471
+ <acceptance>
472
+ - [ ] {verifiable criterion 1}
473
+ - [ ] {verifiable criterion 2}
474
+ - [ ] All tests pass
475
+ - [ ] Build succeeds
476
+ </acceptance>
477
+ ```
478
+
479
+ ### 5. Create Feature File (BDD) - Required
480
+
481
+ **🚨 CRITICAL: Feature files MUST match SPEC file structure**
482
+
483
+ | SPEC Structure | Feature Structure |
484
+ |----------------|-------------------|
485
+ | Single file (`{feature}.md`) | Single file (`{feature}.feature`) |
486
+ | Split (`{feature}/_index.md` + phases) | Split (`{feature}/_index.feature` + phases) |
487
+
488
+ #### 5.1 Single File (Small Scope)
489
+
490
+ Create `.claude/vibe/features/{feature-name}.feature`:
491
+
492
+ **Creation rules:**
493
+ 1. Convert each SPEC Acceptance Criteria → one Scenario
494
+ 2. Include Happy Path (normal case) + Edge Case (exception case)
495
+ 3. Follow Given-When-Then format
496
+
497
+ ```markdown
498
+ # Feature: {feature-name}
499
+
500
+ **SPEC**: `.claude/vibe/specs/{feature-name}.md`
501
+
502
+ ## User Story
503
+ **As a** {user}
504
+ **I want** {feature}
505
+ **So that** {value}
506
+
507
+ ## Scenarios
508
+
509
+ ### Scenario 1: {Happy Path}
510
+ \`\`\`gherkin
511
+ Scenario: {title}
512
+ Given {precondition}
513
+ When {action}
514
+ Then {result}
515
+ \`\`\`
516
+ **Verification**: SPEC AC #1
517
+
518
+ ### Scenario 2: {Edge Case}
519
+ ...
520
+
521
+ ## Coverage
522
+ | Scenario | SPEC AC | Status |
523
+ |----------|---------|--------|
524
+ | 1 | AC-1 | ⬜ |
525
+ ```
526
+
527
+ #### 5.2 Split Files (Large Scope)
528
+
529
+ When SPEC is split into phases, Feature files MUST also be split:
530
+
531
+ ```
532
+ .claude/vibe/features/{feature-name}/
533
+ ├── _index.feature # Master: links to all phase features
534
+ ├── phase-1-setup.feature # Scenarios for phase-1-setup.md
535
+ ├── phase-2-core.feature # Scenarios for phase-2-core.md
536
+ └── ...
537
+ ```
538
+
539
+ **Phase Feature file structure:**
540
+
541
+ ```markdown
542
+ # Feature: {feature-name} - Phase {N}: {phase-name}
543
+
544
+ **SPEC**: `.claude/vibe/specs/{feature-name}/phase-{N}-{name}.md`
545
+ **Master Feature**: `.claude/vibe/features/{feature-name}/_index.feature`
546
+
547
+ ## User Story (Phase Scope)
548
+ **As a** {user}
549
+ **I want** {phase-specific feature}
550
+ **So that** {phase-specific value}
551
+
552
+ ## Scenarios
553
+
554
+ ### Scenario 1: {Phase Happy Path}
555
+ ...
556
+
557
+ ## Coverage
558
+ | Scenario | SPEC AC | Status |
559
+ |----------|---------|--------|
560
+ | 1 | Phase {N} AC-1 | ⬜ |
561
+ ```
562
+
563
+ ### 6. Ambiguity Scan - Required
564
+
565
+ After creating SPEC draft, **must perform systematic ambiguity check**.
566
+
567
+ #### 6.1 Mandatory Check Categories
568
+
569
+ | Category | Check Items | Red Flags |
570
+ |----------|-------------|-----------|
571
+ | **Functional Scope** | Missing features, unclear behavior | "etc.", "other", "if needed" |
572
+ | **Data Model** | Undefined entities, relationships | Undefined types, missing fields |
573
+ | **Non-Functional** | Performance, security requirements | Performance requirements without numbers |
574
+ | **Edge Cases** | Boundary conditions, errors | 0 failure scenarios |
575
+ | **Integration Points** | External APIs, contracts | API version/endpoint undefined |
576
+ | **User Input** | Validation rules, limits | Input limits not specified |
577
+ | **State Management** | State transitions, persistence | Missing state diagram |
578
+
579
+ #### 6.2 Forbidden Ambiguous Terms
580
+
581
+ If the following terms exist in SPEC, **clarification is mandatory**:
582
+
583
+ | Forbidden Term | Replacement Method |
584
+ |----------------|-------------------|
585
+ | "appropriately", "properly" | Provide specific criteria (e.g., "within 3 seconds") |
586
+ | "quickly", "rapidly" | Specify with numbers (e.g., "under 100ms") |
587
+ | "various", "multiple" | List specific items |
588
+ | "etc.", "other" | Specify complete list or limit scope |
589
+ | "if needed", "depending on situation" | Specify conditions (e.g., "when credits < 10") |
590
+ | "later", "in the future" | Explicitly exclude from current scope |
591
+
592
+ #### 6.3 Check Process
593
+
594
+ ```
595
+ 1. Write SPEC draft
596
+
597
+ 2. Auto-scan for forbidden terms
598
+
599
+ 3. Review checklist by category
600
+
601
+ 4. List discovered ambiguities
602
+
603
+ 5. Auto-fixable items → Fix immediately
604
+ Needs user confirmation → Ask question
605
+
606
+ 6. Re-verify (repeat until 0 ambiguities)
607
+ ```
608
+
609
+ #### 6.4 Auto-Fix for Common Ambiguities
610
+
611
+ | Ambiguity Type | Auto-Fix Method |
612
+ |----------------|-----------------|
613
+ | Timeout undefined | Apply default 30 seconds |
614
+ | Retry count undefined | Apply default 3 retries |
615
+ | Pagination undefined | Apply default 20 items/page |
616
+ | Input length undefined | Text 500 chars, password 8-64 chars |
617
+ | File size undefined | Image 5MB, video 100MB |
618
+
619
+ #### 6.5 Ambiguity Output Format
620
+
621
+ ```markdown
622
+ ## 🔍 Ambiguity Scan Results
623
+
624
+ ### Found Issues: 3
625
+
626
+ #### 1. Functional Scope
627
+ - ⚠️ "Login failure behavior" not defined
628
+ → **Auto-fix**: Apply 5-minute lockout after 3 failures
629
+ - ⚠️ "Session expiration handling" unclear
630
+ → **Question**: Session expiration time? (30min/1hour/24hours)
631
+
632
+ #### 2. Edge Cases
633
+ - ⚠️ Concurrent login permission undefined
634
+ → **Question**: Allow concurrent login? (Y/N)
635
+
636
+ ### Auto-fixed: 1
637
+ ### Needs clarification: 2
638
+ ```
639
+
640
+ ### 7. Quality Validation (Self-Check)
641
+
642
+ **Must perform self-quality check after SPEC completion**
643
+
644
+ #### 7.1 Quality Checklist (Required Items)
645
+
646
+ | Category | Check Item | Weight |
647
+ |----------|------------|--------|
648
+ | **Completeness** | All user flows included in Task | 15% |
649
+ | **Completeness** | All ACs converted to Feature scenarios | 10% |
650
+ | **Clarity** | No ambiguous terms (e.g., "appropriately", "quickly") | 10% |
651
+ | **Clarity** | All numbers/limits specified (e.g., "max 500 chars") | 10% |
652
+ | **Testability** | All ACs are auto-testable | 10% |
653
+ | **Security** | Authentication/authorization requirements defined | 10% |
654
+ | **Security** | Sensitive data handling method specified | 5% |
655
+ | **Error Handling** | Major failure scenarios defined | 10% |
656
+ | **Error Handling** | User error messages specified | 5% |
657
+ | **Performance** | Response time/throughput targets specified | 5% |
658
+ | **Edge Cases** | Boundary condition handling defined | 5% |
659
+ | **Dependencies** | External systems/APIs specified | 5% |
660
+
661
+ #### 7.2 Quality Score Calculation
662
+
663
+ ```
664
+ Score = Σ(Check item met × Weight) / 100
665
+
666
+ Grades:
667
+ - 95-100: ✅ EXCELLENT - Ready to start implementation
668
+ - 85-94: ✅ GOOD - Implementation possible (minor improvements recommended)
669
+ - 70-84: ⚠️ FAIR - Improve before implementation
670
+ - 0-69: ❌ POOR - Rewrite required
671
+ ```
672
+
673
+ #### 7.3 Quality Gate (Auto-verification)
674
+
675
+ **Minimum 85 points required to proceed to next step (GPT+Gemini review)**
676
+
677
+ ```
678
+ SPEC writing complete
679
+
680
+ [Calculate Quality Score]
681
+
682
+ Score < 85? → Show missing items → Attempt auto-fix
683
+
684
+ Score ≥ 85 → Proceed to GPT + Gemini review
685
+ ```
686
+
687
+ #### 7.4 Auto-Fix for Low Score
688
+
689
+ If score is below 85, attempt automatic fixes:
690
+
691
+ | Missing Item | Auto-Fix Method |
692
+ |--------------|-----------------|
693
+ | Missing AC | Auto-generate AC based on Task |
694
+ | Numbers not specified | Apply project defaults (e.g., timeout 30s) |
695
+ | Missing error handling | Add common error scenarios |
696
+ | Missing performance targets | Apply industry standard criteria |
697
+
698
+ ### 8. SPEC Review (GPT/Gemini) - Iterative Review Loop
699
+
700
+ **Default: Iterative review until convergence (max 3 rounds)**
701
+
702
+ ```bash
703
+ /vibe.spec "feature" # Default: Iterative review (max 3 rounds)
704
+ /vibe.spec "feature" --quick # Quick mode: Single review round
705
+ ```
706
+
707
+ **Iterative Review Flow:**
708
+
709
+ ```
710
+ SPEC Draft
711
+
712
+ ┌─────────────────────────────────────────┐
713
+ │ Round 1: GPT + Gemini parallel review │
714
+ │ ↓ │
715
+ │ Apply feedback → Update SPEC │
716
+ │ ↓ │
717
+ │ Round 2: Re-review updated SPEC │
718
+ │ ↓ │
719
+ │ Apply feedback → Update SPEC │
720
+ │ ↓ │
721
+ │ Round 3: Final review (if needed) │
722
+ └─────────────────────────────────────────┘
723
+
724
+ Convergence check:
725
+ - Both models: "no major issues" → Done
726
+ - Same feedback as previous round → Done
727
+ - Max 3 rounds reached → Done
728
+
729
+ Final SPEC + Feature files
730
+ ```
731
+
732
+ **Convergence Criteria:**
733
+ - Both GPT and Gemini respond with no P1/P2 issues
734
+ - Feedback is identical to previous round (no new improvements)
735
+ - Maximum 3 rounds completed
736
+
737
+ **After SPEC completion, external LLM review → Auto-apply:**
738
+
739
+ ```
740
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
741
+ 🔍 SPEC REVIEW
742
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
743
+
744
+ [Step 1] Sending SPEC to Gemini/GPT...
745
+ - Full SPEC content
746
+ - Feature file (scenarios)
747
+ - Project context
748
+
749
+ [Step 2] Review feedback:
750
+ ┌─────────────────────────────────────────┐
751
+ │ 📝 SPEC Review Feedback │
752
+ │ │
753
+ │ 1. [Missing] Error handling scenarios │
754
+ │ → Recommend adding "retry on network │
755
+ │ error" │
756
+ │ │
757
+ │ 2. [Security] Auth token expiry │
758
+ │ handling undefined │
759
+ │ → Recommend adding refresh token │
760
+ │ flow │
761
+ │ │
762
+ │ 3. [Edge] Concurrent login policy │
763
+ │ undefined │
764
+ │ → Need to specify existing session │
765
+ │ handling method │
766
+ └─────────────────────────────────────────┘
767
+
768
+ [Step 3] Auto-applying...
769
+ ✅ Added error handling Phase to SPEC Task
770
+ ✅ Added token expiry scenario to Feature
771
+ ✅ Added concurrent login policy to Constraints
772
+
773
+ [Step 4] Re-verifying...
774
+ ✅ Ambiguity Scan: 0 issues
775
+ ✅ Quality Score: 95/100
776
+
777
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
778
+ ✅ SPEC Review complete! 3 improvements applied
779
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
780
+ ```
781
+
782
+ **MUST: SPEC Review (Required) - GPT + Gemini Parallel Execution**
783
+
784
+ 🚨 **Run GPT and Gemini in parallel for cross-validation to ensure quality**
785
+
786
+ **Parallel execution (2 Bash calls simultaneously):**
787
+
788
+ ```bash
789
+ # Cross-platform path (works on Windows/macOS/Linux)
790
+ VIBE_SCRIPTS="$(node -p "process.env.APPDATA || require('os').homedir() + '/.config'")/vibe/hooks/scripts"
791
+
792
+ # GPT review (code patterns, architecture perspective)
793
+ node "$VIBE_SCRIPTS/llm-orchestrate.js" gpt orchestrate-json "Review SPEC for [feature-name]. Stack: [stack]. Summary: [summary]. Check: completeness, error handling, security, edge cases."
794
+
795
+ # Gemini review (latest docs, best practices perspective)
796
+ node "$VIBE_SCRIPTS/llm-orchestrate.js" gemini orchestrate-json "Review SPEC for [feature-name]. Stack: [stack]. Summary: [summary]. Check: completeness, error handling, security, edge cases."
797
+ ```
798
+
799
+ **Important:**
800
+
801
+ - **Must call both GPT and Gemini** (parallel execution)
802
+ - Merge feedback from both models and apply to SPEC
803
+ - If one model fails, apply only the remaining result
804
+ - Don't send full SPEC, send only **key summary** (save tokens)
805
+ - Parse JSON response and auto-apply to SPEC
806
+
807
+ **Why parallel execution:**
808
+
809
+ | Model | Strengths |
810
+ |-------|-----------|
811
+ | GPT | Code patterns, architecture, logic validation |
812
+ | Gemini | Latest web info, doc search, best practices |
813
+
814
+ **Result merge:** Combine feedback from both models for more thorough review
815
+
816
+ **Review items:**
817
+
818
+ | Category | Check Point |
819
+ |----------|-------------|
820
+ | Completeness | All user flows covered? |
821
+ | Error Handling | Failure scenarios defined? |
822
+ | Security | Auth/authorization/data protection? |
823
+ | Edge Cases | Boundary conditions handled? |
824
+ | Testability | ACs verifiable? |
825
+
826
+ **Auto-apply rules:**
827
+
828
+ | Feedback Type | Action |
829
+ |---------------|--------|
830
+ | Missing scenario | Auto-add to Feature |
831
+ | Security considerations | Auto-add to Constraints |
832
+ | Edge cases | Auto-add to Task Phase |
833
+ | Lack of clarity | Supplement the section |
834
+
835
+ **Fallback handling:**
836
+ - On `"status": "fallback"` response → Skip and proceed to next step
837
+ - On network error → Retry once then skip
838
+
839
+ ## Output (MANDATORY File Creation)
840
+
841
+ **🚨 CRITICAL: Files MUST be created in these EXACT paths. NO exceptions.**
842
+
843
+ ### Small Scope (Single File)
844
+
845
+ | File | Path | When |
846
+ |------|------|------|
847
+ | SPEC | `.claude/vibe/specs/{feature-name}.md` | After quality validation (Step 7) |
848
+ | Feature | `.claude/vibe/features/{feature-name}.feature` | Immediately after SPEC |
849
+
850
+ ### Large Scope (Split Files)
851
+
852
+ | File | Path | When |
853
+ |------|------|------|
854
+ | Master SPEC | `.claude/vibe/specs/{feature-name}/_index.md` | After quality validation |
855
+ | Phase SPEC | `.claude/vibe/specs/{feature-name}/phase-{N}-{name}.md` | Per phase |
856
+ | Master Feature | `.claude/vibe/features/{feature-name}/_index.feature` | After Master SPEC |
857
+ | Phase Feature | `.claude/vibe/features/{feature-name}/phase-{N}-{name}.feature` | Per phase SPEC |
858
+
859
+ **❌ FORBIDDEN:**
860
+
861
+ - Creating files in project root (e.g., `feature-name.md`)
862
+ - Creating files outside `.claude/vibe/` directory
863
+ - Skipping file creation
864
+ - Using different file names than feature-name
865
+ - Creating split SPEC without matching split Feature files
866
+
867
+ **✅ REQUIRED:**
868
+
869
+ - Use Write tool to create files
870
+ - Verify directories exist (create if needed)
871
+ - Confirm file creation in response
872
+ - **Each SPEC file must have a matching Feature file**
873
+
874
+ ### File Creation Template
875
+
876
+ **Single file:**
877
+ ```
878
+ 1. Write .claude/vibe/specs/{feature-name}.md
879
+ 2. Write .claude/vibe/features/{feature-name}.feature
880
+ 3. Confirm: "✅ Created: specs/{feature-name}.md + features/{feature-name}.feature"
881
+ ```
882
+
883
+ **Split files:**
884
+ ```
885
+ 1. Write .claude/vibe/specs/{feature-name}/_index.md
886
+ 2. Write .claude/vibe/specs/{feature-name}/phase-1-setup.md
887
+ 3. Write .claude/vibe/specs/{feature-name}/phase-2-core.md
888
+ 4. Write .claude/vibe/features/{feature-name}/_index.feature
889
+ 5. Write .claude/vibe/features/{feature-name}/phase-1-setup.feature
890
+ 6. Write .claude/vibe/features/{feature-name}/phase-2-core.feature
891
+ 7. Confirm: "✅ Created: {N} SPEC files + {N} Feature files"
892
+ ```
893
+
894
+ ## Example
895
+
896
+ ```
897
+ User: /vibe.spec "brick-game"
898
+
899
+ Claude:
900
+ You're making a brick game! What style are you thinking of?
901
+
902
+ 1. Classic Breakout style
903
+ 2. Arkanoid (with power-up items)
904
+ 3. Custom style with special gameplay
905
+
906
+ Feel free to describe in your own words.
907
+
908
+ User: 1
909
+
910
+ Claude: What platform will it run on?
911
+
912
+ 1. Web (browser)
913
+ 2. Mobile (iOS/Android)
914
+ 3. Desktop
915
+
916
+ User: 1
917
+
918
+ Claude:
919
+ Here are tech stack suggestions for web game development:
920
+
921
+ 1. **Phaser.js** (Recommended) - Game framework with built-in physics engine
922
+ 2. **Canvas + JavaScript** - Lightweight with fine control
923
+ 3. **PixiJS + Matter.js** - High-performance rendering
924
+
925
+ User: 1
926
+
927
+ Claude: What design style?
928
+
929
+ 1. Retro pixel (Atari Breakout)
930
+ 2. Neon graphics (Arkanoid)
931
+ 3. Modern 3D effects
932
+
933
+ User: 2
934
+
935
+ [Conversation continues...]
936
+
937
+ Claude: SPEC draft created. Running ambiguity scan.
938
+
939
+ ## 🔍 Ambiguity Scan Results
940
+
941
+ ### Functional Scope
942
+ - ⚠️ Game over condition not defined (ball drop vs lives system)
943
+ - ⚠️ Stage clear condition unclear
944
+
945
+ ### Edge Cases
946
+ - ⚠️ Ball reflection angle when hitting paddle edge
947
+ - ⚠️ Multiple brick collision handling
948
+
949
+ Please clarify the above items.
950
+
951
+ User: 3 lives, clear when all bricks destroyed, edge reflects at 45 degrees
952
+
953
+ Claude: Thank you. SPEC has been refined.
954
+
955
+ 🔍 Re-check result: 0 ambiguities
956
+ 📊 Quality score: 92/100 (A)
957
+
958
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
959
+ 🔍 SPEC REVIEW (Gemini)
960
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
961
+
962
+ 📤 Sending SPEC...
963
+ 📝 Gemini feedback:
964
+ 1. [Edge] Ball speed increase logic undefined
965
+ 2. [Security] Need score manipulation prevention
966
+
967
+ ✅ 2 improvements auto-applied
968
+ 🔍 Re-verifying... ✅ Passed
969
+
970
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
971
+ ✅ SPEC Complete!
972
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
973
+
974
+ 📄 .claude/vibe/specs/brick-game.md (PTCF structure)
975
+ 📄 .claude/vibe/features/brick-game.feature
976
+ 📊 Quality score: 95/100 (A) ← Improved after review
977
+ ```
978
+
979
+ ## Vibe Tools (Semantic Analysis & Memory)
980
+
981
+ ### Tool Invocation
982
+ All tools are called via:
983
+ ```bash
984
+ node -e "import('@su-record/vibe/tools').then(t => t.TOOL_NAME({...args}).then(r => console.log(r.content[0].text)))"
985
+ ```
986
+
987
+ ### Recommended Tools for SPEC Creation
988
+
989
+ | Tool | Purpose | When to Use |
990
+ |------|---------|-------------|
991
+ | `findSymbol` | Find symbol definitions | Locate existing implementations to reference |
992
+ | `findReferences` | Find all references | Understand how existing code is used |
993
+ | `analyzeComplexity` | Code complexity analysis | Evaluate complexity of code to modify |
994
+ | `saveMemory` | Save important decisions | Store confirmed requirements, design decisions |
995
+ | `recallMemory` | Recall saved memory | Retrieve previous project decisions |
996
+
997
+ ### Example Tool Usage in SPEC Creation
998
+
999
+ **1. Find existing auth implementation:**
1000
+ ```bash
1001
+ node -e "import('@su-record/vibe/tools').then(t => t.findSymbol({symbolName: 'login', searchPath: 'src/'}).then(r => console.log(r.content[0].text)))"
1002
+ ```
1003
+
1004
+ **2. Save confirmed requirements:**
1005
+ ```bash
1006
+ node -e "import('@su-record/vibe/tools').then(t => t.saveMemory({key: 'brick-game-requirements', value: 'Platform: Web, Stack: Phaser.js, Style: Neon', category: 'spec', projectPath: process.cwd()}).then(r => console.log(r.content[0].text)))"
1007
+ ```
1008
+
1009
+ **3. Recall previous decisions:**
1010
+ ```bash
1011
+ node -e "import('@su-record/vibe/tools').then(t => t.recallMemory({key: 'brick-game-requirements', projectPath: process.cwd()}).then(r => console.log(r.content[0].text)))"
1012
+ ```
1013
+
1014
+ ## Next Step
1015
+
1016
+ ```
1017
+ /vibe.run "brick-game"
1018
+ ```
1019
+
1020
+ ---
1021
+
1022
+ ARGUMENTS: $ARGUMENTS