@hustle-together/api-dev-tools 3.10.1 → 3.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/.claude/agents/code-reviewer.md +170 -0
  2. package/.claude/agents/docs-generator.md +80 -0
  3. package/.claude/agents/implementation-reviewer.md +119 -0
  4. package/.claude/agents/parallel-researcher.md +52 -0
  5. package/.claude/agents/research-validator.md +116 -0
  6. package/.claude/agents/schema-generator.md +70 -0
  7. package/.claude/agents/test-writer.md +104 -0
  8. package/.claude/api-dev-state.json +331 -0
  9. package/.claude/commands/README.md +196 -0
  10. package/.claude/commands/add-command.md +212 -0
  11. package/.claude/commands/api-create.md +510 -0
  12. package/.claude/commands/api-env.md +51 -0
  13. package/.claude/commands/api-interview.md +344 -0
  14. package/.claude/commands/api-research.md +357 -0
  15. package/.claude/commands/api-status.md +279 -0
  16. package/.claude/commands/api-verify.md +232 -0
  17. package/.claude/commands/beepboop.md +96 -0
  18. package/.claude/commands/busycommit.md +111 -0
  19. package/.claude/commands/commit.md +82 -0
  20. package/.claude/commands/cycle.md +137 -0
  21. package/.claude/commands/gap.md +85 -0
  22. package/.claude/commands/green.md +137 -0
  23. package/.claude/commands/issue.md +187 -0
  24. package/.claude/commands/ntfy-setup.md +91 -0
  25. package/.claude/commands/ntfy-test.md +74 -0
  26. package/.claude/commands/plan.md +167 -0
  27. package/.claude/commands/pr.md +121 -0
  28. package/.claude/commands/publish.md +40 -0
  29. package/.claude/commands/red.md +137 -0
  30. package/.claude/commands/refactor.md +137 -0
  31. package/.claude/commands/spike.md +137 -0
  32. package/.claude/commands/summarize.md +93 -0
  33. package/.claude/commands/tdd.md +139 -0
  34. package/.claude/commands/worktree-add.md +307 -0
  35. package/.claude/commands/worktree-cleanup.md +275 -0
  36. package/.claude/hooks/api-workflow-check.py +227 -0
  37. package/.claude/hooks/enforce-deep-research.py +185 -0
  38. package/.claude/hooks/enforce-disambiguation.py +155 -0
  39. package/.claude/hooks/enforce-documentation.py +192 -0
  40. package/.claude/hooks/enforce-environment.py +253 -0
  41. package/.claude/hooks/enforce-external-research.py +328 -0
  42. package/.claude/hooks/enforce-interview.py +421 -0
  43. package/.claude/hooks/enforce-refactor.py +189 -0
  44. package/.claude/hooks/enforce-research.py +159 -0
  45. package/.claude/hooks/enforce-schema.py +186 -0
  46. package/.claude/hooks/enforce-scope.py +160 -0
  47. package/.claude/hooks/enforce-tdd-red.py +250 -0
  48. package/.claude/hooks/enforce-verify.py +186 -0
  49. package/.claude/hooks/periodic-reground.py +154 -0
  50. package/.claude/hooks/session-startup.py +151 -0
  51. package/.claude/hooks/track-tool-use.py +626 -0
  52. package/.claude/hooks/verify-after-green.py +282 -0
  53. package/.claude/hooks/verify-implementation.py +225 -0
  54. package/.claude/research/index.json +6 -0
  55. package/.claude/settings.json +144 -0
  56. package/.claude/settings.local.json +12 -0
  57. package/.claude-plugin/marketplace.json +103 -0
  58. package/.skills/README.md +293 -0
  59. package/.skills/_shared/convert-commands.py +192 -0
  60. package/.skills/_shared/hooks/api-workflow-check.py +227 -0
  61. package/.skills/_shared/hooks/enforce-deep-research.py +185 -0
  62. package/.skills/_shared/hooks/enforce-disambiguation.py +155 -0
  63. package/.skills/_shared/hooks/enforce-documentation.py +192 -0
  64. package/.skills/_shared/hooks/enforce-environment.py +253 -0
  65. package/.skills/_shared/hooks/enforce-external-research.py +328 -0
  66. package/.skills/_shared/hooks/enforce-interview.py +421 -0
  67. package/.skills/_shared/hooks/enforce-refactor.py +189 -0
  68. package/.skills/_shared/hooks/enforce-research.py +159 -0
  69. package/.skills/_shared/hooks/enforce-schema.py +186 -0
  70. package/.skills/_shared/hooks/enforce-scope.py +160 -0
  71. package/.skills/_shared/hooks/enforce-tdd-red.py +250 -0
  72. package/.skills/_shared/hooks/enforce-verify.py +186 -0
  73. package/.skills/_shared/hooks/periodic-reground.py +154 -0
  74. package/.skills/_shared/hooks/session-startup.py +151 -0
  75. package/.skills/_shared/hooks/track-tool-use.py +626 -0
  76. package/.skills/_shared/hooks/verify-after-green.py +282 -0
  77. package/.skills/_shared/hooks/verify-implementation.py +225 -0
  78. package/.skills/_shared/install.sh +114 -0
  79. package/.skills/_shared/settings.json +93 -0
  80. package/.skills/add-command/SKILL.md +227 -0
  81. package/.skills/api-create/SKILL.md +623 -0
  82. package/.skills/api-env/SKILL.md +64 -0
  83. package/.skills/api-interview/SKILL.md +357 -0
  84. package/.skills/api-research/SKILL.md +370 -0
  85. package/.skills/api-status/SKILL.md +292 -0
  86. package/.skills/api-verify/SKILL.md +245 -0
  87. package/.skills/beepboop/SKILL.md +111 -0
  88. package/.skills/busycommit/SKILL.md +126 -0
  89. package/.skills/commit/SKILL.md +97 -0
  90. package/.skills/cycle/SKILL.md +152 -0
  91. package/.skills/gap/SKILL.md +100 -0
  92. package/.skills/green/SKILL.md +152 -0
  93. package/.skills/issue/SKILL.md +202 -0
  94. package/.skills/plan/SKILL.md +182 -0
  95. package/.skills/pr/SKILL.md +136 -0
  96. package/.skills/publish/SKILL.md +160 -0
  97. package/.skills/red/SKILL.md +152 -0
  98. package/.skills/refactor/SKILL.md +152 -0
  99. package/.skills/spike/SKILL.md +152 -0
  100. package/.skills/summarize/SKILL.md +108 -0
  101. package/.skills/tdd/SKILL.md +154 -0
  102. package/.skills/update-todos/SKILL.md +250 -0
  103. package/.skills/worktree-add/SKILL.md +322 -0
  104. package/.skills/worktree-cleanup/SKILL.md +290 -0
  105. package/CHANGELOG.md +115 -0
  106. package/README.md +161 -7101
  107. package/bin/cli.js +448 -805
  108. package/commands/README.md +66 -31
  109. package/commands/add-command.md +8 -5
  110. package/commands/beepboop.md +4 -5
  111. package/commands/busycommit.md +2 -3
  112. package/commands/commit.md +2 -3
  113. package/commands/cycle.md +2 -7
  114. package/commands/gap.md +2 -3
  115. package/commands/green.md +2 -7
  116. package/commands/hustle-api-continue.md +8 -5
  117. package/commands/hustle-api-create.md +70 -29
  118. package/commands/hustle-api-env.md +1 -0
  119. package/commands/hustle-api-interview.md +32 -19
  120. package/commands/hustle-api-research.md +47 -21
  121. package/commands/hustle-api-sessions.md +8 -7
  122. package/commands/hustle-api-status.md +21 -1
  123. package/commands/hustle-api-verify.md +14 -13
  124. package/commands/hustle-combine.md +488 -241
  125. package/commands/hustle-ui-create-page.md +113 -50
  126. package/commands/hustle-ui-create.md +179 -26
  127. package/commands/issue.md +3 -8
  128. package/commands/plan.md +2 -3
  129. package/commands/pr.md +2 -3
  130. package/commands/red.md +2 -7
  131. package/commands/refactor.md +2 -7
  132. package/commands/spike.md +2 -7
  133. package/commands/summarize.md +2 -3
  134. package/commands/tdd.md +2 -7
  135. package/commands/worktree-add.md +208 -216
  136. package/commands/worktree-cleanup.md +172 -178
  137. package/hooks/api-workflow-check.py +5 -3
  138. package/hooks/enforce-component-type-confirm.py +97 -0
  139. package/hooks/lib/__init__.py +1 -0
  140. package/hooks/lib/greptile.py +355 -0
  141. package/hooks/lib/ntfy.py +209 -0
  142. package/hooks/notify-input-needed.py +73 -0
  143. package/hooks/notify-phase-complete.py +90 -0
  144. package/hooks/run-code-review.py +246 -0
  145. package/hooks/track-token-usage.py +121 -0
  146. package/package.json +33 -12
  147. package/scripts/collect-test-results.ts +102 -77
  148. package/scripts/extract-parameters.ts +112 -70
  149. package/scripts/generate-test-manifest.ts +118 -77
  150. package/templates/.env.example +57 -0
  151. package/templates/BRAND_GUIDE.md +92 -52
  152. package/templates/CLAUDE-SECTION.md +40 -37
  153. package/templates/SPEC.json +186 -38
  154. package/templates/api-dev-state.json +33 -4
  155. package/templates/api-showcase/_components/APICard.tsx +22 -18
  156. package/templates/api-showcase/_components/APIModal.tsx +110 -64
  157. package/templates/api-showcase/_components/APIShowcase.tsx +53 -35
  158. package/templates/api-showcase/_components/APITester.tsx +128 -67
  159. package/templates/api-showcase/page.tsx +4 -4
  160. package/templates/api-test/page.tsx +51 -30
  161. package/templates/api-test/test-structure/route.ts +43 -34
  162. package/templates/component/Component.stories.tsx +41 -39
  163. package/templates/component/Component.test.tsx +96 -78
  164. package/templates/component/Component.tsx +63 -52
  165. package/templates/component/Component.types.ts +10 -6
  166. package/templates/component/Component.visual.spec.ts +170 -0
  167. package/templates/component/index.ts +2 -2
  168. package/templates/dev-tools/_components/DevToolsLanding.tsx +8 -8
  169. package/templates/dev-tools/page.tsx +4 -3
  170. package/templates/mcp-servers.json +30 -2
  171. package/templates/page/page.e2e.test.ts +56 -48
  172. package/templates/page/page.tsx +3 -3
  173. package/templates/shared/HeroHeader.tsx +16 -15
  174. package/templates/shared/index.ts +1 -1
  175. package/templates/ui-showcase/_components/PreviewCard.tsx +20 -20
  176. package/templates/ui-showcase/_components/PreviewModal.tsx +149 -108
  177. package/templates/ui-showcase/_components/UIShowcase.tsx +43 -35
  178. package/templates/ui-showcase/page.tsx +4 -4
