@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.
- package/.claude/agents/code-reviewer.md +170 -0
- package/.claude/agents/docs-generator.md +80 -0
- package/.claude/agents/implementation-reviewer.md +119 -0
- package/.claude/agents/parallel-researcher.md +52 -0
- package/.claude/agents/research-validator.md +116 -0
- package/.claude/agents/schema-generator.md +70 -0
- package/.claude/agents/test-writer.md +104 -0
- package/.claude/api-dev-state.json +331 -0
- package/.claude/commands/README.md +196 -0
- package/.claude/commands/add-command.md +212 -0
- package/.claude/commands/api-create.md +510 -0
- package/.claude/commands/api-env.md +51 -0
- package/.claude/commands/api-interview.md +344 -0
- package/.claude/commands/api-research.md +357 -0
- package/.claude/commands/api-status.md +279 -0
- package/.claude/commands/api-verify.md +232 -0
- package/.claude/commands/beepboop.md +96 -0
- package/.claude/commands/busycommit.md +111 -0
- package/.claude/commands/commit.md +82 -0
- package/.claude/commands/cycle.md +137 -0
- package/.claude/commands/gap.md +85 -0
- package/.claude/commands/green.md +137 -0
- package/.claude/commands/issue.md +187 -0
- package/.claude/commands/ntfy-setup.md +91 -0
- package/.claude/commands/ntfy-test.md +74 -0
- package/.claude/commands/plan.md +167 -0
- package/.claude/commands/pr.md +121 -0
- package/.claude/commands/publish.md +40 -0
- package/.claude/commands/red.md +137 -0
- package/.claude/commands/refactor.md +137 -0
- package/.claude/commands/spike.md +137 -0
- package/.claude/commands/summarize.md +93 -0
- package/.claude/commands/tdd.md +139 -0
- package/.claude/commands/worktree-add.md +307 -0
- package/.claude/commands/worktree-cleanup.md +275 -0
- package/.claude/hooks/api-workflow-check.py +227 -0
- package/.claude/hooks/enforce-deep-research.py +185 -0
- package/.claude/hooks/enforce-disambiguation.py +155 -0
- package/.claude/hooks/enforce-documentation.py +192 -0
- package/.claude/hooks/enforce-environment.py +253 -0
- package/.claude/hooks/enforce-external-research.py +328 -0
- package/.claude/hooks/enforce-interview.py +421 -0
- package/.claude/hooks/enforce-refactor.py +189 -0
- package/.claude/hooks/enforce-research.py +159 -0
- package/.claude/hooks/enforce-schema.py +186 -0
- package/.claude/hooks/enforce-scope.py +160 -0
- package/.claude/hooks/enforce-tdd-red.py +250 -0
- package/.claude/hooks/enforce-verify.py +186 -0
- package/.claude/hooks/periodic-reground.py +154 -0
- package/.claude/hooks/session-startup.py +151 -0
- package/.claude/hooks/track-tool-use.py +626 -0
- package/.claude/hooks/verify-after-green.py +282 -0
- package/.claude/hooks/verify-implementation.py +225 -0
- package/.claude/research/index.json +6 -0
- package/.claude/settings.json +144 -0
- package/.claude/settings.local.json +12 -0
- package/.claude-plugin/marketplace.json +103 -0
- package/.skills/README.md +293 -0
- package/.skills/_shared/convert-commands.py +192 -0
- package/.skills/_shared/hooks/api-workflow-check.py +227 -0
- package/.skills/_shared/hooks/enforce-deep-research.py +185 -0
- package/.skills/_shared/hooks/enforce-disambiguation.py +155 -0
- package/.skills/_shared/hooks/enforce-documentation.py +192 -0
- package/.skills/_shared/hooks/enforce-environment.py +253 -0
- package/.skills/_shared/hooks/enforce-external-research.py +328 -0
- package/.skills/_shared/hooks/enforce-interview.py +421 -0
- package/.skills/_shared/hooks/enforce-refactor.py +189 -0
- package/.skills/_shared/hooks/enforce-research.py +159 -0
- package/.skills/_shared/hooks/enforce-schema.py +186 -0
- package/.skills/_shared/hooks/enforce-scope.py +160 -0
- package/.skills/_shared/hooks/enforce-tdd-red.py +250 -0
- package/.skills/_shared/hooks/enforce-verify.py +186 -0
- package/.skills/_shared/hooks/periodic-reground.py +154 -0
- package/.skills/_shared/hooks/session-startup.py +151 -0
- package/.skills/_shared/hooks/track-tool-use.py +626 -0
- package/.skills/_shared/hooks/verify-after-green.py +282 -0
- package/.skills/_shared/hooks/verify-implementation.py +225 -0
- package/.skills/_shared/install.sh +114 -0
- package/.skills/_shared/settings.json +93 -0
- package/.skills/add-command/SKILL.md +227 -0
- package/.skills/api-create/SKILL.md +623 -0
- package/.skills/api-env/SKILL.md +64 -0
- package/.skills/api-interview/SKILL.md +357 -0
- package/.skills/api-research/SKILL.md +370 -0
- package/.skills/api-status/SKILL.md +292 -0
- package/.skills/api-verify/SKILL.md +245 -0
- package/.skills/beepboop/SKILL.md +111 -0
- package/.skills/busycommit/SKILL.md +126 -0
- package/.skills/commit/SKILL.md +97 -0
- package/.skills/cycle/SKILL.md +152 -0
- package/.skills/gap/SKILL.md +100 -0
- package/.skills/green/SKILL.md +152 -0
- package/.skills/issue/SKILL.md +202 -0
- package/.skills/plan/SKILL.md +182 -0
- package/.skills/pr/SKILL.md +136 -0
- package/.skills/publish/SKILL.md +160 -0
- package/.skills/red/SKILL.md +152 -0
- package/.skills/refactor/SKILL.md +152 -0
- package/.skills/spike/SKILL.md +152 -0
- package/.skills/summarize/SKILL.md +108 -0
- package/.skills/tdd/SKILL.md +154 -0
- package/.skills/update-todos/SKILL.md +250 -0
- package/.skills/worktree-add/SKILL.md +322 -0
- package/.skills/worktree-cleanup/SKILL.md +290 -0
- package/CHANGELOG.md +115 -0
- package/README.md +161 -7101
- package/bin/cli.js +448 -805
- package/commands/README.md +66 -31
- package/commands/add-command.md +8 -5
- package/commands/beepboop.md +4 -5
- package/commands/busycommit.md +2 -3
- package/commands/commit.md +2 -3
- package/commands/cycle.md +2 -7
- package/commands/gap.md +2 -3
- package/commands/green.md +2 -7
- package/commands/hustle-api-continue.md +8 -5
- package/commands/hustle-api-create.md +70 -29
- package/commands/hustle-api-env.md +1 -0
- package/commands/hustle-api-interview.md +32 -19
- package/commands/hustle-api-research.md +47 -21
- package/commands/hustle-api-sessions.md +8 -7
- package/commands/hustle-api-status.md +21 -1
- package/commands/hustle-api-verify.md +14 -13
- package/commands/hustle-combine.md +488 -241
- package/commands/hustle-ui-create-page.md +113 -50
- package/commands/hustle-ui-create.md +179 -26
- package/commands/issue.md +3 -8
- package/commands/plan.md +2 -3
- package/commands/pr.md +2 -3
- package/commands/red.md +2 -7
- package/commands/refactor.md +2 -7
- package/commands/spike.md +2 -7
- package/commands/summarize.md +2 -3
- package/commands/tdd.md +2 -7
- package/commands/worktree-add.md +208 -216
- package/commands/worktree-cleanup.md +172 -178
- package/hooks/api-workflow-check.py +5 -3
- package/hooks/enforce-component-type-confirm.py +97 -0
- package/hooks/lib/__init__.py +1 -0
- package/hooks/lib/greptile.py +355 -0
- package/hooks/lib/ntfy.py +209 -0
- package/hooks/notify-input-needed.py +73 -0
- package/hooks/notify-phase-complete.py +90 -0
- package/hooks/run-code-review.py +246 -0
- package/hooks/track-token-usage.py +121 -0
- package/package.json +33 -12
- package/scripts/collect-test-results.ts +102 -77
- package/scripts/extract-parameters.ts +112 -70
- package/scripts/generate-test-manifest.ts +118 -77
- package/templates/.env.example +57 -0
- package/templates/BRAND_GUIDE.md +92 -52
- package/templates/CLAUDE-SECTION.md +40 -37
- package/templates/SPEC.json +186 -38
- package/templates/api-dev-state.json +33 -4
- package/templates/api-showcase/_components/APICard.tsx +22 -18
- package/templates/api-showcase/_components/APIModal.tsx +110 -64
- package/templates/api-showcase/_components/APIShowcase.tsx +53 -35
- package/templates/api-showcase/_components/APITester.tsx +128 -67
- package/templates/api-showcase/page.tsx +4 -4
- package/templates/api-test/page.tsx +51 -30
- package/templates/api-test/test-structure/route.ts +43 -34
- package/templates/component/Component.stories.tsx +41 -39
- package/templates/component/Component.test.tsx +96 -78
- package/templates/component/Component.tsx +63 -52
- package/templates/component/Component.types.ts +10 -6
- package/templates/component/Component.visual.spec.ts +170 -0
- package/templates/component/index.ts +2 -2
- package/templates/dev-tools/_components/DevToolsLanding.tsx +8 -8
- package/templates/dev-tools/page.tsx +4 -3
- package/templates/mcp-servers.json +30 -2
- package/templates/page/page.e2e.test.ts +56 -48
- package/templates/page/page.tsx +3 -3
- package/templates/shared/HeroHeader.tsx +16 -15
- package/templates/shared/index.ts +1 -1
- package/templates/ui-showcase/_components/PreviewCard.tsx +20 -20
- package/templates/ui-showcase/_components/PreviewModal.tsx +149 -108
- package/templates/ui-showcase/_components/UIShowcase.tsx +43 -35
- package/templates/ui-showcase/page.tsx +4 -4
|
@@ -0,0 +1,152 @@
|
|
|
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
|
+
|
|
16
|
+
description: Execute complete TDD cycle - Red, Green, and Refactor phases in sequence
|
|
17
|
+
argument-hint: <feature or requirement description>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
RED+GREEN+REFACTOR (one cycle) PHASE! Apply the below to the info given by user input here:
|
|
22
|
+
|
|
23
|
+
$ARGUMENTS
|
|
24
|
+
|
|
25
|
+
## General Guidelines
|
|
26
|
+
|
|
27
|
+
### Output Style
|
|
28
|
+
|
|
29
|
+
- **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
|
|
30
|
+
- Write natural, descriptive code without meta-commentary about the development process
|
|
31
|
+
- The code should speak for itself - TDD is the process, not the product
|
|
32
|
+
|
|
33
|
+
(If there was no info above, fallback to the context of the conversation)
|
|
34
|
+
|
|
35
|
+
## TDD Fundamentals
|
|
36
|
+
|
|
37
|
+
### The TDD Cycle
|
|
38
|
+
|
|
39
|
+
The foundation of TDD is the Red-Green-Refactor cycle:
|
|
40
|
+
|
|
41
|
+
1. **Red Phase**: Write ONE failing test that describes desired behavior
|
|
42
|
+
- The test must fail for the RIGHT reason (not syntax/import errors)
|
|
43
|
+
- Only one test at a time - this is critical for TDD discipline
|
|
44
|
+
- Exception: For browser-level tests or expensive setup (e.g., Storybook `*.stories.tsx`), group multiple assertions within a single test block to avoid redundant setup - but only when adding assertions to an existing interaction flow. If new user interactions are required, still create a new test. Split files by category if they exceed ~1000 lines.
|
|
45
|
+
- **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
|
|
46
|
+
- Starting TDD for a new feature is always valid, even if test output shows unrelated work
|
|
47
|
+
- For DOM-based tests, use `data-testid` attributes to select elements rather than CSS classes, tag names, or text content
|
|
48
|
+
- Avoid hard-coded timeouts both in form of sleep() or timeout: 5000 etc; use proper async patterns (`waitFor`, `findBy*`, event-based sync) instead and rely on global test configs for timeout settings
|
|
49
|
+
|
|
50
|
+
2. **Green Phase**: Write MINIMAL code to make the test pass
|
|
51
|
+
- Implement only what's needed for the current failing test
|
|
52
|
+
- No anticipatory coding or extra features
|
|
53
|
+
- Address the specific failure message
|
|
54
|
+
|
|
55
|
+
3. **Refactor Phase**: Improve code structure while keeping tests green
|
|
56
|
+
- Only allowed when relevant tests are passing
|
|
57
|
+
- Requires proof that tests have been run and are green
|
|
58
|
+
- Applies to BOTH implementation and test code
|
|
59
|
+
- No refactoring with failing tests - fix them first
|
|
60
|
+
|
|
61
|
+
### Core Violations
|
|
62
|
+
|
|
63
|
+
1. **Multiple Test Addition**
|
|
64
|
+
- Adding more than one new test at once
|
|
65
|
+
- Exception: Initial test file setup or extracting shared test utilities
|
|
66
|
+
|
|
67
|
+
2. **Over-Implementation**
|
|
68
|
+
- Code that exceeds what's needed to pass the current failing test
|
|
69
|
+
- Adding untested features, methods, or error handling
|
|
70
|
+
- Implementing multiple methods when test only requires one
|
|
71
|
+
|
|
72
|
+
3. **Premature Implementation**
|
|
73
|
+
- Adding implementation before a test exists and fails properly
|
|
74
|
+
- Adding implementation without running the test first
|
|
75
|
+
- Refactoring when tests haven't been run or are failing
|
|
76
|
+
|
|
77
|
+
### Critical Principle: Incremental Development
|
|
78
|
+
|
|
79
|
+
Each step in TDD should address ONE specific issue:
|
|
80
|
+
|
|
81
|
+
- Test fails "not defined" → Create empty stub/class only
|
|
82
|
+
- Test fails "not a function" → Add method stub only
|
|
83
|
+
- Test fails with assertion → Implement minimal logic only
|
|
84
|
+
|
|
85
|
+
### Optional Pre-Phase: Spike Phase
|
|
86
|
+
|
|
87
|
+
In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
|
|
88
|
+
This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
|
|
89
|
+
|
|
90
|
+
- The goal of a Spike is **exploration and learning**, not implementation.
|
|
91
|
+
- The code written during a Spike is **disposable** and **must not** be merged or reused directly.
|
|
92
|
+
- Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
|
|
93
|
+
- A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
|
|
94
|
+
|
|
95
|
+
### General Information
|
|
96
|
+
|
|
97
|
+
- Sometimes the test output shows as no tests have been run when a new test is failing due to a missing import or constructor. In such cases, allow the agent to create simple stubs. Ask them if they forgot to create a stub if they are stuck.
|
|
98
|
+
- It is never allowed to introduce new logic without evidence of relevant failing tests. However, stubs and simple implementation to make imports and test infrastructure work is fine.
|
|
99
|
+
- In the refactor phase, it is perfectly fine to refactor both test and implementation code. That said, completely new functionality is not allowed. Types, clean up, abstractions, and helpers are allowed as long as they do not introduce new behavior.
|
|
100
|
+
- Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
|
|
101
|
+
- Provide the agent with helpful directions so that they do not get stuck when blocking them.
|
|
102
|
+
|
|
103
|
+
## 🛡 Project Rules (Injected into every command)
|
|
104
|
+
|
|
105
|
+
1. **NO BROKEN BUILDS:**
|
|
106
|
+
- Run `pnpm test` before every `/commit`
|
|
107
|
+
- Ensure all tests pass
|
|
108
|
+
- Fix any type errors immediately
|
|
109
|
+
|
|
110
|
+
2. **API DEVELOPMENT:**
|
|
111
|
+
- All new APIs MUST have Zod request/response schemas
|
|
112
|
+
- All APIs MUST be documented in both:
|
|
113
|
+
- OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
|
|
114
|
+
- API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
|
|
115
|
+
- Test ALL parameters and edge cases
|
|
116
|
+
- Include code examples and real-world outputs
|
|
117
|
+
|
|
118
|
+
3. **TDD WORKFLOW:**
|
|
119
|
+
- ALWAYS use /red → /green → /refactor cycle
|
|
120
|
+
- NEVER write implementation without failing test first
|
|
121
|
+
- Use /cycle for feature development
|
|
122
|
+
- Use characterization tests for refactoring
|
|
123
|
+
|
|
124
|
+
4. **API KEY MANAGEMENT:**
|
|
125
|
+
- Support three loading methods:
|
|
126
|
+
- Server environment variables
|
|
127
|
+
- NEXT*PUBLIC* variables (client-side)
|
|
128
|
+
- Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
|
|
129
|
+
- Never hardcode API keys
|
|
130
|
+
- Always validate key availability before use
|
|
131
|
+
|
|
132
|
+
5. **COMPREHENSIVE TESTING:**
|
|
133
|
+
- When researching APIs, read actual implementation code
|
|
134
|
+
- Discover ALL possible parameters (not just documented ones)
|
|
135
|
+
- Test with various parameter combinations
|
|
136
|
+
- Document custom headers, query params, request/response schemas
|
|
137
|
+
- Include validation rules and testing notes
|
|
138
|
+
|
|
139
|
+
6. **NO UI BLOAT:**
|
|
140
|
+
- This is an API project with minimal frontend
|
|
141
|
+
- Only keep necessary test/documentation interfaces
|
|
142
|
+
- Delete unused components immediately
|
|
143
|
+
- No unnecessary UI libraries or features
|
|
144
|
+
|
|
145
|
+
7. **DOCUMENTATION:**
|
|
146
|
+
- If you change an API, you MUST update:
|
|
147
|
+
- OpenAPI spec
|
|
148
|
+
- api-tests-manifest.json
|
|
149
|
+
- Code examples
|
|
150
|
+
- Testing notes
|
|
151
|
+
- Document expected behavior and edge cases
|
|
152
|
+
- Include real-world output examples
|
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
|
|
16
|
+
description: Analyze conversation context for unaddressed items and gaps
|
|
17
|
+
argument-hint: [optional additional info]
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## General Guidelines
|
|
22
|
+
|
|
23
|
+
### Output Style
|
|
24
|
+
|
|
25
|
+
- **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
|
|
26
|
+
- Write natural, descriptive code without meta-commentary about the development process
|
|
27
|
+
- The code should speak for itself - TDD is the process, not the product
|
|
28
|
+
|
|
29
|
+
Analyze the current conversation context and identify things that have not yet been addressed. Look for:
|
|
30
|
+
|
|
31
|
+
1. **Incomplete implementations** - Code that was started but not finished
|
|
32
|
+
2. **Unused variables/results** - Values that were captured but never used
|
|
33
|
+
3. **Missing tests** - Functionality without test coverage
|
|
34
|
+
4. **User requests** - Things the user asked for that weren't fully completed
|
|
35
|
+
5. **TODO comments** - Any TODOs mentioned in conversation
|
|
36
|
+
6. **Error handling gaps** - Missing error cases or edge cases
|
|
37
|
+
7. **Documentation gaps** - Undocumented APIs or features
|
|
38
|
+
8. **Consistency check** - Look for inconsistent patterns, naming conventions, or structure across the codebase
|
|
39
|
+
|
|
40
|
+
Present findings as a prioritized list with:
|
|
41
|
+
|
|
42
|
+
- What the gap is
|
|
43
|
+
- Why it matters
|
|
44
|
+
- Suggested next action
|
|
45
|
+
|
|
46
|
+
If there are no gaps, confirm that everything discussed has been addressed.
|
|
47
|
+
|
|
48
|
+
Additional info:
|
|
49
|
+
$ARGUMENTS
|
|
50
|
+
|
|
51
|
+
## 🛡 Project Rules (Injected into every command)
|
|
52
|
+
|
|
53
|
+
1. **NO BROKEN BUILDS:**
|
|
54
|
+
- Run `pnpm test` before every `/commit`
|
|
55
|
+
- Ensure all tests pass
|
|
56
|
+
- Fix any type errors immediately
|
|
57
|
+
|
|
58
|
+
2. **API DEVELOPMENT:**
|
|
59
|
+
- All new APIs MUST have Zod request/response schemas
|
|
60
|
+
- All APIs MUST be documented in both:
|
|
61
|
+
- OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
|
|
62
|
+
- API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
|
|
63
|
+
- Test ALL parameters and edge cases
|
|
64
|
+
- Include code examples and real-world outputs
|
|
65
|
+
|
|
66
|
+
3. **TDD WORKFLOW:**
|
|
67
|
+
- ALWAYS use /red → /green → /refactor cycle
|
|
68
|
+
- NEVER write implementation without failing test first
|
|
69
|
+
- Use /cycle for feature development
|
|
70
|
+
- Use characterization tests for refactoring
|
|
71
|
+
|
|
72
|
+
4. **API KEY MANAGEMENT:**
|
|
73
|
+
- Support three loading methods:
|
|
74
|
+
- Server environment variables
|
|
75
|
+
- NEXT*PUBLIC* variables (client-side)
|
|
76
|
+
- Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
|
|
77
|
+
- Never hardcode API keys
|
|
78
|
+
- Always validate key availability before use
|
|
79
|
+
|
|
80
|
+
5. **COMPREHENSIVE TESTING:**
|
|
81
|
+
- When researching APIs, read actual implementation code
|
|
82
|
+
- Discover ALL possible parameters (not just documented ones)
|
|
83
|
+
- Test with various parameter combinations
|
|
84
|
+
- Document custom headers, query params, request/response schemas
|
|
85
|
+
- Include validation rules and testing notes
|
|
86
|
+
|
|
87
|
+
6. **NO UI BLOAT:**
|
|
88
|
+
- This is an API project with minimal frontend
|
|
89
|
+
- Only keep necessary test/documentation interfaces
|
|
90
|
+
- Delete unused components immediately
|
|
91
|
+
- No unnecessary UI libraries or features
|
|
92
|
+
|
|
93
|
+
7. **DOCUMENTATION:**
|
|
94
|
+
- If you change an API, you MUST update:
|
|
95
|
+
- OpenAPI spec
|
|
96
|
+
- api-tests-manifest.json
|
|
97
|
+
- Code examples
|
|
98
|
+
- Testing notes
|
|
99
|
+
- Document expected behavior and edge cases
|
|
100
|
+
- Include real-world output examples
|
|
@@ -0,0 +1,152 @@
|
|
|
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
|
+
|
|
16
|
+
description: Execute TDD Green Phase - write minimal implementation to pass the failing test
|
|
17
|
+
argument-hint: <implementation description>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
GREEN PHASE! Apply the below to the info given by user input here:
|
|
22
|
+
|
|
23
|
+
$ARGUMENTS
|
|
24
|
+
|
|
25
|
+
## General Guidelines
|
|
26
|
+
|
|
27
|
+
### Output Style
|
|
28
|
+
|
|
29
|
+
- **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
|
|
30
|
+
- Write natural, descriptive code without meta-commentary about the development process
|
|
31
|
+
- The code should speak for itself - TDD is the process, not the product
|
|
32
|
+
|
|
33
|
+
(If there was no info above, fallback to the context of the conversation)
|
|
34
|
+
|
|
35
|
+
## TDD Fundamentals
|
|
36
|
+
|
|
37
|
+
### The TDD Cycle
|
|
38
|
+
|
|
39
|
+
The foundation of TDD is the Red-Green-Refactor cycle:
|
|
40
|
+
|
|
41
|
+
1. **Red Phase**: Write ONE failing test that describes desired behavior
|
|
42
|
+
- The test must fail for the RIGHT reason (not syntax/import errors)
|
|
43
|
+
- Only one test at a time - this is critical for TDD discipline
|
|
44
|
+
- Exception: For browser-level tests or expensive setup (e.g., Storybook `*.stories.tsx`), group multiple assertions within a single test block to avoid redundant setup - but only when adding assertions to an existing interaction flow. If new user interactions are required, still create a new test. Split files by category if they exceed ~1000 lines.
|
|
45
|
+
- **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
|
|
46
|
+
- Starting TDD for a new feature is always valid, even if test output shows unrelated work
|
|
47
|
+
- For DOM-based tests, use `data-testid` attributes to select elements rather than CSS classes, tag names, or text content
|
|
48
|
+
- Avoid hard-coded timeouts both in form of sleep() or timeout: 5000 etc; use proper async patterns (`waitFor`, `findBy*`, event-based sync) instead and rely on global test configs for timeout settings
|
|
49
|
+
|
|
50
|
+
2. **Green Phase**: Write MINIMAL code to make the test pass
|
|
51
|
+
- Implement only what's needed for the current failing test
|
|
52
|
+
- No anticipatory coding or extra features
|
|
53
|
+
- Address the specific failure message
|
|
54
|
+
|
|
55
|
+
3. **Refactor Phase**: Improve code structure while keeping tests green
|
|
56
|
+
- Only allowed when relevant tests are passing
|
|
57
|
+
- Requires proof that tests have been run and are green
|
|
58
|
+
- Applies to BOTH implementation and test code
|
|
59
|
+
- No refactoring with failing tests - fix them first
|
|
60
|
+
|
|
61
|
+
### Core Violations
|
|
62
|
+
|
|
63
|
+
1. **Multiple Test Addition**
|
|
64
|
+
- Adding more than one new test at once
|
|
65
|
+
- Exception: Initial test file setup or extracting shared test utilities
|
|
66
|
+
|
|
67
|
+
2. **Over-Implementation**
|
|
68
|
+
- Code that exceeds what's needed to pass the current failing test
|
|
69
|
+
- Adding untested features, methods, or error handling
|
|
70
|
+
- Implementing multiple methods when test only requires one
|
|
71
|
+
|
|
72
|
+
3. **Premature Implementation**
|
|
73
|
+
- Adding implementation before a test exists and fails properly
|
|
74
|
+
- Adding implementation without running the test first
|
|
75
|
+
- Refactoring when tests haven't been run or are failing
|
|
76
|
+
|
|
77
|
+
### Critical Principle: Incremental Development
|
|
78
|
+
|
|
79
|
+
Each step in TDD should address ONE specific issue:
|
|
80
|
+
|
|
81
|
+
- Test fails "not defined" → Create empty stub/class only
|
|
82
|
+
- Test fails "not a function" → Add method stub only
|
|
83
|
+
- Test fails with assertion → Implement minimal logic only
|
|
84
|
+
|
|
85
|
+
### Optional Pre-Phase: Spike Phase
|
|
86
|
+
|
|
87
|
+
In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
|
|
88
|
+
This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
|
|
89
|
+
|
|
90
|
+
- The goal of a Spike is **exploration and learning**, not implementation.
|
|
91
|
+
- The code written during a Spike is **disposable** and **must not** be merged or reused directly.
|
|
92
|
+
- Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
|
|
93
|
+
- A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
|
|
94
|
+
|
|
95
|
+
### General Information
|
|
96
|
+
|
|
97
|
+
- Sometimes the test output shows as no tests have been run when a new test is failing due to a missing import or constructor. In such cases, allow the agent to create simple stubs. Ask them if they forgot to create a stub if they are stuck.
|
|
98
|
+
- It is never allowed to introduce new logic without evidence of relevant failing tests. However, stubs and simple implementation to make imports and test infrastructure work is fine.
|
|
99
|
+
- In the refactor phase, it is perfectly fine to refactor both test and implementation code. That said, completely new functionality is not allowed. Types, clean up, abstractions, and helpers are allowed as long as they do not introduce new behavior.
|
|
100
|
+
- Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
|
|
101
|
+
- Provide the agent with helpful directions so that they do not get stuck when blocking them.
|
|
102
|
+
|
|
103
|
+
## 🛡 Project Rules (Injected into every command)
|
|
104
|
+
|
|
105
|
+
1. **NO BROKEN BUILDS:**
|
|
106
|
+
- Run `pnpm test` before every `/commit`
|
|
107
|
+
- Ensure all tests pass
|
|
108
|
+
- Fix any type errors immediately
|
|
109
|
+
|
|
110
|
+
2. **API DEVELOPMENT:**
|
|
111
|
+
- All new APIs MUST have Zod request/response schemas
|
|
112
|
+
- All APIs MUST be documented in both:
|
|
113
|
+
- OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
|
|
114
|
+
- API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
|
|
115
|
+
- Test ALL parameters and edge cases
|
|
116
|
+
- Include code examples and real-world outputs
|
|
117
|
+
|
|
118
|
+
3. **TDD WORKFLOW:**
|
|
119
|
+
- ALWAYS use /red → /green → /refactor cycle
|
|
120
|
+
- NEVER write implementation without failing test first
|
|
121
|
+
- Use /cycle for feature development
|
|
122
|
+
- Use characterization tests for refactoring
|
|
123
|
+
|
|
124
|
+
4. **API KEY MANAGEMENT:**
|
|
125
|
+
- Support three loading methods:
|
|
126
|
+
- Server environment variables
|
|
127
|
+
- NEXT*PUBLIC* variables (client-side)
|
|
128
|
+
- Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
|
|
129
|
+
- Never hardcode API keys
|
|
130
|
+
- Always validate key availability before use
|
|
131
|
+
|
|
132
|
+
5. **COMPREHENSIVE TESTING:**
|
|
133
|
+
- When researching APIs, read actual implementation code
|
|
134
|
+
- Discover ALL possible parameters (not just documented ones)
|
|
135
|
+
- Test with various parameter combinations
|
|
136
|
+
- Document custom headers, query params, request/response schemas
|
|
137
|
+
- Include validation rules and testing notes
|
|
138
|
+
|
|
139
|
+
6. **NO UI BLOAT:**
|
|
140
|
+
- This is an API project with minimal frontend
|
|
141
|
+
- Only keep necessary test/documentation interfaces
|
|
142
|
+
- Delete unused components immediately
|
|
143
|
+
- No unnecessary UI libraries or features
|
|
144
|
+
|
|
145
|
+
7. **DOCUMENTATION:**
|
|
146
|
+
- If you change an API, you MUST update:
|
|
147
|
+
- OpenAPI spec
|
|
148
|
+
- api-tests-manifest.json
|
|
149
|
+
- Code examples
|
|
150
|
+
- Testing notes
|
|
151
|
+
- Document expected behavior and edge cases
|
|
152
|
+
- Include real-world output examples
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: issue
|
|
3
|
+
description: Analyze GitHub issue and create TDD implementation plan. Converts issue requirements into executable tasks with acceptance criteria. Use when starting work from issues. Keywords: github, issues, planning, tdd, requirements
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires Claude Code with MCP servers (Context7, GitHub), Python 3.9+ for hooks, pnpm 10.11.0+
|
|
6
|
+
metadata:
|
|
7
|
+
version: "3.0.0"
|
|
8
|
+
category: "workflow"
|
|
9
|
+
tags: ['github', 'issues', 'planning', 'tdd']
|
|
10
|
+
author: "Hustle Together"
|
|
11
|
+
allowed-tools: WebSearch WebFetch mcp__context7 mcp__github AskUserQuestion Read Write Edit Bash TodoWrite
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
description: Analyze GitHub issue and create TDD implementation plan
|
|
17
|
+
argument-hint: [optional-issue-number]
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
Analyze GitHub issue and create TDD implementation plan.
|
|
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
|
+
Process:
|
|
32
|
+
|
|
33
|
+
1. Get Issue Number
|
|
34
|
+
|
|
35
|
+
- Either from branch name use that issue number
|
|
36
|
+
- Patterns: issue-123, 123-feature, feature/123, fix/123
|
|
37
|
+
- Or from this bullet point with custom info: $ARGUMENTS
|
|
38
|
+
- If not found: ask user
|
|
39
|
+
|
|
40
|
+
1. Fetch Issue
|
|
41
|
+
|
|
42
|
+
Try to fetch the issue using GitHub MCP (mcp**github**issue_read tool).
|
|
43
|
+
|
|
44
|
+
If GitHub MCP is not configured, show:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
GitHub MCP not configured!
|
|
48
|
+
See: https://github.com/modelcontextprotocol/servers/tree/main/src/github
|
|
49
|
+
Trying GitHub CLI fallback...
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Then try using `gh issue view [ISSUE_NUMBER] --json` as fallback.
|
|
53
|
+
|
|
54
|
+
1. Analyze and Plan
|
|
55
|
+
|
|
56
|
+
Summarize the issue and requirements, then:
|
|
57
|
+
|
|
58
|
+
## Discovery Phase
|
|
59
|
+
|
|
60
|
+
Understand the requirement by asking (use AskUserQuestion if needed):
|
|
61
|
+
|
|
62
|
+
**Problem Statement**
|
|
63
|
+
|
|
64
|
+
- What problem does this solve?
|
|
65
|
+
- Who experiences this problem?
|
|
66
|
+
- What's the current pain point?
|
|
67
|
+
|
|
68
|
+
**Desired Outcome**
|
|
69
|
+
|
|
70
|
+
- What should happen after this is built?
|
|
71
|
+
- How will users interact with it?
|
|
72
|
+
- What does success look like?
|
|
73
|
+
|
|
74
|
+
**Scope & Constraints**
|
|
75
|
+
|
|
76
|
+
- What's in scope vs. out of scope?
|
|
77
|
+
- Any technical constraints?
|
|
78
|
+
- Dependencies on other systems/features?
|
|
79
|
+
|
|
80
|
+
**Context Check**
|
|
81
|
+
|
|
82
|
+
- Search codebase for related features/modules
|
|
83
|
+
- Check for existing test files that might be relevant
|
|
84
|
+
|
|
85
|
+
## TDD Fundamentals
|
|
86
|
+
|
|
87
|
+
### The TDD Cycle
|
|
88
|
+
|
|
89
|
+
The foundation of TDD is the Red-Green-Refactor cycle:
|
|
90
|
+
|
|
91
|
+
1. **Red Phase**: Write ONE failing test that describes desired behavior
|
|
92
|
+
- The test must fail for the RIGHT reason (not syntax/import errors)
|
|
93
|
+
- Only one test at a time - this is critical for TDD discipline
|
|
94
|
+
- 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.
|
|
95
|
+
- **Adding a single test to a test file is ALWAYS allowed** - no prior test output needed
|
|
96
|
+
- Starting TDD for a new feature is always valid, even if test output shows unrelated work
|
|
97
|
+
- For DOM-based tests, use `data-testid` attributes to select elements rather than CSS classes, tag names, or text content
|
|
98
|
+
- 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
|
|
99
|
+
|
|
100
|
+
2. **Green Phase**: Write MINIMAL code to make the test pass
|
|
101
|
+
- Implement only what's needed for the current failing test
|
|
102
|
+
- No anticipatory coding or extra features
|
|
103
|
+
- Address the specific failure message
|
|
104
|
+
|
|
105
|
+
3. **Refactor Phase**: Improve code structure while keeping tests green
|
|
106
|
+
- Only allowed when relevant tests are passing
|
|
107
|
+
- Requires proof that tests have been run and are green
|
|
108
|
+
- Applies to BOTH implementation and test code
|
|
109
|
+
- No refactoring with failing tests - fix them first
|
|
110
|
+
|
|
111
|
+
### Core Violations
|
|
112
|
+
|
|
113
|
+
1. **Multiple Test Addition**
|
|
114
|
+
- Adding more than one new test at once
|
|
115
|
+
- Exception: Initial test file setup or extracting shared test utilities
|
|
116
|
+
|
|
117
|
+
2. **Over-Implementation**
|
|
118
|
+
- Code that exceeds what's needed to pass the current failing test
|
|
119
|
+
- Adding untested features, methods, or error handling
|
|
120
|
+
- Implementing multiple methods when test only requires one
|
|
121
|
+
|
|
122
|
+
3. **Premature Implementation**
|
|
123
|
+
- Adding implementation before a test exists and fails properly
|
|
124
|
+
- Adding implementation without running the test first
|
|
125
|
+
- Refactoring when tests haven't been run or are failing
|
|
126
|
+
|
|
127
|
+
### Critical Principle: Incremental Development
|
|
128
|
+
|
|
129
|
+
Each step in TDD should address ONE specific issue:
|
|
130
|
+
|
|
131
|
+
- Test fails "not defined" → Create empty stub/class only
|
|
132
|
+
- Test fails "not a function" → Add method stub only
|
|
133
|
+
- Test fails with assertion → Implement minimal logic only
|
|
134
|
+
|
|
135
|
+
### Optional Pre-Phase: Spike Phase
|
|
136
|
+
|
|
137
|
+
In rare cases where the problem space, interface, or expected behavior is unclear, a **Spike Phase** may be used **before the Red Phase**.
|
|
138
|
+
This phase is **not part of the regular TDD workflow** and must only be applied under exceptional circumstances.
|
|
139
|
+
|
|
140
|
+
- The goal of a Spike is **exploration and learning**, not implementation.
|
|
141
|
+
- The code written during a Spike is **disposable** and **must not** be merged or reused directly.
|
|
142
|
+
- Once sufficient understanding is achieved, all spike code is discarded, and normal TDD resumes starting from the **Red Phase**.
|
|
143
|
+
- A Spike is justified only when it is impossible to define a meaningful failing test due to technical uncertainty or unknown system behavior.
|
|
144
|
+
|
|
145
|
+
### General Information
|
|
146
|
+
|
|
147
|
+
- 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.
|
|
148
|
+
- 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.
|
|
149
|
+
- 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.
|
|
150
|
+
- Adding types, interfaces, or a constant in order to replace magic values is perfectly fine during refactoring.
|
|
151
|
+
- Provide the agent with helpful directions so that they do not get stuck when blocking them.
|
|
152
|
+
|
|
153
|
+
## 🛡 Project Rules (Injected into every command)
|
|
154
|
+
|
|
155
|
+
1. **NO BROKEN BUILDS:**
|
|
156
|
+
- Run `pnpm test` before every `/commit`
|
|
157
|
+
- Ensure all tests pass
|
|
158
|
+
- Fix any type errors immediately
|
|
159
|
+
|
|
160
|
+
2. **API DEVELOPMENT:**
|
|
161
|
+
- All new APIs MUST have Zod request/response schemas
|
|
162
|
+
- All APIs MUST be documented in both:
|
|
163
|
+
- OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
|
|
164
|
+
- API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
|
|
165
|
+
- Test ALL parameters and edge cases
|
|
166
|
+
- Include code examples and real-world outputs
|
|
167
|
+
|
|
168
|
+
3. **TDD WORKFLOW:**
|
|
169
|
+
- ALWAYS use /red → /green → /refactor cycle
|
|
170
|
+
- NEVER write implementation without failing test first
|
|
171
|
+
- Use /cycle for feature development
|
|
172
|
+
- Use characterization tests for refactoring
|
|
173
|
+
|
|
174
|
+
4. **API KEY MANAGEMENT:**
|
|
175
|
+
- Support three loading methods:
|
|
176
|
+
- Server environment variables
|
|
177
|
+
- NEXT*PUBLIC* variables (client-side)
|
|
178
|
+
- Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
|
|
179
|
+
- Never hardcode API keys
|
|
180
|
+
- Always validate key availability before use
|
|
181
|
+
|
|
182
|
+
5. **COMPREHENSIVE TESTING:**
|
|
183
|
+
- When researching APIs, read actual implementation code
|
|
184
|
+
- Discover ALL possible parameters (not just documented ones)
|
|
185
|
+
- Test with various parameter combinations
|
|
186
|
+
- Document custom headers, query params, request/response schemas
|
|
187
|
+
- Include validation rules and testing notes
|
|
188
|
+
|
|
189
|
+
6. **NO UI BLOAT:**
|
|
190
|
+
- This is an API project with minimal frontend
|
|
191
|
+
- Only keep necessary test/documentation interfaces
|
|
192
|
+
- Delete unused components immediately
|
|
193
|
+
- No unnecessary UI libraries or features
|
|
194
|
+
|
|
195
|
+
7. **DOCUMENTATION:**
|
|
196
|
+
- If you change an API, you MUST update:
|
|
197
|
+
- OpenAPI spec
|
|
198
|
+
- api-tests-manifest.json
|
|
199
|
+
- Code examples
|
|
200
|
+
- Testing notes
|
|
201
|
+
- Document expected behavior and edge cases
|
|
202
|
+
- Include real-world output examples
|