@hustle-together/api-dev-tools 3.10.0 → 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 (97) 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 +66 -20
  96. package/bin/cli.js +7 -6
  97. package/package.json +22 -11
@@ -0,0 +1,125 @@
1
+ ---
2
+ name: busycommit
3
+ description: Create multiple atomic git commits, one logical change at a time. Analyzes changes and separates into meaningful commits. Use for complex changesets. Keywords: git, commit, atomic, granular, organization
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', 'commit', 'atomic', 'granular']
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 multiple atomic git commits, one logical change at a time
16
+ argument-hint: [optional-commit-description]
17
+ ---
18
+
19
+ ## General Guidelines
20
+
21
+ ### Output Style
22
+
23
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
24
+ - Write natural, descriptive code without meta-commentary about the development process
25
+ - The code should speak for itself - TDD is the process, not the product
26
+
27
+ Create multiple atomic git commits, committing the smallest possible logical unit at a time
28
+
29
+ Include any of the following info if specified: $ARGUMENTS
30
+
31
+ ## Process
32
+
33
+ 1. Run `git status` and `git diff` to review changes
34
+ 2. Run `git log --oneline -5` to see recent commit style
35
+ 3. Stage relevant files with `git add`
36
+ 4. Create commit with descriptive message
37
+ 5. Verify with `git status`
38
+
39
+ ## Example
40
+
41
+ ```bash
42
+ git add <files>
43
+ git commit -m "feat(#123): add validation to user input form"
44
+ ```
45
+
46
+ ## Atomic Commit Approach
47
+
48
+ Each commit should represent ONE logical change. Do NOT bundle multiple unrelated changes into one commit.
49
+
50
+ - Identify the smallest atomic units of change
51
+ - For EACH atomic unit: stage only those files/hunks, commit, verify
52
+ - Use `git add -p` to stage partial file changes when a file contains multiple logical changes
53
+ - Repeat until all changes are committed
54
+ - It is OK to create multiple commits without stopping - keep going until `git status` shows clean
55
+
56
+ ## Multi-Commit Example
57
+
58
+ If a single file contains multiple unrelated changes, use `git add -p` to stage hunks interactively:
59
+
60
+ ```bash
61
+ # Stage only the validation-related hunks from the file
62
+ git add -p src/user-service.ts
63
+ # Select 'y' for validation hunks, 'n' for others
64
+ git commit -m "feat(#123): add email format validation"
65
+
66
+ # Stage the error handling hunks
67
+ git add -p src/user-service.ts
68
+ git commit -m "fix(#124): handle null user gracefully"
69
+
70
+ # Stage remaining changes
71
+ git add src/user-service.ts
72
+ git commit -m "refactor: extract user lookup to helper"
73
+ ```
74
+
75
+
76
+ ## 🛡 Project Rules (Injected into every command)
77
+
78
+ 1. **NO BROKEN BUILDS:**
79
+ - Run `pnpm test` before every `/commit`
80
+ - Ensure all tests pass
81
+ - Fix any type errors immediately
82
+
83
+ 2. **API DEVELOPMENT:**
84
+ - All new APIs MUST have Zod request/response schemas
85
+ - All APIs MUST be documented in both:
86
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
87
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
88
+ - Test ALL parameters and edge cases
89
+ - Include code examples and real-world outputs
90
+
91
+ 3. **TDD WORKFLOW:**
92
+ - ALWAYS use /red → /green → /refactor cycle
93
+ - NEVER write implementation without failing test first
94
+ - Use /cycle for feature development
95
+ - Use characterization tests for refactoring
96
+
97
+ 4. **API KEY MANAGEMENT:**
98
+ - Support three loading methods:
99
+ - Server environment variables
100
+ - NEXT_PUBLIC_ variables (client-side)
101
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
102
+ - Never hardcode API keys
103
+ - Always validate key availability before use
104
+
105
+ 5. **COMPREHENSIVE TESTING:**
106
+ - When researching APIs, read actual implementation code
107
+ - Discover ALL possible parameters (not just documented ones)
108
+ - Test with various parameter combinations
109
+ - Document custom headers, query params, request/response schemas
110
+ - Include validation rules and testing notes
111
+
112
+ 6. **NO UI BLOAT:**
113
+ - This is an API project with minimal frontend
114
+ - Only keep necessary test/documentation interfaces
115
+ - Delete unused components immediately
116
+ - No unnecessary UI libraries or features
117
+
118
+ 7. **DOCUMENTATION:**
119
+ - If you change an API, you MUST update:
120
+ - OpenAPI spec
121
+ - api-tests-manifest.json
122
+ - Code examples
123
+ - Testing notes
124
+ - Document expected behavior and edge cases
125
+ - Include real-world output examples
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: commit
3
+ description: Create semantic git commit following project standards with co-author attribution. Analyzes staged changes, suggests commit message. Use after completing features. Keywords: git, commit, semantic, versioning, attribution
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', 'commit', 'semantic', 'versioning']
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 a git commit following project standards
16
+ argument-hint: [optional-commit-description]
17
+ ---
18
+
19
+ ## General Guidelines
20
+
21
+ ### Output Style
22
+
23
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
24
+ - Write natural, descriptive code without meta-commentary about the development process
25
+ - The code should speak for itself - TDD is the process, not the product
26
+
27
+ Create a git commit following project standards
28
+
29
+ Include any of the following info if specified: $ARGUMENTS
30
+
31
+ ## Process
32
+
33
+ 1. Run `git status` and `git diff` to review changes
34
+ 2. Run `git log --oneline -5` to see recent commit style
35
+ 3. Stage relevant files with `git add`
36
+ 4. Create commit with descriptive message
37
+ 5. Verify with `git status`
38
+
39
+ ## Example
40
+
41
+ ```bash
42
+ git add <files>
43
+ git commit -m "feat(#123): add validation to user input form"
44
+ ```
45
+
46
+
47
+ ## 🛡 Project Rules (Injected into every command)
48
+
49
+ 1. **NO BROKEN BUILDS:**
50
+ - Run `pnpm test` before every `/commit`
51
+ - Ensure all tests pass
52
+ - Fix any type errors immediately
53
+
54
+ 2. **API DEVELOPMENT:**
55
+ - All new APIs MUST have Zod request/response schemas
56
+ - All APIs MUST be documented in both:
57
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
58
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
59
+ - Test ALL parameters and edge cases
60
+ - Include code examples and real-world outputs
61
+
62
+ 3. **TDD WORKFLOW:**
63
+ - ALWAYS use /red → /green → /refactor cycle
64
+ - NEVER write implementation without failing test first
65
+ - Use /cycle for feature development
66
+ - Use characterization tests for refactoring
67
+
68
+ 4. **API KEY MANAGEMENT:**
69
+ - Support three loading methods:
70
+ - Server environment variables
71
+ - NEXT_PUBLIC_ variables (client-side)
72
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
73
+ - Never hardcode API keys
74
+ - Always validate key availability before use
75
+
76
+ 5. **COMPREHENSIVE TESTING:**
77
+ - When researching APIs, read actual implementation code
78
+ - Discover ALL possible parameters (not just documented ones)
79
+ - Test with various parameter combinations
80
+ - Document custom headers, query params, request/response schemas
81
+ - Include validation rules and testing notes
82
+
83
+ 6. **NO UI BLOAT:**
84
+ - This is an API project with minimal frontend
85
+ - Only keep necessary test/documentation interfaces
86
+ - Delete unused components immediately
87
+ - No unnecessary UI libraries or features
88
+
89
+ 7. **DOCUMENTATION:**
90
+ - If you change an API, you MUST update:
91
+ - OpenAPI spec
92
+ - api-tests-manifest.json
93
+ - Code examples
94
+ - Testing notes
95
+ - Document expected behavior and edge cases
96
+ - Include real-world output examples
@@ -0,0 +1,155 @@
1
+ ---
2
+ name: cycle
3
+ description: Execute complete TDD cycle - Red (write failing test) → Green (minimal implementation) → Refactor (cleanup). Use for feature development with single command. Keywords: tdd, cycle, workflow, testing, automation
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: ['tdd', 'cycle', 'workflow', 'testing']
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 complete TDD cycle - Red, Green, and Refactor phases in sequence
16
+ argument-hint: <feature or requirement description>
17
+ ---
18
+
19
+ RED+GREEN+REFACTOR (one cycle) 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
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: gap
3
+ description: Analyze conversation context for unaddressed items and gaps. Scans code vs requirements to find missing pieces. Use during code review or planning. Keywords: analysis, gaps, requirements, review, completeness
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: "analysis"
9
+ tags: ['analysis', 'gaps', 'requirements', 'review']
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 conversation context for unaddressed items and gaps
16
+ argument-hint: [optional additional info]
17
+ ---
18
+
19
+ ## General Guidelines
20
+
21
+ ### Output Style
22
+
23
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
24
+ - Write natural, descriptive code without meta-commentary about the development process
25
+ - The code should speak for itself - TDD is the process, not the product
26
+
27
+ Analyze the current conversation context and identify things that have not yet been addressed. Look for:
28
+
29
+ 1. **Incomplete implementations** - Code that was started but not finished
30
+ 2. **Unused variables/results** - Values that were captured but never used
31
+ 3. **Missing tests** - Functionality without test coverage
32
+ 4. **User requests** - Things the user asked for that weren't fully completed
33
+ 5. **TODO comments** - Any TODOs mentioned in conversation
34
+ 6. **Error handling gaps** - Missing error cases or edge cases
35
+ 7. **Documentation gaps** - Undocumented APIs or features
36
+ 8. **Consistency check** - Look for inconsistent patterns, naming conventions, or structure across the codebase
37
+
38
+ Present findings as a prioritized list with:
39
+
40
+ - What the gap is
41
+ - Why it matters
42
+ - Suggested next action
43
+
44
+ If there are no gaps, confirm that everything discussed has been addressed.
45
+
46
+ Additional info:
47
+ $ARGUMENTS
48
+
49
+
50
+ ## 🛡 Project Rules (Injected into every command)
51
+
52
+ 1. **NO BROKEN BUILDS:**
53
+ - Run `pnpm test` before every `/commit`
54
+ - Ensure all tests pass
55
+ - Fix any type errors immediately
56
+
57
+ 2. **API DEVELOPMENT:**
58
+ - All new APIs MUST have Zod request/response schemas
59
+ - All APIs MUST be documented in both:
60
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
61
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
62
+ - Test ALL parameters and edge cases
63
+ - Include code examples and real-world outputs
64
+
65
+ 3. **TDD WORKFLOW:**
66
+ - ALWAYS use /red → /green → /refactor cycle
67
+ - NEVER write implementation without failing test first
68
+ - Use /cycle for feature development
69
+ - Use characterization tests for refactoring
70
+
71
+ 4. **API KEY MANAGEMENT:**
72
+ - Support three loading methods:
73
+ - Server environment variables
74
+ - NEXT_PUBLIC_ variables (client-side)
75
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
76
+ - Never hardcode API keys
77
+ - Always validate key availability before use
78
+
79
+ 5. **COMPREHENSIVE TESTING:**
80
+ - When researching APIs, read actual implementation code
81
+ - Discover ALL possible parameters (not just documented ones)
82
+ - Test with various parameter combinations
83
+ - Document custom headers, query params, request/response schemas
84
+ - Include validation rules and testing notes
85
+
86
+ 6. **NO UI BLOAT:**
87
+ - This is an API project with minimal frontend
88
+ - Only keep necessary test/documentation interfaces
89
+ - Delete unused components immediately
90
+ - No unnecessary UI libraries or features
91
+
92
+ 7. **DOCUMENTATION:**
93
+ - If you change an API, you MUST update:
94
+ - OpenAPI spec
95
+ - api-tests-manifest.json
96
+ - Code examples
97
+ - Testing notes
98
+ - Document expected behavior and edge cases
99
+ - Include real-world output examples
@@ -0,0 +1,155 @@
1
+ ---
2
+ name: green
3
+ description: TDD Green Phase - write minimal implementation code to make the failing test pass. No over-engineering, just enough to pass. Use after writing failing tests. Keywords: tdd, testing, green-phase, implementation, minimal
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', 'green-phase', 'implementation']
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 Green Phase - write minimal implementation to pass the failing test
16
+ argument-hint: <implementation description>
17
+ ---
18
+
19
+ GREEN 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