@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,111 @@
1
+ ---
2
+ description: Create multiple atomic git commits, one logical change at a time
3
+ argument-hint: [optional-commit-description]
4
+ ---
5
+
6
+ ## General Guidelines
7
+
8
+ ### Output Style
9
+
10
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
11
+ - Write natural, descriptive code without meta-commentary about the development process
12
+ - The code should speak for itself - TDD is the process, not the product
13
+
14
+ Create multiple atomic git commits, committing the smallest possible logical unit at a time
15
+
16
+ Include any of the following info if specified: $ARGUMENTS
17
+
18
+ ## Process
19
+
20
+ 1. Run `git status` and `git diff` to review changes
21
+ 2. Run `git log --oneline -5` to see recent commit style
22
+ 3. Stage relevant files with `git add`
23
+ 4. Create commit with descriptive message
24
+ 5. Verify with `git status`
25
+
26
+ ## Example
27
+
28
+ ```bash
29
+ git add <files>
30
+ git commit -m "feat(#123): add validation to user input form"
31
+ ```
32
+
33
+ ## Atomic Commit Approach
34
+
35
+ Each commit should represent ONE logical change. Do NOT bundle multiple unrelated changes into one commit.
36
+
37
+ - Identify the smallest atomic units of change
38
+ - For EACH atomic unit: stage only those files/hunks, commit, verify
39
+ - Use `git add -p` to stage partial file changes when a file contains multiple logical changes
40
+ - Repeat until all changes are committed
41
+ - It is OK to create multiple commits without stopping - keep going until `git status` shows clean
42
+
43
+ ## Multi-Commit Example
44
+
45
+ If a single file contains multiple unrelated changes, use `git add -p` to stage hunks interactively:
46
+
47
+ ```bash
48
+ # Stage only the validation-related hunks from the file
49
+ git add -p src/user-service.ts
50
+ # Select 'y' for validation hunks, 'n' for others
51
+ git commit -m "feat(#123): add email format validation"
52
+
53
+ # Stage the error handling hunks
54
+ git add -p src/user-service.ts
55
+ git commit -m "fix(#124): handle null user gracefully"
56
+
57
+ # Stage remaining changes
58
+ git add src/user-service.ts
59
+ git commit -m "refactor: extract user lookup to helper"
60
+ ```
61
+
62
+ ## 🛡 Project Rules (Injected into every command)
63
+
64
+ 1. **NO BROKEN BUILDS:**
65
+ - Run `pnpm test` before every `/commit`
66
+ - Ensure all tests pass
67
+ - Fix any type errors immediately
68
+
69
+ 2. **API DEVELOPMENT:**
70
+ - All new APIs MUST have Zod request/response schemas
71
+ - All APIs MUST be documented in both:
72
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
73
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
74
+ - Test ALL parameters and edge cases
75
+ - Include code examples and real-world outputs
76
+
77
+ 3. **TDD WORKFLOW:**
78
+ - ALWAYS use /red → /green → /refactor cycle
79
+ - NEVER write implementation without failing test first
80
+ - Use /cycle for feature development
81
+ - Use characterization tests for refactoring
82
+
83
+ 4. **API KEY MANAGEMENT:**
84
+ - Support three loading methods:
85
+ - Server environment variables
86
+ - NEXT*PUBLIC* variables (client-side)
87
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
88
+ - Never hardcode API keys
89
+ - Always validate key availability before use
90
+
91
+ 5. **COMPREHENSIVE TESTING:**
92
+ - When researching APIs, read actual implementation code
93
+ - Discover ALL possible parameters (not just documented ones)
94
+ - Test with various parameter combinations
95
+ - Document custom headers, query params, request/response schemas
96
+ - Include validation rules and testing notes
97
+
98
+ 6. **NO UI BLOAT:**
99
+ - This is an API project with minimal frontend
100
+ - Only keep necessary test/documentation interfaces
101
+ - Delete unused components immediately
102
+ - No unnecessary UI libraries or features
103
+
104
+ 7. **DOCUMENTATION:**
105
+ - If you change an API, you MUST update:
106
+ - OpenAPI spec
107
+ - api-tests-manifest.json
108
+ - Code examples
109
+ - Testing notes
110
+ - Document expected behavior and edge cases
111
+ - Include real-world output examples
@@ -0,0 +1,82 @@
1
+ ---
2
+ description: Create a git commit following project standards
3
+ argument-hint: [optional-commit-description]
4
+ ---
5
+
6
+ ## General Guidelines
7
+
8
+ ### Output Style
9
+
10
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
11
+ - Write natural, descriptive code without meta-commentary about the development process
12
+ - The code should speak for itself - TDD is the process, not the product
13
+
14
+ Create a git commit following project standards
15
+
16
+ Include any of the following info if specified: $ARGUMENTS
17
+
18
+ ## Process
19
+
20
+ 1. Run `git status` and `git diff` to review changes
21
+ 2. Run `git log --oneline -5` to see recent commit style
22
+ 3. Stage relevant files with `git add`
23
+ 4. Create commit with descriptive message
24
+ 5. Verify with `git status`
25
+
26
+ ## Example
27
+
28
+ ```bash
29
+ git add <files>
30
+ git commit -m "feat(#123): add validation to user input form"
31
+ ```
32
+
33
+ ## 🛡 Project Rules (Injected into every command)
34
+
35
+ 1. **NO BROKEN BUILDS:**
36
+ - Run `pnpm test` before every `/commit`
37
+ - Ensure all tests pass
38
+ - Fix any type errors immediately
39
+
40
+ 2. **API DEVELOPMENT:**
41
+ - All new APIs MUST have Zod request/response schemas
42
+ - All APIs MUST be documented in both:
43
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
44
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
45
+ - Test ALL parameters and edge cases
46
+ - Include code examples and real-world outputs
47
+
48
+ 3. **TDD WORKFLOW:**
49
+ - ALWAYS use /red → /green → /refactor cycle
50
+ - NEVER write implementation without failing test first
51
+ - Use /cycle for feature development
52
+ - Use characterization tests for refactoring
53
+
54
+ 4. **API KEY MANAGEMENT:**
55
+ - Support three loading methods:
56
+ - Server environment variables
57
+ - NEXT*PUBLIC* variables (client-side)
58
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
59
+ - Never hardcode API keys
60
+ - Always validate key availability before use
61
+
62
+ 5. **COMPREHENSIVE TESTING:**
63
+ - When researching APIs, read actual implementation code
64
+ - Discover ALL possible parameters (not just documented ones)
65
+ - Test with various parameter combinations
66
+ - Document custom headers, query params, request/response schemas
67
+ - Include validation rules and testing notes
68
+
69
+ 6. **NO UI BLOAT:**
70
+ - This is an API project with minimal frontend
71
+ - Only keep necessary test/documentation interfaces
72
+ - Delete unused components immediately
73
+ - No unnecessary UI libraries or features
74
+
75
+ 7. **DOCUMENTATION:**
76
+ - If you change an API, you MUST update:
77
+ - OpenAPI spec
78
+ - api-tests-manifest.json
79
+ - Code examples
80
+ - Testing notes
81
+ - Document expected behavior and edge cases
82
+ - Include real-world output examples
@@ -0,0 +1,137 @@
1
+ ---
2
+ description: Execute complete TDD cycle - Red, Green, and Refactor phases in sequence
3
+ argument-hint: <feature or requirement description>
4
+ ---
5
+
6
+ RED+GREEN+REFACTOR (one cycle) PHASE! Apply the below to the info given by user input here:
7
+
8
+ $ARGUMENTS
9
+
10
+ ## General Guidelines
11
+
12
+ ### Output Style
13
+
14
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
15
+ - Write natural, descriptive code without meta-commentary about the development process
16
+ - The code should speak for itself - TDD is the process, not the product
17
+
18
+ (If there was no info above, fallback to the context of the conversation)
19
+
20
+ ## TDD Fundamentals
21
+
22
+ ### The TDD Cycle
23
+
24
+ The foundation of TDD is the Red-Green-Refactor cycle:
25
+
26
+ 1. **Red Phase**: Write ONE failing test that describes desired behavior
27
+ - The test must fail for the RIGHT reason (not syntax/import errors)
28
+ - Only one test at a time - this is critical for TDD discipline
29
+ - 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.
30
+ - **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
31
+ - Starting TDD for a new feature is always valid, even if test output shows unrelated work
32
+ - For DOM-based tests, use `data-testid` attributes to select elements rather than CSS classes, tag names, or text content
33
+ - 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
34
+
35
+ 2. **Green Phase**: Write MINIMAL code to make the test pass
36
+ - Implement only what's needed for the current failing test
37
+ - No anticipatory coding or extra features
38
+ - Address the specific failure message
39
+
40
+ 3. **Refactor Phase**: Improve code structure while keeping tests green
41
+ - Only allowed when relevant tests are passing
42
+ - Requires proof that tests have been run and are green
43
+ - Applies to BOTH implementation and test code
44
+ - No refactoring with failing tests - fix them first
45
+
46
+ ### Core Violations
47
+
48
+ 1. **Multiple Test Addition**
49
+ - Adding more than one new test at once
50
+ - Exception: Initial test file setup or extracting shared test utilities
51
+
52
+ 2. **Over-Implementation**
53
+ - Code that exceeds what's needed to pass the current failing test
54
+ - Adding untested features, methods, or error handling
55
+ - Implementing multiple methods when test only requires one
56
+
57
+ 3. **Premature Implementation**
58
+ - Adding implementation before a test exists and fails properly
59
+ - Adding implementation without running the test first
60
+ - Refactoring when tests haven't been run or are failing
61
+
62
+ ### Critical Principle: Incremental Development
63
+
64
+ Each step in TDD should address ONE specific issue:
65
+
66
+ - Test fails "not defined" → Create empty stub/class only
67
+ - Test fails "not a function" → Add method stub only
68
+ - Test fails with assertion → Implement minimal logic only
69
+
70
+ ### Optional Pre-Phase: Spike Phase
71
+
72
+ In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
73
+ This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
74
+
75
+ - The goal of a Spike is **exploration and learning**, not implementation.
76
+ - The code written during a Spike is **disposable** and **must not** be merged or reused directly.
77
+ - Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
78
+ - A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
79
+
80
+ ### General Information
81
+
82
+ - 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.
83
+ - 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.
84
+ - 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.
85
+ - Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
86
+ - Provide the agent with helpful directions so that they do not get stuck when blocking them.
87
+
88
+ ## 🛡 Project Rules (Injected into every command)
89
+
90
+ 1. **NO BROKEN BUILDS:**
91
+ - Run `pnpm test` before every `/commit`
92
+ - Ensure all tests pass
93
+ - Fix any type errors immediately
94
+
95
+ 2. **API DEVELOPMENT:**
96
+ - All new APIs MUST have Zod request/response schemas
97
+ - All APIs MUST be documented in both:
98
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
99
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
100
+ - Test ALL parameters and edge cases
101
+ - Include code examples and real-world outputs
102
+
103
+ 3. **TDD WORKFLOW:**
104
+ - ALWAYS use /red → /green → /refactor cycle
105
+ - NEVER write implementation without failing test first
106
+ - Use /cycle for feature development
107
+ - Use characterization tests for refactoring
108
+
109
+ 4. **API KEY MANAGEMENT:**
110
+ - Support three loading methods:
111
+ - Server environment variables
112
+ - NEXT*PUBLIC* variables (client-side)
113
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
114
+ - Never hardcode API keys
115
+ - Always validate key availability before use
116
+
117
+ 5. **COMPREHENSIVE TESTING:**
118
+ - When researching APIs, read actual implementation code
119
+ - Discover ALL possible parameters (not just documented ones)
120
+ - Test with various parameter combinations
121
+ - Document custom headers, query params, request/response schemas
122
+ - Include validation rules and testing notes
123
+
124
+ 6. **NO UI BLOAT:**
125
+ - This is an API project with minimal frontend
126
+ - Only keep necessary test/documentation interfaces
127
+ - Delete unused components immediately
128
+ - No unnecessary UI libraries or features
129
+
130
+ 7. **DOCUMENTATION:**
131
+ - If you change an API, you MUST update:
132
+ - OpenAPI spec
133
+ - api-tests-manifest.json
134
+ - Code examples
135
+ - Testing notes
136
+ - Document expected behavior and edge cases
137
+ - Include real-world output examples
@@ -0,0 +1,85 @@
1
+ ---
2
+ description: Analyze conversation context for unaddressed items and gaps
3
+ argument-hint: [optional additional info]
4
+ ---
5
+
6
+ ## General Guidelines
7
+
8
+ ### Output Style
9
+
10
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
11
+ - Write natural, descriptive code without meta-commentary about the development process
12
+ - The code should speak for itself - TDD is the process, not the product
13
+
14
+ Analyze the current conversation context and identify things that have not yet been addressed. Look for:
15
+
16
+ 1. **Incomplete implementations** - Code that was started but not finished
17
+ 2. **Unused variables/results** - Values that were captured but never used
18
+ 3. **Missing tests** - Functionality without test coverage
19
+ 4. **User requests** - Things the user asked for that weren't fully completed
20
+ 5. **TODO comments** - Any TODOs mentioned in conversation
21
+ 6. **Error handling gaps** - Missing error cases or edge cases
22
+ 7. **Documentation gaps** - Undocumented APIs or features
23
+ 8. **Consistency check** - Look for inconsistent patterns, naming conventions, or structure across the codebase
24
+
25
+ Present findings as a prioritized list with:
26
+
27
+ - What the gap is
28
+ - Why it matters
29
+ - Suggested next action
30
+
31
+ If there are no gaps, confirm that everything discussed has been addressed.
32
+
33
+ Additional info:
34
+ $ARGUMENTS
35
+
36
+ ## 🛡 Project Rules (Injected into every command)
37
+
38
+ 1. **NO BROKEN BUILDS:**
39
+ - Run `pnpm test` before every `/commit`
40
+ - Ensure all tests pass
41
+ - Fix any type errors immediately
42
+
43
+ 2. **API DEVELOPMENT:**
44
+ - All new APIs MUST have Zod request/response schemas
45
+ - All APIs MUST be documented in both:
46
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
47
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
48
+ - Test ALL parameters and edge cases
49
+ - Include code examples and real-world outputs
50
+
51
+ 3. **TDD WORKFLOW:**
52
+ - ALWAYS use /red → /green → /refactor cycle
53
+ - NEVER write implementation without failing test first
54
+ - Use /cycle for feature development
55
+ - Use characterization tests for refactoring
56
+
57
+ 4. **API KEY MANAGEMENT:**
58
+ - Support three loading methods:
59
+ - Server environment variables
60
+ - NEXT*PUBLIC* variables (client-side)
61
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
62
+ - Never hardcode API keys
63
+ - Always validate key availability before use
64
+
65
+ 5. **COMPREHENSIVE TESTING:**
66
+ - When researching APIs, read actual implementation code
67
+ - Discover ALL possible parameters (not just documented ones)
68
+ - Test with various parameter combinations
69
+ - Document custom headers, query params, request/response schemas
70
+ - Include validation rules and testing notes
71
+
72
+ 6. **NO UI BLOAT:**
73
+ - This is an API project with minimal frontend
74
+ - Only keep necessary test/documentation interfaces
75
+ - Delete unused components immediately
76
+ - No unnecessary UI libraries or features
77
+
78
+ 7. **DOCUMENTATION:**
79
+ - If you change an API, you MUST update:
80
+ - OpenAPI spec
81
+ - api-tests-manifest.json
82
+ - Code examples
83
+ - Testing notes
84
+ - Document expected behavior and edge cases
85
+ - Include real-world output examples
@@ -0,0 +1,137 @@
1
+ ---
2
+ description: Execute TDD Green Phase - write minimal implementation to pass the failing test
3
+ argument-hint: <implementation description>
4
+ ---
5
+
6
+ GREEN PHASE! Apply the below to the info given by user input here:
7
+
8
+ $ARGUMENTS
9
+
10
+ ## General Guidelines
11
+
12
+ ### Output Style
13
+
14
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
15
+ - Write natural, descriptive code without meta-commentary about the development process
16
+ - The code should speak for itself - TDD is the process, not the product
17
+
18
+ (If there was no info above, fallback to the context of the conversation)
19
+
20
+ ## TDD Fundamentals
21
+
22
+ ### The TDD Cycle
23
+
24
+ The foundation of TDD is the Red-Green-Refactor cycle:
25
+
26
+ 1. **Red Phase**: Write ONE failing test that describes desired behavior
27
+ - The test must fail for the RIGHT reason (not syntax/import errors)
28
+ - Only one test at a time - this is critical for TDD discipline
29
+ - 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.
30
+ - **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
31
+ - Starting TDD for a new feature is always valid, even if test output shows unrelated work
32
+ - For DOM-based tests, use `data-testid` attributes to select elements rather than CSS classes, tag names, or text content
33
+ - 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
34
+
35
+ 2. **Green Phase**: Write MINIMAL code to make the test pass
36
+ - Implement only what's needed for the current failing test
37
+ - No anticipatory coding or extra features
38
+ - Address the specific failure message
39
+
40
+ 3. **Refactor Phase**: Improve code structure while keeping tests green
41
+ - Only allowed when relevant tests are passing
42
+ - Requires proof that tests have been run and are green
43
+ - Applies to BOTH implementation and test code
44
+ - No refactoring with failing tests - fix them first
45
+
46
+ ### Core Violations
47
+
48
+ 1. **Multiple Test Addition**
49
+ - Adding more than one new test at once
50
+ - Exception: Initial test file setup or extracting shared test utilities
51
+
52
+ 2. **Over-Implementation**
53
+ - Code that exceeds what's needed to pass the current failing test
54
+ - Adding untested features, methods, or error handling
55
+ - Implementing multiple methods when test only requires one
56
+
57
+ 3. **Premature Implementation**
58
+ - Adding implementation before a test exists and fails properly
59
+ - Adding implementation without running the test first
60
+ - Refactoring when tests haven't been run or are failing
61
+
62
+ ### Critical Principle: Incremental Development
63
+
64
+ Each step in TDD should address ONE specific issue:
65
+
66
+ - Test fails "not defined" → Create empty stub/class only
67
+ - Test fails "not a function" → Add method stub only
68
+ - Test fails with assertion → Implement minimal logic only
69
+
70
+ ### Optional Pre-Phase: Spike Phase
71
+
72
+ In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
73
+ This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
74
+
75
+ - The goal of a Spike is **exploration and learning**, not implementation.
76
+ - The code written during a Spike is **disposable** and **must not** be merged or reused directly.
77
+ - Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
78
+ - A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
79
+
80
+ ### General Information
81
+
82
+ - 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.
83
+ - 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.
84
+ - 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.
85
+ - Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
86
+ - Provide the agent with helpful directions so that they do not get stuck when blocking them.
87
+
88
+ ## 🛡 Project Rules (Injected into every command)
89
+
90
+ 1. **NO BROKEN BUILDS:**
91
+ - Run `pnpm test` before every `/commit`
92
+ - Ensure all tests pass
93
+ - Fix any type errors immediately
94
+
95
+ 2. **API DEVELOPMENT:**
96
+ - All new APIs MUST have Zod request/response schemas
97
+ - All APIs MUST be documented in both:
98
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
99
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
100
+ - Test ALL parameters and edge cases
101
+ - Include code examples and real-world outputs
102
+
103
+ 3. **TDD WORKFLOW:**
104
+ - ALWAYS use /red → /green → /refactor cycle
105
+ - NEVER write implementation without failing test first
106
+ - Use /cycle for feature development
107
+ - Use characterization tests for refactoring
108
+
109
+ 4. **API KEY MANAGEMENT:**
110
+ - Support three loading methods:
111
+ - Server environment variables
112
+ - NEXT*PUBLIC* variables (client-side)
113
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
114
+ - Never hardcode API keys
115
+ - Always validate key availability before use
116
+
117
+ 5. **COMPREHENSIVE TESTING:**
118
+ - When researching APIs, read actual implementation code
119
+ - Discover ALL possible parameters (not just documented ones)
120
+ - Test with various parameter combinations
121
+ - Document custom headers, query params, request/response schemas
122
+ - Include validation rules and testing notes
123
+
124
+ 6. **NO UI BLOAT:**
125
+ - This is an API project with minimal frontend
126
+ - Only keep necessary test/documentation interfaces
127
+ - Delete unused components immediately
128
+ - No unnecessary UI libraries or features
129
+
130
+ 7. **DOCUMENTATION:**
131
+ - If you change an API, you MUST update:
132
+ - OpenAPI spec
133
+ - api-tests-manifest.json
134
+ - Code examples
135
+ - Testing notes
136
+ - Document expected behavior and edge cases
137
+ - Include real-world output examples