@hustle-together/api-dev-tools 3.10.1 → 3.11.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 (96) hide show
  1. package/.claude/api-dev-state.json +159 -0
  2. package/.claude/commands/README.md +185 -0
  3. package/.claude/commands/add-command.md +209 -0
  4. package/.claude/commands/api-create.md +499 -0
  5. package/.claude/commands/api-env.md +50 -0
  6. package/.claude/commands/api-interview.md +331 -0
  7. package/.claude/commands/api-research.md +331 -0
  8. package/.claude/commands/api-status.md +259 -0
  9. package/.claude/commands/api-verify.md +231 -0
  10. package/.claude/commands/beepboop.md +97 -0
  11. package/.claude/commands/busycommit.md +112 -0
  12. package/.claude/commands/commit.md +83 -0
  13. package/.claude/commands/cycle.md +142 -0
  14. package/.claude/commands/gap.md +86 -0
  15. package/.claude/commands/green.md +142 -0
  16. package/.claude/commands/issue.md +192 -0
  17. package/.claude/commands/plan.md +168 -0
  18. package/.claude/commands/pr.md +122 -0
  19. package/.claude/commands/red.md +142 -0
  20. package/.claude/commands/refactor.md +142 -0
  21. package/.claude/commands/spike.md +142 -0
  22. package/.claude/commands/summarize.md +94 -0
  23. package/.claude/commands/tdd.md +144 -0
  24. package/.claude/commands/worktree-add.md +315 -0
  25. package/.claude/commands/worktree-cleanup.md +281 -0
  26. package/.claude/hooks/api-workflow-check.py +227 -0
  27. package/.claude/hooks/enforce-deep-research.py +185 -0
  28. package/.claude/hooks/enforce-disambiguation.py +155 -0
  29. package/.claude/hooks/enforce-documentation.py +192 -0
  30. package/.claude/hooks/enforce-environment.py +253 -0
  31. package/.claude/hooks/enforce-external-research.py +328 -0
  32. package/.claude/hooks/enforce-interview.py +421 -0
  33. package/.claude/hooks/enforce-refactor.py +189 -0
  34. package/.claude/hooks/enforce-research.py +159 -0
  35. package/.claude/hooks/enforce-schema.py +186 -0
  36. package/.claude/hooks/enforce-scope.py +160 -0
  37. package/.claude/hooks/enforce-tdd-red.py +250 -0
  38. package/.claude/hooks/enforce-verify.py +186 -0
  39. package/.claude/hooks/periodic-reground.py +154 -0
  40. package/.claude/hooks/session-startup.py +151 -0
  41. package/.claude/hooks/track-tool-use.py +626 -0
  42. package/.claude/hooks/verify-after-green.py +282 -0
  43. package/.claude/hooks/verify-implementation.py +225 -0
  44. package/.claude/research/index.json +6 -0
  45. package/.claude/settings.json +93 -0
  46. package/.claude/settings.local.json +11 -0
  47. package/.claude-plugin/marketplace.json +112 -0
  48. package/.skills/README.md +291 -0
  49. package/.skills/_shared/convert-commands.py +192 -0
  50. package/.skills/_shared/hooks/api-workflow-check.py +227 -0
  51. package/.skills/_shared/hooks/enforce-deep-research.py +185 -0
  52. package/.skills/_shared/hooks/enforce-disambiguation.py +155 -0
  53. package/.skills/_shared/hooks/enforce-documentation.py +192 -0
  54. package/.skills/_shared/hooks/enforce-environment.py +253 -0
  55. package/.skills/_shared/hooks/enforce-external-research.py +328 -0
  56. package/.skills/_shared/hooks/enforce-interview.py +421 -0
  57. package/.skills/_shared/hooks/enforce-refactor.py +189 -0
  58. package/.skills/_shared/hooks/enforce-research.py +159 -0
  59. package/.skills/_shared/hooks/enforce-schema.py +186 -0
  60. package/.skills/_shared/hooks/enforce-scope.py +160 -0
  61. package/.skills/_shared/hooks/enforce-tdd-red.py +250 -0
  62. package/.skills/_shared/hooks/enforce-verify.py +186 -0
  63. package/.skills/_shared/hooks/periodic-reground.py +154 -0
  64. package/.skills/_shared/hooks/session-startup.py +151 -0
  65. package/.skills/_shared/hooks/track-tool-use.py +626 -0
  66. package/.skills/_shared/hooks/verify-after-green.py +282 -0
  67. package/.skills/_shared/hooks/verify-implementation.py +225 -0
  68. package/.skills/_shared/install.sh +114 -0
  69. package/.skills/_shared/settings.json +93 -0
  70. package/.skills/add-command/SKILL.md +222 -0
  71. package/.skills/api-create/SKILL.md +512 -0
  72. package/.skills/api-env/SKILL.md +63 -0
  73. package/.skills/api-interview/SKILL.md +344 -0
  74. package/.skills/api-research/SKILL.md +344 -0
  75. package/.skills/api-status/SKILL.md +272 -0
  76. package/.skills/api-verify/SKILL.md +244 -0
  77. package/.skills/beepboop/SKILL.md +110 -0
  78. package/.skills/busycommit/SKILL.md +125 -0
  79. package/.skills/commit/SKILL.md +96 -0
  80. package/.skills/cycle/SKILL.md +155 -0
  81. package/.skills/gap/SKILL.md +99 -0
  82. package/.skills/green/SKILL.md +155 -0
  83. package/.skills/issue/SKILL.md +205 -0
  84. package/.skills/plan/SKILL.md +181 -0
  85. package/.skills/pr/SKILL.md +135 -0
  86. package/.skills/red/SKILL.md +155 -0
  87. package/.skills/refactor/SKILL.md +155 -0
  88. package/.skills/spike/SKILL.md +155 -0
  89. package/.skills/summarize/SKILL.md +107 -0
  90. package/.skills/tdd/SKILL.md +157 -0
  91. package/.skills/update-todos/SKILL.md +228 -0
  92. package/.skills/worktree-add/SKILL.md +328 -0
  93. package/.skills/worktree-cleanup/SKILL.md +294 -0
  94. package/CHANGELOG.md +97 -0
  95. package/README.md +58 -17
  96. package/package.json +22 -11
