@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,83 @@
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
+
34
+ ## 🛡 Project Rules (Injected into every command)
35
+
36
+ 1. **NO BROKEN BUILDS:**
37
+ - Run `pnpm test` before every `/commit`
38
+ - Ensure all tests pass
39
+ - Fix any type errors immediately
40
+
41
+ 2. **API DEVELOPMENT:**
42
+ - All new APIs MUST have Zod request/response schemas
43
+ - All APIs MUST be documented in both:
44
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
45
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
46
+ - Test ALL parameters and edge cases
47
+ - Include code examples and real-world outputs
48
+
49
+ 3. **TDD WORKFLOW:**
50
+ - ALWAYS use /red → /green → /refactor cycle
51
+ - NEVER write implementation without failing test first
52
+ - Use /cycle for feature development
53
+ - Use characterization tests for refactoring
54
+
55
+ 4. **API KEY MANAGEMENT:**
56
+ - Support three loading methods:
57
+ - Server environment variables
58
+ - NEXT_PUBLIC_ variables (client-side)
59
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
60
+ - Never hardcode API keys
61
+ - Always validate key availability before use
62
+
63
+ 5. **COMPREHENSIVE TESTING:**
64
+ - When researching APIs, read actual implementation code
65
+ - Discover ALL possible parameters (not just documented ones)
66
+ - Test with various parameter combinations
67
+ - Document custom headers, query params, request/response schemas
68
+ - Include validation rules and testing notes
69
+
70
+ 6. **NO UI BLOAT:**
71
+ - This is an API project with minimal frontend
72
+ - Only keep necessary test/documentation interfaces
73
+ - Delete unused components immediately
74
+ - No unnecessary UI libraries or features
75
+
76
+ 7. **DOCUMENTATION:**
77
+ - If you change an API, you MUST update:
78
+ - OpenAPI spec
79
+ - api-tests-manifest.json
80
+ - Code examples
81
+ - Testing notes
82
+ - Document expected behavior and edge cases
83
+ - Include real-world output examples
@@ -0,0 +1,142 @@
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
+
28
+ - The test must fail for the RIGHT reason (not syntax/import errors)
29
+ - Only one test at a time - this is critical for TDD discipline
30
+ - 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.
31
+ - **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
32
+ - Starting TDD for a new feature is always valid, even if test output shows unrelated work
33
+ - For DOM-based tests, use `data-testid` attributes to select elements rather than CSS classes, tag names, or text content
34
+ - 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
35
+
36
+ 2. **Green Phase**: Write MINIMAL code to make the test pass
37
+
38
+ - Implement only what's needed for the current failing test
39
+ - No anticipatory coding or extra features
40
+ - Address the specific failure message
41
+
42
+ 3. **Refactor Phase**: Improve code structure while keeping tests green
43
+ - Only allowed when relevant tests are passing
44
+ - Requires proof that tests have been run and are green
45
+ - Applies to BOTH implementation and test code
46
+ - No refactoring with failing tests - fix them first
47
+
48
+ ### Core Violations
49
+
50
+ 1. **Multiple Test Addition**
51
+
52
+ - Adding more than one new test at once
53
+ - Exception: Initial test file setup or extracting shared test utilities
54
+
55
+ 2. **Over-Implementation**
56
+
57
+ - Code that exceeds what's needed to pass the current failing test
58
+ - Adding untested features, methods, or error handling
59
+ - Implementing multiple methods when test only requires one
60
+
61
+ 3. **Premature Implementation**
62
+ - Adding implementation before a test exists and fails properly
63
+ - Adding implementation without running the test first
64
+ - Refactoring when tests haven't been run or are failing
65
+
66
+ ### Critical Principle: Incremental Development
67
+
68
+ Each step in TDD should address ONE specific issue:
69
+
70
+ - Test fails "not defined" → Create empty stub/class only
71
+ - Test fails "not a function" → Add method stub only
72
+ - Test fails with assertion → Implement minimal logic only
73
+
74
+ ### Optional Pre-Phase: Spike Phase
75
+
76
+ In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
77
+ This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
78
+
79
+ - The goal of a Spike is **exploration and learning**, not implementation.
80
+ - The code written during a Spike is **disposable** and **must not** be merged or reused directly.
81
+ - Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
82
+ - A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
83
+
84
+ ### General Information
85
+
86
+ - 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.
87
+ - 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.
88
+ - 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.
89
+ - Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
90
+ - Provide the agent with helpful directions so that they do not get stuck when blocking them.
91
+
92
+
93
+ ## 🛡 Project Rules (Injected into every command)
94
+
95
+ 1. **NO BROKEN BUILDS:**
96
+ - Run `pnpm test` before every `/commit`
97
+ - Ensure all tests pass
98
+ - Fix any type errors immediately
99
+
100
+ 2. **API DEVELOPMENT:**
101
+ - All new APIs MUST have Zod request/response schemas
102
+ - All APIs MUST be documented in both:
103
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
104
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
105
+ - Test ALL parameters and edge cases
106
+ - Include code examples and real-world outputs
107
+
108
+ 3. **TDD WORKFLOW:**
109
+ - ALWAYS use /red → /green → /refactor cycle
110
+ - NEVER write implementation without failing test first
111
+ - Use /cycle for feature development
112
+ - Use characterization tests for refactoring
113
+
114
+ 4. **API KEY MANAGEMENT:**
115
+ - Support three loading methods:
116
+ - Server environment variables
117
+ - NEXT_PUBLIC_ variables (client-side)
118
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
119
+ - Never hardcode API keys
120
+ - Always validate key availability before use
121
+
122
+ 5. **COMPREHENSIVE TESTING:**
123
+ - When researching APIs, read actual implementation code
124
+ - Discover ALL possible parameters (not just documented ones)
125
+ - Test with various parameter combinations
126
+ - Document custom headers, query params, request/response schemas
127
+ - Include validation rules and testing notes
128
+
129
+ 6. **NO UI BLOAT:**
130
+ - This is an API project with minimal frontend
131
+ - Only keep necessary test/documentation interfaces
132
+ - Delete unused components immediately
133
+ - No unnecessary UI libraries or features
134
+
135
+ 7. **DOCUMENTATION:**
136
+ - If you change an API, you MUST update:
137
+ - OpenAPI spec
138
+ - api-tests-manifest.json
139
+ - Code examples
140
+ - Testing notes
141
+ - Document expected behavior and edge cases
142
+ - Include real-world output examples
@@ -0,0 +1,86 @@
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
+
37
+ ## 🛡 Project Rules (Injected into every command)
38
+
39
+ 1. **NO BROKEN BUILDS:**
40
+ - Run `pnpm test` before every `/commit`
41
+ - Ensure all tests pass
42
+ - Fix any type errors immediately
43
+
44
+ 2. **API DEVELOPMENT:**
45
+ - All new APIs MUST have Zod request/response schemas
46
+ - All APIs MUST be documented in both:
47
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
48
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
49
+ - Test ALL parameters and edge cases
50
+ - Include code examples and real-world outputs
51
+
52
+ 3. **TDD WORKFLOW:**
53
+ - ALWAYS use /red → /green → /refactor cycle
54
+ - NEVER write implementation without failing test first
55
+ - Use /cycle for feature development
56
+ - Use characterization tests for refactoring
57
+
58
+ 4. **API KEY MANAGEMENT:**
59
+ - Support three loading methods:
60
+ - Server environment variables
61
+ - NEXT_PUBLIC_ variables (client-side)
62
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
63
+ - Never hardcode API keys
64
+ - Always validate key availability before use
65
+
66
+ 5. **COMPREHENSIVE TESTING:**
67
+ - When researching APIs, read actual implementation code
68
+ - Discover ALL possible parameters (not just documented ones)
69
+ - Test with various parameter combinations
70
+ - Document custom headers, query params, request/response schemas
71
+ - Include validation rules and testing notes
72
+
73
+ 6. **NO UI BLOAT:**
74
+ - This is an API project with minimal frontend
75
+ - Only keep necessary test/documentation interfaces
76
+ - Delete unused components immediately
77
+ - No unnecessary UI libraries or features
78
+
79
+ 7. **DOCUMENTATION:**
80
+ - If you change an API, you MUST update:
81
+ - OpenAPI spec
82
+ - api-tests-manifest.json
83
+ - Code examples
84
+ - Testing notes
85
+ - Document expected behavior and edge cases
86
+ - Include real-world output examples
@@ -0,0 +1,142 @@
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
+
28
+ - The test must fail for the RIGHT reason (not syntax/import errors)
29
+ - Only one test at a time - this is critical for TDD discipline
30
+ - 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.
31
+ - **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
32
+ - Starting TDD for a new feature is always valid, even if test output shows unrelated work
33
+ - For DOM-based tests, use `data-testid` attributes to select elements rather than CSS classes, tag names, or text content
34
+ - 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
35
+
36
+ 2. **Green Phase**: Write MINIMAL code to make the test pass
37
+
38
+ - Implement only what's needed for the current failing test
39
+ - No anticipatory coding or extra features
40
+ - Address the specific failure message
41
+
42
+ 3. **Refactor Phase**: Improve code structure while keeping tests green
43
+ - Only allowed when relevant tests are passing
44
+ - Requires proof that tests have been run and are green
45
+ - Applies to BOTH implementation and test code
46
+ - No refactoring with failing tests - fix them first
47
+
48
+ ### Core Violations
49
+
50
+ 1. **Multiple Test Addition**
51
+
52
+ - Adding more than one new test at once
53
+ - Exception: Initial test file setup or extracting shared test utilities
54
+
55
+ 2. **Over-Implementation**
56
+
57
+ - Code that exceeds what's needed to pass the current failing test
58
+ - Adding untested features, methods, or error handling
59
+ - Implementing multiple methods when test only requires one
60
+
61
+ 3. **Premature Implementation**
62
+ - Adding implementation before a test exists and fails properly
63
+ - Adding implementation without running the test first
64
+ - Refactoring when tests haven't been run or are failing
65
+
66
+ ### Critical Principle: Incremental Development
67
+
68
+ Each step in TDD should address ONE specific issue:
69
+
70
+ - Test fails "not defined" → Create empty stub/class only
71
+ - Test fails "not a function" → Add method stub only
72
+ - Test fails with assertion → Implement minimal logic only
73
+
74
+ ### Optional Pre-Phase: Spike Phase
75
+
76
+ In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
77
+ This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
78
+
79
+ - The goal of a Spike is **exploration and learning**, not implementation.
80
+ - The code written during a Spike is **disposable** and **must not** be merged or reused directly.
81
+ - Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
82
+ - A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
83
+
84
+ ### General Information
85
+
86
+ - 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.
87
+ - 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.
88
+ - 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.
89
+ - Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
90
+ - Provide the agent with helpful directions so that they do not get stuck when blocking them.
91
+
92
+
93
+ ## 🛡 Project Rules (Injected into every command)
94
+
95
+ 1. **NO BROKEN BUILDS:**
96
+ - Run `pnpm test` before every `/commit`
97
+ - Ensure all tests pass
98
+ - Fix any type errors immediately
99
+
100
+ 2. **API DEVELOPMENT:**
101
+ - All new APIs MUST have Zod request/response schemas
102
+ - All APIs MUST be documented in both:
103
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
104
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
105
+ - Test ALL parameters and edge cases
106
+ - Include code examples and real-world outputs
107
+
108
+ 3. **TDD WORKFLOW:**
109
+ - ALWAYS use /red → /green → /refactor cycle
110
+ - NEVER write implementation without failing test first
111
+ - Use /cycle for feature development
112
+ - Use characterization tests for refactoring
113
+
114
+ 4. **API KEY MANAGEMENT:**
115
+ - Support three loading methods:
116
+ - Server environment variables
117
+ - NEXT_PUBLIC_ variables (client-side)
118
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
119
+ - Never hardcode API keys
120
+ - Always validate key availability before use
121
+
122
+ 5. **COMPREHENSIVE TESTING:**
123
+ - When researching APIs, read actual implementation code
124
+ - Discover ALL possible parameters (not just documented ones)
125
+ - Test with various parameter combinations
126
+ - Document custom headers, query params, request/response schemas
127
+ - Include validation rules and testing notes
128
+
129
+ 6. **NO UI BLOAT:**
130
+ - This is an API project with minimal frontend
131
+ - Only keep necessary test/documentation interfaces
132
+ - Delete unused components immediately
133
+ - No unnecessary UI libraries or features
134
+
135
+ 7. **DOCUMENTATION:**
136
+ - If you change an API, you MUST update:
137
+ - OpenAPI spec
138
+ - api-tests-manifest.json
139
+ - Code examples
140
+ - Testing notes
141
+ - Document expected behavior and edge cases
142
+ - Include real-world output examples
@@ -0,0 +1,192 @@
1
+ ---
2
+ description: Analyze GitHub issue and create TDD implementation plan
3
+ argument-hint: [optional-issue-number]
4
+ ---
5
+
6
+ Analyze GitHub issue and create TDD implementation plan.
7
+
8
+ ## General Guidelines
9
+
10
+ ### Output Style
11
+
12
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
13
+ - Write natural, descriptive code without meta-commentary about the development process
14
+ - The code should speak for itself - TDD is the process, not the product
15
+
16
+ Process:
17
+
18
+ 1. Get Issue Number
19
+
20
+ - Either from branch name use that issue number
21
+ - Patterns: issue-123, 123-feature, feature/123, fix/123
22
+ - Or from this bullet point with custom info: $ARGUMENTS
23
+ - If not found: ask user
24
+
25
+ 1. Fetch Issue
26
+
27
+ Try to fetch the issue using GitHub MCP (mcp__github__issue_read tool).
28
+
29
+ If GitHub MCP is not configured, show:
30
+
31
+ ```
32
+ GitHub MCP not configured!
33
+ See: https://github.com/modelcontextprotocol/servers/tree/main/src/github
34
+ Trying GitHub CLI fallback...
35
+ ```
36
+
37
+ Then try using `gh issue view [ISSUE_NUMBER] --json` as fallback.
38
+
39
+ 1. Analyze and Plan
40
+
41
+ Summarize the issue and requirements, then:
42
+
43
+ ## Discovery Phase
44
+
45
+ Understand the requirement by asking (use AskUserQuestion if needed):
46
+
47
+ **Problem Statement**
48
+
49
+ - What problem does this solve?
50
+ - Who experiences this problem?
51
+ - What's the current pain point?
52
+
53
+ **Desired Outcome**
54
+
55
+ - What should happen after this is built?
56
+ - How will users interact with it?
57
+ - What does success look like?
58
+
59
+ **Scope & Constraints**
60
+
61
+ - What's in scope vs. out of scope?
62
+ - Any technical constraints?
63
+ - Dependencies on other systems/features?
64
+
65
+ **Context Check**
66
+
67
+ - Search codebase for related features/modules
68
+ - Check for existing test files that might be relevant
69
+
70
+ ## TDD Fundamentals
71
+
72
+ ### The TDD Cycle
73
+
74
+ The foundation of TDD is the Red-Green-Refactor cycle:
75
+
76
+ 1. **Red Phase**: Write ONE failing test that describes desired behavior
77
+
78
+ - The test must fail for the RIGHT reason (not syntax/import errors)
79
+ - Only one test at a time - this is critical for TDD discipline
80
+ - 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.
81
+ - **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
82
+ - Starting TDD for a new feature is always valid, even if test output shows unrelated work
83
+ - For DOM-based tests, use `data-testid` attributes to select elements rather than CSS classes, tag names, or text content
84
+ - 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
85
+
86
+ 2. **Green Phase**: Write MINIMAL code to make the test pass
87
+
88
+ - Implement only what's needed for the current failing test
89
+ - No anticipatory coding or extra features
90
+ - Address the specific failure message
91
+
92
+ 3. **Refactor Phase**: Improve code structure while keeping tests green
93
+ - Only allowed when relevant tests are passing
94
+ - Requires proof that tests have been run and are green
95
+ - Applies to BOTH implementation and test code
96
+ - No refactoring with failing tests - fix them first
97
+
98
+ ### Core Violations
99
+
100
+ 1. **Multiple Test Addition**
101
+
102
+ - Adding more than one new test at once
103
+ - Exception: Initial test file setup or extracting shared test utilities
104
+
105
+ 2. **Over-Implementation**
106
+
107
+ - Code that exceeds what's needed to pass the current failing test
108
+ - Adding untested features, methods, or error handling
109
+ - Implementing multiple methods when test only requires one
110
+
111
+ 3. **Premature Implementation**
112
+ - Adding implementation before a test exists and fails properly
113
+ - Adding implementation without running the test first
114
+ - Refactoring when tests haven't been run or are failing
115
+
116
+ ### Critical Principle: Incremental Development
117
+
118
+ Each step in TDD should address ONE specific issue:
119
+
120
+ - Test fails "not defined" → Create empty stub/class only
121
+ - Test fails "not a function" → Add method stub only
122
+ - Test fails with assertion → Implement minimal logic only
123
+
124
+ ### Optional Pre-Phase: Spike Phase
125
+
126
+ In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
127
+ This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
128
+
129
+ - The goal of a Spike is **exploration and learning**, not implementation.
130
+ - The code written during a Spike is **disposable** and **must not** be merged or reused directly.
131
+ - Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
132
+ - A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
133
+
134
+ ### General Information
135
+
136
+ - 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.
137
+ - 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.
138
+ - 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.
139
+ - Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
140
+ - Provide the agent with helpful directions so that they do not get stuck when blocking them.
141
+
142
+
143
+ ## 🛡 Project Rules (Injected into every command)
144
+
145
+ 1. **NO BROKEN BUILDS:**
146
+ - Run `pnpm test` before every `/commit`
147
+ - Ensure all tests pass
148
+ - Fix any type errors immediately
149
+
150
+ 2. **API DEVELOPMENT:**
151
+ - All new APIs MUST have Zod request/response schemas
152
+ - All APIs MUST be documented in both:
153
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
154
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
155
+ - Test ALL parameters and edge cases
156
+ - Include code examples and real-world outputs
157
+
158
+ 3. **TDD WORKFLOW:**
159
+ - ALWAYS use /red → /green → /refactor cycle
160
+ - NEVER write implementation without failing test first
161
+ - Use /cycle for feature development
162
+ - Use characterization tests for refactoring
163
+
164
+ 4. **API KEY MANAGEMENT:**
165
+ - Support three loading methods:
166
+ - Server environment variables
167
+ - NEXT_PUBLIC_ variables (client-side)
168
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
169
+ - Never hardcode API keys
170
+ - Always validate key availability before use
171
+
172
+ 5. **COMPREHENSIVE TESTING:**
173
+ - When researching APIs, read actual implementation code
174
+ - Discover ALL possible parameters (not just documented ones)
175
+ - Test with various parameter combinations
176
+ - Document custom headers, query params, request/response schemas
177
+ - Include validation rules and testing notes
178
+
179
+ 6. **NO UI BLOAT:**
180
+ - This is an API project with minimal frontend
181
+ - Only keep necessary test/documentation interfaces
182
+ - Delete unused components immediately
183
+ - No unnecessary UI libraries or features
184
+
185
+ 7. **DOCUMENTATION:**
186
+ - If you change an API, you MUST update:
187
+ - OpenAPI spec
188
+ - api-tests-manifest.json
189
+ - Code examples
190
+ - Testing notes
191
+ - Document expected behavior and edge cases
192
+ - Include real-world output examples