@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,182 @@
1
+ ---
2
+ name: plan
3
+ description: Create implementation plan from feature or requirement with PRD-style discovery and TDD acceptance criteria. Generates step-by-step checklist. Use before starting complex features. Keywords: planning, prd, requirements, checklist, strategy
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: "planning"
9
+ tags: ['planning', 'prd', 'requirements', 'strategy']
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: Create implementation plan from feature/requirement with PRD-style discovery and TDD acceptance criteria
17
+ argument-hint: <feature/requirement description or GitHub issue URL/number>
18
+
19
+ ---
20
+
21
+ # Plan: PRD-Informed Task Planning for TDD
22
+
23
+ Create structured implementation plan that bridges product thinking (PRD) with test-driven development.
24
+
25
+ ## General Guidelines
26
+
27
+ ### Output Style
28
+
29
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
30
+ - Write natural, descriptive code without meta-commentary about the development process
31
+ - The code should speak for itself - TDD is the process, not the product
32
+
33
+ ## Input
34
+
35
+ $ARGUMENTS
36
+
37
+ (If no input provided, check conversation context)
38
+
39
+ ## Input Processing
40
+
41
+ The input can be one of:
42
+
43
+ 1. **GitHub Issue URL** (e.g., `https://github.com/owner/repo/issues/123`)
44
+ 2. **GitHub Issue Number** (e.g., `#123` or `123`)
45
+ 3. **Feature Description** (e.g., "Add user authentication")
46
+ 4. **Empty** - use conversation context
47
+
48
+ ### GitHub Issue Integration
49
+
50
+ If input looks like a GitHub issue:
51
+
52
+ **Step 1: Extract Issue Number**
53
+
54
+ - From URL: extract owner/repo/number
55
+ - From number: try to infer repo from git remote
56
+ - From branch name: check patterns like `issue-123`, `123-feature`, `feature/123`
57
+
58
+ **Step 2: Fetch Issue**
59
+ Try GitHub MCP first:
60
+
61
+ - If available: use `mcp__github__issue_read` to fetch issue details
62
+ - If not available: show message and try `gh issue view <number>`
63
+
64
+ ```
65
+ GitHub MCP not configured!
66
+ See: https://github.com/modelcontextprotocol/servers/tree/main/src/github
67
+ Trying GitHub CLI fallback...
68
+ ```
69
+
70
+ **Step 3: Use Issue as Discovery Input**
71
+
72
+ - Title → Feature name
73
+ - Description → Problem statement and context
74
+ - Labels → Type/priority hints
75
+ - Comments → Additional requirements and discussion
76
+ - Linked issues → Dependencies
77
+
78
+ Extract from GitHub issue:
79
+
80
+ - Problem statement and context
81
+ - Acceptance criteria (if present)
82
+ - Technical notes (if present)
83
+ - Related issues/dependencies
84
+
85
+ ## Process
86
+
87
+ ## Discovery Phase
88
+
89
+ Understand the requirement by asking (use AskUserQuestion if needed):
90
+
91
+ **Problem Statement**
92
+
93
+ - What problem does this solve?
94
+ - Who experiences this problem?
95
+ - What's the current pain point?
96
+
97
+ **Desired Outcome**
98
+
99
+ - What should happen after this is built?
100
+ - How will users interact with it?
101
+ - What does success look like?
102
+
103
+ **Scope & Constraints**
104
+
105
+ - What's in scope vs. out of scope?
106
+ - Any technical constraints?
107
+ - Dependencies on other systems/features?
108
+
109
+ **Context Check**
110
+
111
+ - Search codebase for related features/modules
112
+ - Check for existing test files that might be relevant
113
+
114
+ ## Key Principles
115
+
116
+ **From PRD World:**
117
+
118
+ - Start with user problems, not solutions
119
+ - Define success criteria upfront
120
+ - Understand constraints and scope
121
+
122
+ **From TDD World:**
123
+
124
+ - Make acceptance criteria test-ready
125
+ - Break work into small, testable pieces
126
+ - Each task should map to test(s)
127
+
128
+ ## Integration with Other Commands
129
+
130
+ - **Before /plan**: Use `/spike` if you need technical exploration first
131
+ - **After /plan**: Use `/red` to start TDD on first task
132
+
133
+ ## 🛡 Project Rules (Injected into every command)
134
+
135
+ 1. **NO BROKEN BUILDS:**
136
+ - Run `pnpm test` before every `/commit`
137
+ - Ensure all tests pass
138
+ - Fix any type errors immediately
139
+
140
+ 2. **API DEVELOPMENT:**
141
+ - All new APIs MUST have Zod request/response schemas
142
+ - All APIs MUST be documented in both:
143
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
144
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
145
+ - Test ALL parameters and edge cases
146
+ - Include code examples and real-world outputs
147
+
148
+ 3. **TDD WORKFLOW:**
149
+ - ALWAYS use /red → /green → /refactor cycle
150
+ - NEVER write implementation without failing test first
151
+ - Use /cycle for feature development
152
+ - Use characterization tests for refactoring
153
+
154
+ 4. **API KEY MANAGEMENT:**
155
+ - Support three loading methods:
156
+ - Server environment variables
157
+ - NEXT*PUBLIC* variables (client-side)
158
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
159
+ - Never hardcode API keys
160
+ - Always validate key availability before use
161
+
162
+ 5. **COMPREHENSIVE TESTING:**
163
+ - When researching APIs, read actual implementation code
164
+ - Discover ALL possible parameters (not just documented ones)
165
+ - Test with various parameter combinations
166
+ - Document custom headers, query params, request/response schemas
167
+ - Include validation rules and testing notes
168
+
169
+ 6. **NO UI BLOAT:**
170
+ - This is an API project with minimal frontend
171
+ - Only keep necessary test/documentation interfaces
172
+ - Delete unused components immediately
173
+ - No unnecessary UI libraries or features
174
+
175
+ 7. **DOCUMENTATION:**
176
+ - If you change an API, you MUST update:
177
+ - OpenAPI spec
178
+ - api-tests-manifest.json
179
+ - Code examples
180
+ - Testing notes
181
+ - Document expected behavior and edge cases
182
+ - Include real-world output examples
@@ -0,0 +1,136 @@
1
+ ---
2
+ name: pr
3
+ description: Create pull request using GitHub MCP. Generates PR summary from all commits, creates test plan. Use after pushing feature branch. Keywords: github, pull-request, pr, collaboration, review
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: ['github', 'pull-request', 'pr', 'collaboration']
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: Creates a pull request using GitHub MCP
17
+ argument-hint: [optional-pr-title-and-description]
18
+
19
+ ---
20
+
21
+ # Create Pull Request
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 pull request for the current branch using GitHub MCP tools.
32
+
33
+ ## Workflow
34
+
35
+ Current branch status:
36
+ !`git status`
37
+
38
+ Recent commits:
39
+ !`git log --oneline -5`
40
+
41
+ Arguments: $ARGUMENTS
42
+
43
+ **Process:**
44
+
45
+ 1. **Ensure Branch is Ready**:
46
+ !`git status`
47
+ - Commit all changes
48
+ - Push to remote: `git push origin [branch-name]`
49
+
50
+ 2. **Create PR**: Create a well-formatted pull request
51
+
52
+ Title: conventional commits format, like `feat(#123): add user authentication`
53
+
54
+ Description template:
55
+
56
+ ```markdown
57
+ <!--
58
+ Are there any relevant issues / PRs / mailing lists discussions?
59
+ Please reference them here.
60
+ -->
61
+
62
+ ## References
63
+
64
+ - [links to github issues referenced in commit messages]
65
+
66
+ ## Summary
67
+
68
+ [Brief description of changes]
69
+
70
+ ## Test Plan
71
+
72
+ - [ ] Tests pass
73
+ - [ ] Manual testing completed
74
+ ```
75
+
76
+ 3. **Set Base Branch**: Default to main unless specified otherwise
77
+
78
+ 4. **Link Issues**: Reference related issues found in commit messages
79
+
80
+ ## Use GitHub MCP Tools
81
+
82
+ 1. Check current branch and ensure it's pushed
83
+ 2. Create a well-formatted pull request with proper title and description
84
+ 3. Set the base branch (default: main)
85
+ 4. Include relevant issue references if found in commit messages
86
+
87
+ ## 🛡 Project Rules (Injected into every command)
88
+
89
+ 1. **NO BROKEN BUILDS:**
90
+ - Run `pnpm test` before every `/commit`
91
+ - Ensure all tests pass
92
+ - Fix any type errors immediately
93
+
94
+ 2. **API DEVELOPMENT:**
95
+ - All new APIs MUST have Zod request/response schemas
96
+ - All APIs MUST be documented in both:
97
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
98
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
99
+ - Test ALL parameters and edge cases
100
+ - Include code examples and real-world outputs
101
+
102
+ 3. **TDD WORKFLOW:**
103
+ - ALWAYS use /red → /green → /refactor cycle
104
+ - NEVER write implementation without failing test first
105
+ - Use /cycle for feature development
106
+ - Use characterization tests for refactoring
107
+
108
+ 4. **API KEY MANAGEMENT:**
109
+ - Support three loading methods:
110
+ - Server environment variables
111
+ - NEXT*PUBLIC* variables (client-side)
112
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
113
+ - Never hardcode API keys
114
+ - Always validate key availability before use
115
+
116
+ 5. **COMPREHENSIVE TESTING:**
117
+ - When researching APIs, read actual implementation code
118
+ - Discover ALL possible parameters (not just documented ones)
119
+ - Test with various parameter combinations
120
+ - Document custom headers, query params, request/response schemas
121
+ - Include validation rules and testing notes
122
+
123
+ 6. **NO UI BLOAT:**
124
+ - This is an API project with minimal frontend
125
+ - Only keep necessary test/documentation interfaces
126
+ - Delete unused components immediately
127
+ - No unnecessary UI libraries or features
128
+
129
+ 7. **DOCUMENTATION:**
130
+ - If you change an API, you MUST update:
131
+ - OpenAPI spec
132
+ - api-tests-manifest.json
133
+ - Code examples
134
+ - Testing notes
135
+ - Document expected behavior and edge cases
136
+ - Include real-world output examples
@@ -0,0 +1,160 @@
1
+ ---
2
+ name: publish
3
+ description: Publish npm package with incremental versioning (patch/minor/major). Verifies git status, bumps version, commits, pushes, and publishes. Keywords: npm, publish, version, release, semver
4
+ license: MIT
5
+ compatibility: Requires npm login, git configured, optional 2FA
6
+ metadata:
7
+ version: "1.0.0"
8
+ category: "release"
9
+ tags: ['npm', 'publish', 'version', 'release', 'semver']
10
+ author: "Hustle Together"
11
+ allowed-tools: Bash Read Edit AskUserQuestion TodoWrite
12
+ ---
13
+
14
+ ---
15
+
16
+ description: Publish npm package with incremental version bump
17
+ argument-hint: [patch|minor|major] or [specific-version]
18
+
19
+ ---
20
+
21
+ ## Overview
22
+
23
+ Publish the npm package with safe, incremental versioning. Defaults to patch bump unless specified otherwise.
24
+
25
+ ## Arguments
26
+
27
+ - `patch` (default) - Always use 0.0.1 increments (3.12.0 → 3.12.1)
28
+ - `minor` - New features, backwards compatible (3.12.0 → 3.13.0) - requires confirmation
29
+ - `major` - Breaking changes (3.12.0 → 4.0.0) - requires confirmation
30
+ - `X.Y.Z` - Specific version - requires confirmation if jump > 0.0.1
31
+
32
+ **Default behavior:** Always increment by 0.0.1 (patch) unless explicitly specified otherwise.
33
+
34
+ Include any of the following info if specified: $ARGUMENTS
35
+
36
+ ## Process
37
+
38
+ ### Phase 1: Pre-flight Checks
39
+
40
+ 1. **Verify clean working directory**
41
+ ```bash
42
+ git status --porcelain
43
+ ```
44
+ - If dirty, ask user to commit or stash changes first
45
+ - Exception: allow `.claude/` runtime files
46
+
47
+ 2. **Check npm login**
48
+ ```bash
49
+ npm whoami
50
+ ```
51
+ - If not logged in, prompt user to run `npm login`
52
+
53
+ 3. **Check current versions**
54
+ ```bash
55
+ # Local version
56
+ node -p "require('./package.json').version"
57
+
58
+ # Published version
59
+ npm view $(node -p "require('./package.json').name") version 2>/dev/null || echo "Not yet published"
60
+ ```
61
+
62
+ 4. **Verify on correct branch** (master/main)
63
+ ```bash
64
+ git branch --show-current
65
+ ```
66
+
67
+ ### Phase 2: Version Bump
68
+
69
+ 1. **Determine new version** based on argument:
70
+ - Parse $ARGUMENTS for: patch, minor, major, or X.Y.Z
71
+ - Default to `patch` if not specified
72
+ - Calculate new version from current
73
+
74
+ 2. **Ask for confirmation**
75
+ Use AskUserQuestion:
76
+ - Show current version → new version
77
+ - Ask to confirm or specify different version
78
+
79
+ 3. **Update package.json**
80
+ - Edit version field only
81
+ - Do NOT use `npm version` (it auto-commits)
82
+
83
+ ### Phase 3: Commit and Push
84
+
85
+ 1. **Commit the version bump**
86
+ ```bash
87
+ git add package.json
88
+ git commit -m "chore: bump version to X.Y.Z"
89
+ ```
90
+
91
+ 2. **Push to remote**
92
+ ```bash
93
+ git push origin $(git branch --show-current)
94
+ ```
95
+
96
+ ### Phase 4: Publish
97
+
98
+ 1. **Attempt publish**
99
+ ```bash
100
+ npm publish --access public
101
+ ```
102
+
103
+ 2. **Handle 2FA** (if required)
104
+ - If OTP error, inform user:
105
+ ```
106
+ npm publish --access public --otp=YOUR_CODE
107
+ ```
108
+ - User must run manually with their authenticator code
109
+
110
+ 3. **Verify publication**
111
+ ```bash
112
+ npm view $(node -p "require('./package.json').name") version
113
+ ```
114
+
115
+ ## Example Usage
116
+
117
+ ```bash
118
+ # Default patch bump (3.12.0 → 3.12.1)
119
+ /publish
120
+
121
+ # Minor bump (3.12.0 → 3.13.0)
122
+ /publish minor
123
+
124
+ # Major bump (3.12.0 → 4.0.0)
125
+ /publish major
126
+
127
+ # Specific version
128
+ /publish 3.15.0
129
+ ```
130
+
131
+ ## Safety Rules
132
+
133
+ 1. **Never skip version checks** - Always compare local vs published
134
+ 2. **Never force publish** - If version exists, bump first
135
+ 3. **Always commit before publish** - Version bump must be in git
136
+ 4. **Always push before publish** - Remote should match local
137
+ 5. **0.0.1 increments only** - Default to patch bumps; require confirmation for minor/major
138
+ 6. **No big jumps** - Any jump > 0.0.1 requires explicit user confirmation
139
+
140
+ ## Error Handling
141
+
142
+ | Error | Action |
143
+ |-------|--------|
144
+ | Dirty git status | Ask user to commit/stash |
145
+ | Not logged in | Prompt `npm login` |
146
+ | Version exists | Bump version first |
147
+ | OTP required | Show command with --otp flag |
148
+ | Push failed | Check remote access |
149
+
150
+ ## TodoWrite Integration
151
+
152
+ Initialize with:
153
+ ```
154
+ 1. Pre-flight checks (git, npm, versions)
155
+ 2. Calculate version bump
156
+ 3. Update package.json
157
+ 4. Commit and push
158
+ 5. Publish to npm
159
+ 6. Verify publication
160
+ ```
@@ -0,0 +1,152 @@
1
+ ---
2
+ name: red
3
+ description: TDD Red Phase - write ONE failing test that defines success before writing implementation. Use at the start of feature development to prevent over-engineering. Keywords: tdd, testing, red-phase, test-driven, failure
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: "testing"
9
+ tags: ['tdd', 'testing', 'red-phase', 'test-driven']
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: Execute TDD Red Phase - write ONE failing test
17
+ argument-hint: [optional additional info]
18
+
19
+ ---
20
+
21
+ RED PHASE! Apply the below to the info given by user input here:
22
+
23
+ $ARGUMENTS
24
+
25
+ ## General Guidelines
26
+
27
+ ### Output Style
28
+
29
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
30
+ - Write natural, descriptive code without meta-commentary about the development process
31
+ - The code should speak for itself - TDD is the process, not the product
32
+
33
+ (If there was no info above, fallback to the context of the conversation)
34
+
35
+ ## TDD Fundamentals
36
+
37
+ ### The TDD Cycle
38
+
39
+ The foundation of TDD is the Red-Green-Refactor cycle:
40
+
41
+ 1. **Red Phase**: Write ONE failing test that describes desired behavior
42
+ - The test must fail for the RIGHT reason (not syntax/import errors)
43
+ - Only one test at a time - this is critical for TDD discipline
44
+ - Exception: For browser-level tests or expensive setup (e.g., Storybook `*.stories.tsx`), group multiple assertions within a single test block to avoid redundant setup - but only when adding assertions to an existing interaction flow. If new user interactions are required, still create a new test. Split files by category if they exceed ~1000 lines.
45
+ - **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
46
+ - Starting TDD for a new feature is always valid, even if test output shows unrelated work
47
+ - For DOM-based tests, use `data-testid` attributes to select elements rather than CSS classes, tag names, or text content
48
+ - Avoid hard-coded timeouts both in form of sleep() or timeout: 5000 etc; use proper async patterns (`waitFor`, `findBy*`, event-based sync) instead and rely on global test configs for timeout settings
49
+
50
+ 2. **Green Phase**: Write MINIMAL code to make the test pass
51
+ - Implement only what's needed for the current failing test
52
+ - No anticipatory coding or extra features
53
+ - Address the specific failure message
54
+
55
+ 3. **Refactor Phase**: Improve code structure while keeping tests green
56
+ - Only allowed when relevant tests are passing
57
+ - Requires proof that tests have been run and are green
58
+ - Applies to BOTH implementation and test code
59
+ - No refactoring with failing tests - fix them first
60
+
61
+ ### Core Violations
62
+
63
+ 1. **Multiple Test Addition**
64
+ - Adding more than one new test at once
65
+ - Exception: Initial test file setup or extracting shared test utilities
66
+
67
+ 2. **Over-Implementation**
68
+ - Code that exceeds what's needed to pass the current failing test
69
+ - Adding untested features, methods, or error handling
70
+ - Implementing multiple methods when test only requires one
71
+
72
+ 3. **Premature Implementation**
73
+ - Adding implementation before a test exists and fails properly
74
+ - Adding implementation without running the test first
75
+ - Refactoring when tests haven't been run or are failing
76
+
77
+ ### Critical Principle: Incremental Development
78
+
79
+ Each step in TDD should address ONE specific issue:
80
+
81
+ - Test fails "not defined" → Create empty stub/class only
82
+ - Test fails "not a function" → Add method stub only
83
+ - Test fails with assertion → Implement minimal logic only
84
+
85
+ ### Optional Pre-Phase: Spike Phase
86
+
87
+ In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
88
+ This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
89
+
90
+ - The goal of a Spike is **exploration and learning**, not implementation.
91
+ - The code written during a Spike is **disposable** and **must not** be merged or reused directly.
92
+ - Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
93
+ - A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
94
+
95
+ ### General Information
96
+
97
+ - Sometimes the test output shows as no tests have been run when a new test is failing due to a missing import or constructor. In such cases, allow the agent to create simple stubs. Ask them if they forgot to create a stub if they are stuck.
98
+ - It is never allowed to introduce new logic without evidence of relevant failing tests. However, stubs and simple implementation to make imports and test infrastructure work is fine.
99
+ - In the refactor phase, it is perfectly fine to refactor both test and implementation code. That said, completely new functionality is not allowed. Types, clean up, abstractions, and helpers are allowed as long as they do not introduce new behavior.
100
+ - Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
101
+ - Provide the agent with helpful directions so that they do not get stuck when blocking them.
102
+
103
+ ## 🛡 Project Rules (Injected into every command)
104
+
105
+ 1. **NO BROKEN BUILDS:**
106
+ - Run `pnpm test` before every `/commit`
107
+ - Ensure all tests pass
108
+ - Fix any type errors immediately
109
+
110
+ 2. **API DEVELOPMENT:**
111
+ - All new APIs MUST have Zod request/response schemas
112
+ - All APIs MUST be documented in both:
113
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
114
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
115
+ - Test ALL parameters and edge cases
116
+ - Include code examples and real-world outputs
117
+
118
+ 3. **TDD WORKFLOW:**
119
+ - ALWAYS use /red → /green → /refactor cycle
120
+ - NEVER write implementation without failing test first
121
+ - Use /cycle for feature development
122
+ - Use characterization tests for refactoring
123
+
124
+ 4. **API KEY MANAGEMENT:**
125
+ - Support three loading methods:
126
+ - Server environment variables
127
+ - NEXT*PUBLIC* variables (client-side)
128
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
129
+ - Never hardcode API keys
130
+ - Always validate key availability before use
131
+
132
+ 5. **COMPREHENSIVE TESTING:**
133
+ - When researching APIs, read actual implementation code
134
+ - Discover ALL possible parameters (not just documented ones)
135
+ - Test with various parameter combinations
136
+ - Document custom headers, query params, request/response schemas
137
+ - Include validation rules and testing notes
138
+
139
+ 6. **NO UI BLOAT:**
140
+ - This is an API project with minimal frontend
141
+ - Only keep necessary test/documentation interfaces
142
+ - Delete unused components immediately
143
+ - No unnecessary UI libraries or features
144
+
145
+ 7. **DOCUMENTATION:**
146
+ - If you change an API, you MUST update:
147
+ - OpenAPI spec
148
+ - api-tests-manifest.json
149
+ - Code examples
150
+ - Testing notes
151
+ - Document expected behavior and edge cases
152
+ - Include real-world output examples