@@ -0,0 +1,250 @@
1
+ ---
2
+ name: update-todos
3
+ description: Update TodoWrite progress tracker for multi-phase workflows. Internal helper skill that visualizes workflow progress with checkboxes. Automatically determines status based on current phase. Keywords: todowrite, progress, tracking, workflow, visualization, helper
4
+ license: MIT
5
+ compatibility: Requires Claude Code with TodoWrite tool support
6
+ metadata:
7
+ version: "1.0.0"
8
+ category: "workflow"
9
+ tags: ["todowrite", "progress", "tracking", "visualization", "helper"]
10
+ author: "Hustle Together"
11
+ allowed-tools: TodoWrite Read
12
+ ---
13
+
14
+ # Update Todos - TodoWrite Progress Helper
15
+
16
+ **Usage:** `/update-todos [workflow] [current-phase]`
17
+
18
+ **Purpose:** Updates the TodoWrite visual progress tracker for multi-phase workflows. Internal helper skill called by workflow commands.
19
+
20
+ ## Parameters
21
+
22
+ - **workflow**: Which workflow to update
23
+ - `api-create` - 13-phase API development
24
+ - `ui-create-component` - 13-phase component development
25
+ - `ui-create-page` - 13-phase page development
26
+ - `combine` - 12-phase API orchestration
27
+
28
+ - **current-phase**: Phase number just completed (0 = initialization, 1-13 = phases)
29
+
30
+ ## Workflow Phase Definitions
31
+
32
+ ### API Create (13 phases)
33
+
34
+ ```
35
+ Phase 1: Disambiguation - Clarify ambiguous API terms
36
+ Phase 2: Scope - Confirm endpoint understanding
37
+ Phase 3: Initial Research - Targeted doc searches (Context7, Web)
38
+ Phase 4: Interview - Questions FROM research findings
39
+ Phase 5: Deep Research - Adaptive propose-approve searches
40
+ Phase 6: Schema - Zod schema from research + interview
41
+ Phase 7: Environment - Verify API keys exist
42
+ Phase 8: TDD Red - Write failing tests
43
+ Phase 9: TDD Green - Minimal implementation
44
+ Phase 10: Verify - Re-research docs vs implementation
45
+ Phase 11: Refactor - Clean up code
46
+ Phase 12: Documentation - Update manifests, cache research
47
+ Phase 13: Completion - Final verification, commit
48
+ ```
49
+
50
+ ### UI Create Component (13 phases)
51
+
52
+ ```
53
+ Phase 1: Component Scope - Define type (Atom/Molecule/Organism)
54
+ Phase 2: Brand Guide - Check existing design system
55
+ Phase 3: Research - ShadCN, Radix, Tailwind patterns
56
+ Phase 4: Props Interview - Component API questions
57
+ Phase 5: ShadCN Detection - Check if base exists
58
+ Phase 6: Component Schema - Props, variants, defaults
59
+ Phase 7: TDD Red - Write component tests
60
+ Phase 8: TDD Green - Implement component
61
+ Phase 9: Storybook Stories - Create interactive docs
62
+ Phase 10: Responsive Check - Test breakpoints
63
+ Phase 11: Accessibility - WCAG AA/AAA audit
64
+ Phase 12: Brand Validation - Verify design system compliance
65
+ Phase 13: Showcase Update - Add to UI showcase page
66
+ ```
67
+
68
+ ### UI Create Page (13 phases)
69
+
70
+ ```
71
+ Phase 1: Page Type - Landing/Dashboard/Form/List/Detail/Auth
72
+ Phase 2: Route Planning - Define URL structure
73
+ Phase 3: API Route Check - Verify backend exists
74
+ Phase 4: Data Schema - Define page data requirements
75
+ Phase 5: Component Research - Find needed UI components
76
+ Phase 6: Layout Design - Structure with App Router patterns
77
+ Phase 7: TDD Red - Write Playwright E2E tests
78
+ Phase 8: TDD Green - Implement page
79
+ Phase 9: Data Integration - Connect to API routes
80
+ Phase 10: SEO Metadata - Add meta tags, OG, Twitter cards
81
+ Phase 11: Accessibility - Keyboard nav, ARIA, focus management
82
+ Phase 12: E2E Validation - Run Playwright tests
83
+ Phase 13: Registry Update - Add to route registry
84
+ ```
85
+
86
+ ### Combine APIs (12 phases)
87
+
88
+ ```
89
+ Phase 1: API Selection - Choose 2+ existing APIs from registry
90
+ Phase 2: Registry Verification - Confirm APIs are complete
91
+ Phase 3: Flow Type - Sequential/Parallel/Conditional
92
+ Phase 4: Data Mapping - Define transformations between APIs
93
+ Phase 5: Error Strategy - Fail-fast/Fallback/Retry
94
+ Phase 6: Schema Design - Combined Zod schema
95
+ Phase 7: TDD Red - Write orchestration tests
96
+ Phase 8: TDD Green - Implement orchestration
97
+ Phase 9: Curl Examples - Generate test commands
98
+ Phase 10: Performance Test - Verify latency acceptable
99
+ Phase 11: Documentation - Update manifests with examples
100
+ Phase 12: Showcase Update - Add to API showcase
101
+ ```
102
+
103
+ ## Implementation
104
+
105
+ You are a TodoWrite progress updater. Your job is to:
106
+
107
+ 1. **Read the workflow parameter** to determine which phase structure to use
108
+ 2. **Build the todos array** with proper status for each phase
109
+ 3. **Call TodoWrite** with the complete array
110
+ 4. **Return silently** without output to the user
111
+
112
+ ### Status Logic
113
+
114
+ For a given `current_phase` number:
115
+
116
+ - Phases < current_phase: `"completed"`
117
+ - Phase == current_phase: `"in_progress"`
118
+ - Phases > current_phase: `"pending"`
119
+
120
+ ### Example Call
121
+
122
+ User calls: `/update-todos api-create 3`
123
+
124
+ You build:
125
+
126
+ ```json
127
+ [
128
+ {"content": "Phase 1: Disambiguation", "status": "completed", "activeForm": "Clarified API terms"},
129
+ {"content": "Phase 2: Scope", "status": "completed", "activeForm": "Confirmed endpoint understanding"},
130
+ {"content": "Phase 3: Initial Research", "status": "in_progress", "activeForm": "Researching documentation"},
131
+ {"content": "Phase 4: Interview", "status": "pending", "activeForm": "Interviewing user for requirements"},
132
+ ...
133
+ ]
134
+ ```
135
+
136
+ Then call TodoWrite with this array.
137
+
138
+ ## Special Cases
139
+
140
+ ### Initialization (phase 0)
141
+
142
+ When `current_phase = 0`, all phases are `"pending"` with one `"in_progress"`:
143
+
144
+ - Phase 1: `"in_progress"` (starting workflow)
145
+ - Phases 2-13: `"pending"`
146
+
147
+ ### Completion (phase 13 for 13-phase workflows)
148
+
149
+ When `current_phase = 13`:
150
+
151
+ - All phases: `"completed"`
152
+ - Display completion message
153
+
154
+ ### Loop-Back Scenarios
155
+
156
+ If a verification phase fails (e.g., Phase 10 requires going back to Phase 8):
157
+
158
+ - The calling workflow will call `/update-todos` with the looped-back phase number
159
+ - Example: After Phase 10 fails verification → `/update-todos api-create 8`
160
+ - Phase 8 becomes `"in_progress"` again
161
+ - Phases 9-13 revert to `"pending"`
162
+
163
+ ## Error Handling
164
+
165
+ If invalid parameters:
166
+
167
+ - Invalid workflow name → Use `api-create` as default, warn user
168
+ - Invalid phase number → Clamp to valid range (0-13 or 0-12)
169
+ - Missing parameters → Ask user to provide them
170
+
171
+ ## Silent Operation
172
+
173
+ **CRITICAL:** This is a helper skill. After calling TodoWrite, you MUST:
174
+
175
+ - **NOT output any text to the user**
176
+ - **NOT explain what you did**
177
+ - **NOT ask follow-up questions**
178
+ - Simply update the todos and return control to the calling workflow
179
+
180
+ The calling workflow (e.g., `/api-create`) will handle all user communication.
181
+
182
+ ## Usage Examples
183
+
184
+ ### From api-create workflow
185
+
186
+ ```markdown
187
+ # Start of workflow
188
+
189
+ /update-todos api-create 0
190
+
191
+ # After Phase 1 completes
192
+
193
+ /update-todos api-create 1
194
+
195
+ # After Phase 10 verification fails (loop back to Phase 8)
196
+
197
+ /update-todos api-create 8
198
+ ```
199
+
200
+ ### From ui-create-component workflow
201
+
202
+ ```markdown
203
+ # Start of workflow
204
+
205
+ /update-todos ui-create-component 0
206
+
207
+ # After completing Brand Guide check
208
+
209
+ /update-todos ui-create-component 2
210
+ ```
211
+
212
+ ### From combine workflow
213
+
214
+ ```markdown
215
+ # Start of workflow (note: only 12 phases)
216
+
217
+ /update-todos combine 0
218
+
219
+ # After Flow Type selection
220
+
221
+ /update-todos combine 3
222
+ ```
223
+
224
+ ## Integration Points
225
+
226
+ This skill is called by:
227
+
228
+ - `.skills/api-create/SKILL.md` (or `/hustle-api-create`)
229
+ - `.skills/hustle-ui-create/SKILL.md` (component mode)
230
+ - `.skills/hustle-ui-create-page/SKILL.md` (page mode)
231
+ - `.skills/hustle-combine/SKILL.md` (orchestration)
232
+
233
+ ## Testing
234
+
235
+ To test this helper independently:
236
+
237
+ ```bash
238
+ /update-todos api-create 5
239
+ # Should show phases 1-4 completed, phase 5 in_progress, 6-13 pending
240
+
241
+ /update-todos combine 12
242
+ # Should show all 12 phases completed
243
+
244
+ /update-todos ui-create-component 0
245
+ # Should show phase 1 in_progress, rest pending
246
+ ```
247
+
248
+ ---
249
+
250
+ **Now execute the TodoWrite update based on the provided parameters.**
@@ -0,0 +1,322 @@
1
+ ---
2
+ name: worktree-add
3
+ description: Add new git worktree from branch name or GitHub issue URL. Copies settings, installs deps, opens in IDE. Use for parallel feature development. Keywords: git, worktree, parallel, workflow, branches
4
+ license: MIT
5
+ compatibility: Requires Claude Code with MCP servers (Context7, GitHub), Python 3.9+ for hooks, pnpm 10.11.0+
6
+ metadata:
7
+ version: "3.0.0"
8
+ category: "git"
9
+ tags: ['git', 'worktree', 'parallel', 'workflow']
10
+ author: "Hustle Together"
11
+ allowed-tools: WebSearch WebFetch mcp__context7 mcp__github AskUserQuestion Read Write Edit Bash TodoWrite
12
+ ---
13
+
14
+ ---
15
+
16
+ description: Add a new git worktree from branch name or GitHub issue URL, copy settings, install deps, and open in current IDE
17
+ argument-hint: <branch-name-or-github-issue-url> [optional-base-branch]
18
+
19
+ ---
20
+
21
+ # Git Worktree Setup
22
+
23
+ ## General Guidelines
24
+
25
+ ### Output Style
26
+
27
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
28
+ - Write natural, descriptive code without meta-commentary about the development process
29
+ - The code should speak for itself - TDD is the process, not the product
30
+
31
+ Create a new git worktree for branch: $ARGUMENTS
32
+
33
+ <current_state>
34
+ Current branch: !git branch --show-current`
35
+ Current worktrees: !git worktree list`
36
+ Remote branches: !git branch -r`
37
+ Uncommitted changes: !git status --short`
38
+ </current_state>
39
+
40
+ <execution_steps>
41
+ <step_0>
42
+ <description>Validate MCP dependencies</description>
43
+ <check_github_mcp>
44
+ <requirement>GitHub MCP server must be configured</requirement>
45
+ <fallback>If unavailable, use `gh` CLI commands</fallback>
46
+ <validation> - Try listing available MCP resources - If GitHub MCP not found, switch to CLI fallback - Inform user about MCP configuration if needed
47
+ </validation>
48
+ </check_github_mcp>
49
+ <error_handling>
50
+ If MCP validation fails: - Show clear error message - Provide setup instructions - Fallback to CLI if possible
51
+ </error_handling>
52
+ <purpose>Ensure required MCP dependencies are available before proceeding</purpose>
53
+ </step_0>
54
+
55
+ <step_1>
56
+ <description>Detect current IDE environment</description>
57
+ <detection_methods>
58
+ <method_1>
59
+ <tool>mcp**ide**getDiagnostics</tool>
60
+ <vs_code_insiders>Check for paths containing "Code - Insiders"</vs_code_insiders>
61
+ <vs_code>Check for paths containing "Code/" or "Code.app"</vs_code>
62
+ <cursor>Check for paths containing "Cursor"</cursor>
63
+ <zed>Check for paths containing "Zed"</zed>
64
+ </method_1>
65
+ <method_2>
66
+ <fallback_detection>Use which command to find available IDEs</fallback_detection>
67
+ <commands>which code-insiders code zed cursor</commands>
68
+ <priority_order>code-insiders > cursor > zed > code</priority_order>
69
+ </method_2>
70
+ </detection_methods>
71
+ <set_variables>
72
+ <ide_command>Detected command (code-insiders|code|zed|cursor)</ide_command>
73
+ <ide_name>Human-readable name</ide_name>
74
+ <supports_tasks>true for VS Code variants, false for others</supports_tasks>
75
+ </set_variables>
76
+ <purpose>Automatically detect which IDE to use for opening the new worktree</purpose>
77
+ </step_1>
78
+
79
+ <step_2>
80
+ <description>Parse the arguments</description>
81
+ <input>The user-provided arguments</input>
82
+ <expected_format>branch-name-or-github-url [optional-base-branch]</expected_format>
83
+ <example>fix/issue-123-main-content-area-visually-clipped main</example>
84
+ <example_github_url><https://github.com/owner/project/issues/123> main</example_github_url>
85
+ <default_base_branch>main (if not specified)</default_base_branch>
86
+ </step_1>
87
+
88
+ <step_2_5>
89
+ <description>Handle GitHub issue URLs</description>
90
+ <condition>If first argument matches GitHub issue URL pattern</condition>
91
+ <url_detection>Check if argument contains "github.com" and "/issues/"</url_detection>
92
+ <url_parsing>
93
+ <pattern>https://github.com/{owner}/{repo}/issues/{issue_number}</pattern>
94
+ <extract>owner, repo, issue_number from URL</extract>
95
+ </url_parsing>
96
+ <fetch_issue_details>
97
+ <tool>mcp**github**issue_read</tool>
98
+ <method>get</method>
99
+ <parameters>owner, repo, issue_number</parameters>
100
+ </fetch_issue_details>
101
+ <generate_branch_name>
102
+ <determine_type>Analyze issue title/labels to determine type (feat/fix/refactor/chore)</determine_type>
103
+ <format>{type}/{repo}-{issue_number}-{kebab-case-title}</format>
104
+ <kebab_case>Convert title to lowercase, replace spaces/special chars with hyphens</kebab_case>
105
+ <sanitization>
106
+ <rule>Always use lowercase for branch names</rule>
107
+ <rule>Replace # with - (hash symbol not allowed in git branch names)</rule>
108
+ <rule>Remove or replace other special characters: @, $, %, ^, &, \*, (, ), [, ], {, }, \, |, ;, :, ", ', <, >, ?, /, ~, `</rule>
109
+ <rule>Replace multiple consecutive hyphens with single hyphen</rule>
110
+ <rule>Trim leading/trailing hyphens</rule>
111
+ </sanitization>
112
+ <truncate>Limit total branch name to reasonable length (~60 chars)</truncate>
113
+ </generate_branch_name>
114
+ <user_confirmation>
115
+ <display>Show generated branch name and ask for confirmation</display>
116
+ <options>"Yes, proceed" or "No, exit" or "Edit branch name"</options>
117
+ <if_no>Exit command gracefully</if_no>
118
+ <if_edit>Allow user to modify the branch name</if_edit>
119
+ <if_yes>Continue with generated/modified branch name</if_yes>
120
+ </user_confirmation>
121
+ <examples>
122
+ <input>https://github.com/owner/project/issues/456</input>
123
+
124
+ <title>"Fix duplicate items in list view"</title>
125
+ <generated>fix/issue-456-duplicate-items-in-list-view</generated>
126
+ </examples>
127
+ </step_1_5>
128
+
129
+ <step_3>
130
+ <description>Add all files and stash uncommitted changes if any exist</description>
131
+ <condition>If output is not empty (has uncommitted changes)</condition>
132
+ <command>git add -A && git stash push -m "Worktree switch: Moving changes to ${branch_name}"</chained_command>
133
+ <purpose>Preserve work in progress before switching worktrees</purpose>
134
+ <note>Remember stash was created for later restoration</note>
135
+ </step_3>
136
+
137
+ <step_4>
138
+ <description>Determine worktree parent directory</description>
139
+ <check_if_in_worktree>git rev-parse --is-inside-work-tree && git worktree list --porcelain | grep "$(git rev-parse --show-toplevel)"</check_if_in_worktree>
140
+ <set_parent_path>
141
+ <if_main_worktree>Set parent_path=".."</if_main_worktree>
142
+ <if_secondary_worktree>Set parent_path="../.." (need to go up two levels)</if_secondary_worktree>
143
+ </set_parent_path>
144
+ <purpose>Correctly determine where to create new worktree regardless of current location</purpose>
145
+ <note>This handles both main worktree and secondary worktree scenarios</note>
146
+ </step_4>
147
+
148
+ <step_5>
149
+ <description>Fetch latest changes from remote</description>
150
+ <command>git fetch origin</command>
151
+ <purpose>Ensure we have the latest remote branches and main branch state</purpose>
152
+ <note>This ensures new worktrees are created from the most recent main branch</note>
153
+ </step_6>
154
+
155
+ <step_7>
156
+ <description>Check if branch exists on remote</description>
157
+ <command>git branch -r | grep "origin/${branch_name}"</command>
158
+ <decision>
159
+ <if_exists>Branch exists on remote - will checkout existing branch</if_exists>
160
+ <if_not_exists>Branch does not exist - will create new branch from base</if_not_exists>
161
+ </decision>
162
+ </step_5>
163
+
164
+ <step_6>
165
+ <description>Create the worktree</description>
166
+ <option_a_new_branch>
167
+ <condition>Remote branch does NOT exist</condition>
168
+ <command>git worktree add ${parent_path}/${branch_name} -b ${branch_name} ${base_branch}</command>
169
+ <example>git worktree add ../fix/issue-123-main-content-area-visually-clipped -b fix/issue-123-main-content-area-visually-clipped main</example>
170
+ </option_a_new_branch>
171
+ <option_b_existing_branch>
172
+ <condition>Remote branch EXISTS</condition>
173
+ <command>git worktree add ${parent_path}/${branch_name} ${branch_name}</command>
174
+ <example>git worktree add ../fix/issue-123-main-content-area-visually-clipped fix/issue-123-main-content-area-visually-clipped</example>
175
+ </option_b_existing_branch>
176
+ </step_7>
177
+
178
+ <step_8>
179
+ <description>Copy Claude settings to new worktree</description>
180
+
181
+ <source>.claude/settings.local.json</source>
182
+ <destination>${parent_path}/${branch_name}/.claude/settings.local.json</destination>
183
+ <command>cp -r .claude/settings.local.json ${parent_path}/${branch_name}/.claude/settings.local.json</command>
184
+ <purpose>Preserve all permission settings and configurations</purpose>
185
+ </step_8>
186
+
187
+ <step*9>
188
+ <description>Copy .env.local files to new worktree</description>
189
+ <search_command>find . -name ".env.local" -type f</search_command>
190
+ <copy_logic>For each .env.local file found, copy to corresponding location in new worktree</copy_logic>
191
+ <common_locations> - app/.env.local - packages/\*/.env.local - (any other .env.local files found)
192
+ </common_locations>
193
+ <copy_command>find . -name ".env.local" -type f -exec sh -c 'mkdir -p "$(dirname "${parent_path}/${branch_name}/$1")" && cp "$1" "${parent_path}/${branch_name}/$1"' *{} \;</copy_command>
194
+ <purpose>Preserve local environment configurations for development</purpose>
195
+ <note>Only copies files that exist; ignores missing ones</note>
196
+ </step_9>
197
+
198
+ <step_10>
199
+ <description>Create IDE-specific configuration (conditional)</description>
200
+ <condition>Only if supports_tasks is true (VS Code variants)</condition>
201
+ <vs_code_tasks>
202
+ <create_directory>mkdir -p ${parent_path}/${branch_name}/.vscode</create_directory>
203
+ <create_file_command>cat > ${parent_path}/${branch_name}/.vscode/tasks.json << 'EOF'
204
+ {
205
+ "version": "2.0.0",
206
+ "tasks": [
207
+ {
208
+ "label": "Auto start Claude",
209
+ "type": "shell",
210
+ "command": "claude",
211
+ "runOptions": {
212
+ "runOn": "folderOpen"
213
+ },
214
+ "presentation": {
215
+ "echo": false,
216
+ "reveal": "always",
217
+ "focus": true,
218
+ "panel": "new"
219
+ }
220
+ }
221
+ ]
222
+ }
223
+ EOF</create_file_command>
224
+ </vs_code_tasks>
225
+ <purpose>Create auto-start Claude task for VS Code variants on folder open</purpose>
226
+ <note>Only creates for VS Code variants (code, code-insiders, cursor)</note>
227
+ <skip_message>Skipping IDE-specific config for non-VS Code IDEs</skip_message>
228
+ </step_10>
229
+
230
+ <step_11>
231
+ <description>Install dependencies in new worktree</description>
232
+ <working_directory>${parent_path}/${branch_name}</working_directory>
233
+ <command>cd ${parent_path}/${branch_name} && pnpm install</command>
234
+ <purpose>Ensure all node_modules are installed for the new worktree</purpose>
235
+ </step_11>
236
+
237
+ <step_12>
238
+ <description>Apply stashed changes to new worktree (if stash was created)</description>
239
+ <condition>Only if stash was created in step_3</condition>
240
+ <working_directory>${parent_path}/${branch_name}</working_directory>
241
+ <command>cd ${parent_path}/${branch_name} && git stash pop</command>
242
+ <purpose>Restore uncommitted work-in-progress to the new worktree branch</purpose>
243
+ <note>This moves your uncommitted changes to the new branch where you'll continue working</note>
244
+ </step_12>
245
+
246
+ <step_13>
247
+ <description>Open detected IDE in new worktree</description>
248
+ <command>${ide_command} ${parent_path}/${branch_name}</command>
249
+ <ide_specific_behavior>
250
+ <vs_code_variants>Opens folder in VS Code/Insiders/Cursor with tasks.json auto-starting Claude</vs_code_variants>
251
+ <zed>Opens folder in Zed editor</zed>
252
+ <other>Uses detected IDE command to open folder</other>
253
+ </ide_specific_behavior>
254
+ <purpose>Launch development environment for the new worktree using detected IDE</purpose>
255
+ <confirmation_message>Opening worktree in ${ide_name}</confirmation_message>
256
+ </step_11>
257
+ </execution_steps>
258
+
259
+ <important_notes>
260
+
261
+ - Automatically detects and uses your current IDE (VS Code, VS Code Insiders, Cursor, Zed, etc.)
262
+ - Creates VS Code-specific tasks.json only for VS Code variants (auto-starts Claude on folder open)
263
+ - Branch names with slashes (feat/, fix/, etc.) are fully supported
264
+ - The worktree directory path will match the full branch name including slashes
265
+ - Settings are copied to maintain the same permissions across worktrees
266
+ - Environment files (.env.local) are copied to preserve local configurations
267
+ - Each worktree has its own node_modules installation
268
+ - Uncommitted changes are automatically stashed and moved to the new worktree
269
+ - Your work-in-progress seamlessly transfers to the new branch
270
+ - IDE detection fallback: checks available editors and uses priority order
271
+ </important_notes>
272
+
273
+ ## 🛡 Project Rules (Injected into every command)
274
+
275
+ 1. **NO BROKEN BUILDS:**
276
+ - Run `pnpm test` before every `/commit`
277
+ - Ensure all tests pass
278
+ - Fix any type errors immediately
279
+
280
+ 2. **API DEVELOPMENT:**
281
+ - All new APIs MUST have Zod request/response schemas
282
+ - All APIs MUST be documented in both:
283
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
284
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
285
+ - Test ALL parameters and edge cases
286
+ - Include code examples and real-world outputs
287
+
288
+ 3. **TDD WORKFLOW:**
289
+ - ALWAYS use /red → /green → /refactor cycle
290
+ - NEVER write implementation without failing test first
291
+ - Use /cycle for feature development
292
+ - Use characterization tests for refactoring
293
+
294
+ 4. **API KEY MANAGEMENT:**
295
+ - Support three loading methods:
296
+ - Server environment variables
297
+ - NEXT*PUBLIC* variables (client-side)
298
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
299
+ - Never hardcode API keys
300
+ - Always validate key availability before use
301
+
302
+ 5. **COMPREHENSIVE TESTING:**
303
+ - When researching APIs, read actual implementation code
304
+ - Discover ALL possible parameters (not just documented ones)
305
+ - Test with various parameter combinations
306
+ - Document custom headers, query params, request/response schemas
307
+ - Include validation rules and testing notes
308
+
309
+ 6. **NO UI BLOAT:**
310
+ - This is an API project with minimal frontend
311
+ - Only keep necessary test/documentation interfaces
312
+ - Delete unused components immediately
313
+ - No unnecessary UI libraries or features
314
+
315
+ 7. **DOCUMENTATION:**
316
+ - If you change an API, you MUST update:
317
+ - OpenAPI spec
318
+ - api-tests-manifest.json
319
+ - Code examples
320
+ - Testing notes
321
+ - Document expected behavior and edge cases
322
+ - Include real-world output examples