@@ -0,0 +1,205 @@
1
+ ---
2
+ name: issue
3
+ description: Analyze GitHub issue and create TDD implementation plan. Converts issue requirements into executable tasks with acceptance criteria. Use when starting work from issues. Keywords: github, issues, planning, tdd, requirements
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: "workflow"
9
+ tags: ['github', 'issues', 'planning', 'tdd']
10
+ author: "Hustle Together"
11
+ allowed-tools: WebSearch WebFetch mcp__context7 mcp__github AskUserQuestion Read Write Edit Bash TodoWrite
12
+ ---
13
+
14
+ ---
15
+ description: Analyze GitHub issue and create TDD implementation plan
16
+ argument-hint: [optional-issue-number]
17
+ ---
18
+
19
+ Analyze GitHub issue and create TDD implementation plan.
20
+
21
+ ## General Guidelines
22
+
23
+ ### Output Style
24
+
25
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
26
+ - Write natural, descriptive code without meta-commentary about the development process
27
+ - The code should speak for itself - TDD is the process, not the product
28
+
29
+ Process:
30
+
31
+ 1. Get Issue Number
32
+
33
+ - Either from branch name use that issue number
34
+ - Patterns: issue-123, 123-feature, feature/123, fix/123
35
+ - Or from this bullet point with custom info: $ARGUMENTS
36
+ - If not found: ask user
37
+
38
+ 1. Fetch Issue
39
+
40
+ Try to fetch the issue using GitHub MCP (mcp__github__issue_read tool).
41
+
42
+ If GitHub MCP is not configured, show:
43
+
44
+ ```
45
+ GitHub MCP not configured!
46
+ See: https://github.com/modelcontextprotocol/servers/tree/main/src/github
47
+ Trying GitHub CLI fallback...
48
+ ```
49
+
50
+ Then try using `gh issue view [ISSUE_NUMBER] --json` as fallback.
51
+
52
+ 1. Analyze and Plan
53
+
54
+ Summarize the issue and requirements, then:
55
+
56
+ ## Discovery Phase
57
+
58
+ Understand the requirement by asking (use AskUserQuestion if needed):
59
+
60
+ **Problem Statement**
61
+
62
+ - What problem does this solve?
63
+ - Who experiences this problem?
64
+ - What's the current pain point?
65
+
66
+ **Desired Outcome**
67
+
68
+ - What should happen after this is built?
69
+ - How will users interact with it?
70
+ - What does success look like?
71
+
72
+ **Scope & Constraints**
73
+
74
+ - What's in scope vs. out of scope?
75
+ - Any technical constraints?
76
+ - Dependencies on other systems/features?
77
+
78
+ **Context Check**
79
+
80
+ - Search codebase for related features/modules
81
+ - Check for existing test files that might be relevant
82
+
83
+ ## TDD Fundamentals
84
+
85
+ ### The TDD Cycle
86
+
87
+ The foundation of TDD is the Red-Green-Refactor cycle:
88
+
89
+ 1. **Red Phase**: Write ONE failing test that describes desired behavior
90
+
91
+ - The test must fail for the RIGHT reason (not syntax/import errors)
92
+ - Only one test at a time - this is critical for TDD discipline
93
+ - 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.
94
+ - **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
95
+ - Starting TDD for a new feature is always valid, even if test output shows unrelated work
96
+ - For DOM-based tests, use `data-testid` attributes to select elements rather than CSS classes, tag names, or text content
97
+ - 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
98
+
99
+ 2. **Green Phase**: Write MINIMAL code to make the test pass
100
+
101
+ - Implement only what's needed for the current failing test
102
+ - No anticipatory coding or extra features
103
+ - Address the specific failure message
104
+
105
+ 3. **Refactor Phase**: Improve code structure while keeping tests green
106
+ - Only allowed when relevant tests are passing
107
+ - Requires proof that tests have been run and are green
108
+ - Applies to BOTH implementation and test code
109
+ - No refactoring with failing tests - fix them first
110
+
111
+ ### Core Violations
112
+
113
+ 1. **Multiple Test Addition**
114
+
115
+ - Adding more than one new test at once
116
+ - Exception: Initial test file setup or extracting shared test utilities
117
+
118
+ 2. **Over-Implementation**
119
+
120
+ - Code that exceeds what's needed to pass the current failing test
121
+ - Adding untested features, methods, or error handling
122
+ - Implementing multiple methods when test only requires one
123
+
124
+ 3. **Premature Implementation**
125
+ - Adding implementation before a test exists and fails properly
126
+ - Adding implementation without running the test first
127
+ - Refactoring when tests haven't been run or are failing
128
+
129
+ ### Critical Principle: Incremental Development
130
+
131
+ Each step in TDD should address ONE specific issue:
132
+
133
+ - Test fails "not defined" → Create empty stub/class only
134
+ - Test fails "not a function" → Add method stub only
135
+ - Test fails with assertion → Implement minimal logic only
136
+
137
+ ### Optional Pre-Phase: Spike Phase
138
+
139
+ In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
140
+ This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
141
+
142
+ - The goal of a Spike is **exploration and learning**, not implementation.
143
+ - The code written during a Spike is **disposable** and **must not** be merged or reused directly.
144
+ - Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
145
+ - A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
146
+
147
+ ### General Information
148
+
149
+ - 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.
150
+ - 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.
151
+ - 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.
152
+ - Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
153
+ - Provide the agent with helpful directions so that they do not get stuck when blocking them.
154
+
155
+
156
+ ## 🛡 Project Rules (Injected into every command)
157
+
158
+ 1. **NO BROKEN BUILDS:**
159
+ - Run `pnpm test` before every `/commit`
160
+ - Ensure all tests pass
161
+ - Fix any type errors immediately
162
+
163
+ 2. **API DEVELOPMENT:**
164
+ - All new APIs MUST have Zod request/response schemas
165
+ - All APIs MUST be documented in both:
166
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
167
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
168
+ - Test ALL parameters and edge cases
169
+ - Include code examples and real-world outputs
170
+
171
+ 3. **TDD WORKFLOW:**
172
+ - ALWAYS use /red → /green → /refactor cycle
173
+ - NEVER write implementation without failing test first
174
+ - Use /cycle for feature development
175
+ - Use characterization tests for refactoring
176
+
177
+ 4. **API KEY MANAGEMENT:**
178
+ - Support three loading methods:
179
+ - Server environment variables
180
+ - NEXT_PUBLIC_ variables (client-side)
181
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
182
+ - Never hardcode API keys
183
+ - Always validate key availability before use
184
+
185
+ 5. **COMPREHENSIVE TESTING:**
186
+ - When researching APIs, read actual implementation code
187
+ - Discover ALL possible parameters (not just documented ones)
188
+ - Test with various parameter combinations
189
+ - Document custom headers, query params, request/response schemas
190
+ - Include validation rules and testing notes
191
+
192
+ 6. **NO UI BLOAT:**
193
+ - This is an API project with minimal frontend
194
+ - Only keep necessary test/documentation interfaces
195
+ - Delete unused components immediately
196
+ - No unnecessary UI libraries or features
197
+
198
+ 7. **DOCUMENTATION:**
199
+ - If you change an API, you MUST update:
200
+ - OpenAPI spec
201
+ - api-tests-manifest.json
202
+ - Code examples
203
+ - Testing notes
204
+ - Document expected behavior and edge cases
205
+ - Include real-world output examples
@@ -0,0 +1,181 @@
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
+ description: Create implementation plan from feature/requirement with PRD-style discovery and TDD acceptance criteria
16
+ argument-hint: <feature/requirement description or GitHub issue URL/number>
17
+ ---
18
+
19
+ # Plan: PRD-Informed Task Planning for TDD
20
+
21
+ Create structured implementation plan that bridges product thinking (PRD) with test-driven development.
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
+ ## Input
32
+
33
+ $ARGUMENTS
34
+
35
+ (If no input provided, check conversation context)
36
+
37
+ ## Input Processing
38
+
39
+ The input can be one of:
40
+
41
+ 1. **GitHub Issue URL** (e.g., `https://github.com/owner/repo/issues/123`)
42
+ 2. **GitHub Issue Number** (e.g., `#123` or `123`)
43
+ 3. **Feature Description** (e.g., "Add user authentication")
44
+ 4. **Empty** - use conversation context
45
+
46
+ ### GitHub Issue Integration
47
+
48
+ If input looks like a GitHub issue:
49
+
50
+ **Step 1: Extract Issue Number**
51
+
52
+ - From URL: extract owner/repo/number
53
+ - From number: try to infer repo from git remote
54
+ - From branch name: check patterns like `issue-123`, `123-feature`, `feature/123`
55
+
56
+ **Step 2: Fetch Issue**
57
+ Try GitHub MCP first:
58
+
59
+ - If available: use `mcp__github__issue_read` to fetch issue details
60
+ - If not available: show message and try `gh issue view <number>`
61
+
62
+ ```
63
+ GitHub MCP not configured!
64
+ See: https://github.com/modelcontextprotocol/servers/tree/main/src/github
65
+ Trying GitHub CLI fallback...
66
+ ```
67
+
68
+ **Step 3: Use Issue as Discovery Input**
69
+
70
+ - Title → Feature name
71
+ - Description → Problem statement and context
72
+ - Labels → Type/priority hints
73
+ - Comments → Additional requirements and discussion
74
+ - Linked issues → Dependencies
75
+
76
+ Extract from GitHub issue:
77
+
78
+ - Problem statement and context
79
+ - Acceptance criteria (if present)
80
+ - Technical notes (if present)
81
+ - Related issues/dependencies
82
+
83
+ ## Process
84
+
85
+ ## Discovery Phase
86
+
87
+ Understand the requirement by asking (use AskUserQuestion if needed):
88
+
89
+ **Problem Statement**
90
+
91
+ - What problem does this solve?
92
+ - Who experiences this problem?
93
+ - What's the current pain point?
94
+
95
+ **Desired Outcome**
96
+
97
+ - What should happen after this is built?
98
+ - How will users interact with it?
99
+ - What does success look like?
100
+
101
+ **Scope & Constraints**
102
+
103
+ - What's in scope vs. out of scope?
104
+ - Any technical constraints?
105
+ - Dependencies on other systems/features?
106
+
107
+ **Context Check**
108
+
109
+ - Search codebase for related features/modules
110
+ - Check for existing test files that might be relevant
111
+
112
+ ## Key Principles
113
+
114
+ **From PRD World:**
115
+
116
+ - Start with user problems, not solutions
117
+ - Define success criteria upfront
118
+ - Understand constraints and scope
119
+
120
+ **From TDD World:**
121
+
122
+ - Make acceptance criteria test-ready
123
+ - Break work into small, testable pieces
124
+ - Each task should map to test(s)
125
+
126
+ ## Integration with Other Commands
127
+
128
+ - **Before /plan**: Use `/spike` if you need technical exploration first
129
+ - **After /plan**: Use `/red` to start TDD on first task
130
+
131
+
132
+ ## 🛡 Project Rules (Injected into every command)
133
+
134
+ 1. **NO BROKEN BUILDS:**
135
+ - Run `pnpm test` before every `/commit`
136
+ - Ensure all tests pass
137
+ - Fix any type errors immediately
138
+
139
+ 2. **API DEVELOPMENT:**
140
+ - All new APIs MUST have Zod request/response schemas
141
+ - All APIs MUST be documented in both:
142
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
143
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
144
+ - Test ALL parameters and edge cases
145
+ - Include code examples and real-world outputs
146
+
147
+ 3. **TDD WORKFLOW:**
148
+ - ALWAYS use /red → /green → /refactor cycle
149
+ - NEVER write implementation without failing test first
150
+ - Use /cycle for feature development
151
+ - Use characterization tests for refactoring
152
+
153
+ 4. **API KEY MANAGEMENT:**
154
+ - Support three loading methods:
155
+ - Server environment variables
156
+ - NEXT_PUBLIC_ variables (client-side)
157
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
158
+ - Never hardcode API keys
159
+ - Always validate key availability before use
160
+
161
+ 5. **COMPREHENSIVE TESTING:**
162
+ - When researching APIs, read actual implementation code
163
+ - Discover ALL possible parameters (not just documented ones)
164
+ - Test with various parameter combinations
165
+ - Document custom headers, query params, request/response schemas
166
+ - Include validation rules and testing notes
167
+
168
+ 6. **NO UI BLOAT:**
169
+ - This is an API project with minimal frontend
170
+ - Only keep necessary test/documentation interfaces
171
+ - Delete unused components immediately
172
+ - No unnecessary UI libraries or features
173
+
174
+ 7. **DOCUMENTATION:**
175
+ - If you change an API, you MUST update:
176
+ - OpenAPI spec
177
+ - api-tests-manifest.json
178
+ - Code examples
179
+ - Testing notes
180
+ - Document expected behavior and edge cases
181
+ - Include real-world output examples
@@ -0,0 +1,135 @@
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
+ description: Creates a pull request using GitHub MCP
16
+ argument-hint: [optional-pr-title-and-description]
17
+ ---
18
+
19
+ # Create Pull Request
20
+
21
+ ## General Guidelines
22
+
23
+ ### Output Style
24
+
25
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
26
+ - Write natural, descriptive code without meta-commentary about the development process
27
+ - The code should speak for itself - TDD is the process, not the product
28
+
29
+ Create a pull request for the current branch using GitHub MCP tools.
30
+
31
+ ## Workflow
32
+
33
+ Current branch status:
34
+ !`git status`
35
+
36
+ Recent commits:
37
+ !`git log --oneline -5`
38
+
39
+ Arguments: $ARGUMENTS
40
+
41
+ **Process:**
42
+
43
+ 1. **Ensure Branch is Ready**:
44
+ !`git status`
45
+ - Commit all changes
46
+ - Push to remote: `git push origin [branch-name]`
47
+
48
+ 2. **Create PR**: Create a well-formatted pull request
49
+
50
+ Title: conventional commits format, like `feat(#123): add user authentication`
51
+
52
+ Description template:
53
+
54
+ ```markdown
55
+ <!--
56
+ Are there any relevant issues / PRs / mailing lists discussions?
57
+ Please reference them here.
58
+ -->
59
+
60
+ ## References
61
+
62
+ - [links to github issues referenced in commit messages]
63
+
64
+ ## Summary
65
+
66
+ [Brief description of changes]
67
+
68
+ ## Test Plan
69
+
70
+ - [ ] Tests pass
71
+ - [ ] Manual testing completed
72
+ ```
73
+
74
+ 3. **Set Base Branch**: Default to main unless specified otherwise
75
+
76
+ 4. **Link Issues**: Reference related issues found in commit messages
77
+
78
+ ## Use GitHub MCP Tools
79
+
80
+ 1. Check current branch and ensure it's pushed
81
+ 2. Create a well-formatted pull request with proper title and description
82
+ 3. Set the base branch (default: main)
83
+ 4. Include relevant issue references if found in commit messages
84
+
85
+
86
+ ## 🛡 Project Rules (Injected into every command)
87
+
88
+ 1. **NO BROKEN BUILDS:**
89
+ - Run `pnpm test` before every `/commit`
90
+ - Ensure all tests pass
91
+ - Fix any type errors immediately
92
+
93
+ 2. **API DEVELOPMENT:**
94
+ - All new APIs MUST have Zod request/response schemas
95
+ - All APIs MUST be documented in both:
96
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
97
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
98
+ - Test ALL parameters and edge cases
99
+ - Include code examples and real-world outputs
100
+
101
+ 3. **TDD WORKFLOW:**
102
+ - ALWAYS use /red → /green → /refactor cycle
103
+ - NEVER write implementation without failing test first
104
+ - Use /cycle for feature development
105
+ - Use characterization tests for refactoring
106
+
107
+ 4. **API KEY MANAGEMENT:**
108
+ - Support three loading methods:
109
+ - Server environment variables
110
+ - NEXT_PUBLIC_ variables (client-side)
111
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
112
+ - Never hardcode API keys
113
+ - Always validate key availability before use
114
+
115
+ 5. **COMPREHENSIVE TESTING:**
116
+ - When researching APIs, read actual implementation code
117
+ - Discover ALL possible parameters (not just documented ones)
118
+ - Test with various parameter combinations
119
+ - Document custom headers, query params, request/response schemas
120
+ - Include validation rules and testing notes
121
+
122
+ 6. **NO UI BLOAT:**
123
+ - This is an API project with minimal frontend
124
+ - Only keep necessary test/documentation interfaces
125
+ - Delete unused components immediately
126
+ - No unnecessary UI libraries or features
127
+
128
+ 7. **DOCUMENTATION:**
129
+ - If you change an API, you MUST update:
130
+ - OpenAPI spec
131
+ - api-tests-manifest.json
132
+ - Code examples
133
+ - Testing notes
134
+ - Document expected behavior and edge cases
135
+ - Include real-world output examples
@@ -0,0 +1,155 @@
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
+ description: Execute TDD Red Phase - write ONE failing test
16
+ argument-hint: [optional additional info]
17
+ ---
18
+
19
+ RED PHASE! Apply the below to the info given by user input here:
20
+
21
+ $ARGUMENTS
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
+ (If there was no info above, fallback to the context of the conversation)
32
+
33
+ ## TDD Fundamentals
34
+
35
+ ### The TDD Cycle
36
+
37
+ The foundation of TDD is the Red-Green-Refactor cycle:
38
+
39
+ 1. **Red Phase**: Write ONE failing test that describes desired behavior
40
+
41
+ - The test must fail for the RIGHT reason (not syntax/import errors)
42
+ - Only one test at a time - this is critical for TDD discipline
43
+ - 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.
44
+ - **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
45
+ - Starting TDD for a new feature is always valid, even if test output shows unrelated work
46
+ - For DOM-based tests, use `data-testid` attributes to select elements rather than CSS classes, tag names, or text content
47
+ - 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
48
+
49
+ 2. **Green Phase**: Write MINIMAL code to make the test pass
50
+
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
+
65
+ - Adding more than one new test at once
66
+ - Exception: Initial test file setup or extracting shared test utilities
67
+
68
+ 2. **Over-Implementation**
69
+
70
+ - Code that exceeds what's needed to pass the current failing test
71
+ - Adding untested features, methods, or error handling
72
+ - Implementing multiple methods when test only requires one
73
+
74
+ 3. **Premature Implementation**
75
+ - Adding implementation before a test exists and fails properly
76
+ - Adding implementation without running the test first
77
+ - Refactoring when tests haven't been run or are failing
78
+
79
+ ### Critical Principle: Incremental Development
80
+
81
+ Each step in TDD should address ONE specific issue:
82
+
83
+ - Test fails "not defined" → Create empty stub/class only
84
+ - Test fails "not a function" → Add method stub only
85
+ - Test fails with assertion → Implement minimal logic only
86
+
87
+ ### Optional Pre-Phase: Spike Phase
88
+
89
+ In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
90
+ This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
91
+
92
+ - The goal of a Spike is **exploration and learning**, not implementation.
93
+ - The code written during a Spike is **disposable** and **must not** be merged or reused directly.
94
+ - Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
95
+ - A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
96
+
97
+ ### General Information
98
+
99
+ - 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.
100
+ - 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.
101
+ - 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.
102
+ - Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
103
+ - Provide the agent with helpful directions so that they do not get stuck when blocking them.
104
+
105
+
106
+ ## 🛡 Project Rules (Injected into every command)
107
+
108
+ 1. **NO BROKEN BUILDS:**
109
+ - Run `pnpm test` before every `/commit`
110
+ - Ensure all tests pass
111
+ - Fix any type errors immediately
112
+
113
+ 2. **API DEVELOPMENT:**
114
+ - All new APIs MUST have Zod request/response schemas
115
+ - All APIs MUST be documented in both:
116
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
117
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
118
+ - Test ALL parameters and edge cases
119
+ - Include code examples and real-world outputs
120
+
121
+ 3. **TDD WORKFLOW:**
122
+ - ALWAYS use /red → /green → /refactor cycle
123
+ - NEVER write implementation without failing test first
124
+ - Use /cycle for feature development
125
+ - Use characterization tests for refactoring
126
+
127
+ 4. **API KEY MANAGEMENT:**
128
+ - Support three loading methods:
129
+ - Server environment variables
130
+ - NEXT_PUBLIC_ variables (client-side)
131
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
132
+ - Never hardcode API keys
133
+ - Always validate key availability before use
134
+
135
+ 5. **COMPREHENSIVE TESTING:**
136
+ - When researching APIs, read actual implementation code
137
+ - Discover ALL possible parameters (not just documented ones)
138
+ - Test with various parameter combinations
139
+ - Document custom headers, query params, request/response schemas
140
+ - Include validation rules and testing notes
141
+
142
+ 6. **NO UI BLOAT:**
143
+ - This is an API project with minimal frontend
144
+ - Only keep necessary test/documentation interfaces
145
+ - Delete unused components immediately
146
+ - No unnecessary UI libraries or features
147
+
148
+ 7. **DOCUMENTATION:**
149
+ - If you change an API, you MUST update:
150
+ - OpenAPI spec
151
+ - api-tests-manifest.json
152
+ - Code examples
153
+ - Testing notes
154
+ - Document expected behavior and edge cases
155
+ - Include real-world output examples