@hustle-together/api-dev-tools 2.0.7 → 3.1.0
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/README.md +343 -467
- package/bin/cli.js +229 -15
- package/commands/README.md +124 -251
- package/commands/api-create.md +318 -136
- package/commands/api-interview.md +252 -256
- package/commands/api-research.md +209 -234
- package/commands/api-verify.md +231 -0
- package/demo/audio/generate-all-narrations.js +581 -0
- package/demo/audio/generate-narration.js +120 -56
- package/demo/audio/generate-voice-previews.js +140 -0
- package/demo/audio/narration-adam-timing.json +4675 -0
- package/demo/audio/narration-adam.mp3 +0 -0
- package/demo/audio/narration-creature-timing.json +4675 -0
- package/demo/audio/narration-creature.mp3 +0 -0
- package/demo/audio/narration-gaming-timing.json +4675 -0
- package/demo/audio/narration-gaming.mp3 +0 -0
- package/demo/audio/narration-hope-timing.json +4675 -0
- package/demo/audio/narration-hope.mp3 +0 -0
- package/demo/audio/narration-mark-timing.json +4675 -0
- package/demo/audio/narration-mark.mp3 +0 -0
- package/demo/audio/previews/manifest.json +30 -0
- package/demo/audio/previews/preview-creature.mp3 +0 -0
- package/demo/audio/previews/preview-gaming.mp3 +0 -0
- package/demo/audio/previews/preview-hope.mp3 +0 -0
- package/demo/audio/previews/preview-mark.mp3 +0 -0
- package/demo/audio/voices-manifest.json +50 -0
- package/demo/hustle-together/blog/gemini-vs-claude-widgets.html +30 -28
- package/demo/hustle-together/blog/interview-driven-api-development.html +37 -23
- package/demo/hustle-together/index.html +142 -109
- package/demo/workflow-demo.html +2618 -1036
- package/hooks/api-workflow-check.py +2 -0
- package/hooks/enforce-deep-research.py +180 -0
- package/hooks/enforce-disambiguation.py +149 -0
- package/hooks/enforce-documentation.py +187 -0
- package/hooks/enforce-environment.py +249 -0
- package/hooks/enforce-refactor.py +187 -0
- package/hooks/enforce-research.py +93 -46
- package/hooks/enforce-schema.py +186 -0
- package/hooks/enforce-scope.py +156 -0
- package/hooks/enforce-tdd-red.py +246 -0
- package/hooks/enforce-verify.py +186 -0
- package/hooks/periodic-reground.py +154 -0
- package/hooks/session-startup.py +151 -0
- package/hooks/track-tool-use.py +109 -17
- package/hooks/verify-after-green.py +282 -0
- package/package.json +3 -2
- package/scripts/collect-test-results.ts +404 -0
- package/scripts/extract-parameters.ts +483 -0
- package/scripts/generate-test-manifest.ts +520 -0
- package/templates/CLAUDE-SECTION.md +84 -0
- package/templates/api-dev-state.json +83 -8
- package/templates/api-test/page.tsx +315 -0
- package/templates/api-test/test-structure/route.ts +269 -0
- package/templates/research-index.json +6 -0
- package/templates/settings.json +59 -0
package/commands/README.md
CHANGED
|
@@ -1,275 +1,168 @@
|
|
|
1
|
-
# API Development Slash Commands
|
|
1
|
+
# API Development Slash Commands v3.0
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Interview-driven, research-first API development workflow with continuous verification loops**
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## What's New in v3.0
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- **Phase 0: Disambiguation** - Search variations before research
|
|
8
|
+
- **Phase 9: Verify** - Re-research after tests pass to catch memory errors
|
|
9
|
+
- **Adaptive Research** - Propose searches based on context, not shotgun
|
|
10
|
+
- **Questions FROM Research** - Interview generates questions from discovered params
|
|
11
|
+
- **7-Turn Re-grounding** - Periodic context injection prevents dilution
|
|
12
|
+
- **Research Freshness** - 7-day cache with staleness warnings
|
|
8
13
|
|
|
9
|
-
##
|
|
14
|
+
## Hook Architecture (9 Hooks)
|
|
10
15
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
|
14
|
-
|
|
15
|
-
| `enforce-research.py` | PreToolUse
|
|
16
|
-
| `
|
|
17
|
-
| `
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- **All research is logged** - WebSearch, WebFetch, Context7 calls tracked in state file
|
|
23
|
-
- **Progress is visible** - Check `.claude/api-dev-state.json` anytime
|
|
24
|
-
- **Workflow completion verified** - Cannot stop until TDD phases complete
|
|
25
|
-
|
|
26
|
-
### Check Progress
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
# View current state
|
|
30
|
-
cat .claude/api-dev-state.json | jq '.phases'
|
|
31
|
-
|
|
32
|
-
# Or use the status command
|
|
33
|
-
/api-status
|
|
34
|
-
```
|
|
16
|
+
| Hook | Event | Purpose |
|
|
17
|
+
|------|-------|---------|
|
|
18
|
+
| `session-startup.py` | SessionStart | Inject state at session start |
|
|
19
|
+
| `enforce-external-research.py` | UserPromptSubmit | Detect API terms, require research |
|
|
20
|
+
| `enforce-research.py` | PreToolUse | Block writes until research done |
|
|
21
|
+
| `enforce-interview.py` | PreToolUse | Inject interview decisions |
|
|
22
|
+
| `verify-implementation.py` | PreToolUse | Require test file before route |
|
|
23
|
+
| `track-tool-use.py` | PostToolUse | Log research, count turns |
|
|
24
|
+
| `periodic-reground.py` | PostToolUse | Re-ground every 7 turns |
|
|
25
|
+
| `verify-after-green.py` | PostToolUse | Trigger Phase 9 after test pass |
|
|
26
|
+
| `api-workflow-check.py` | Stop | Block if phases incomplete |
|
|
35
27
|
|
|
36
28
|
## Available Commands
|
|
37
29
|
|
|
38
|
-
###
|
|
30
|
+
### Complete Workflow
|
|
39
31
|
|
|
40
32
|
**`/api-create [endpoint-name]`**
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
33
|
+
- Runs all 12 phases automatically
|
|
34
|
+
- Loop-back architecture at every checkpoint
|
|
35
|
+
- See [api-create.md](api-create.md) for full flow
|
|
44
36
|
|
|
45
|
-
###
|
|
37
|
+
### Individual Phases
|
|
46
38
|
|
|
47
39
|
**`/api-interview [endpoint-name]`**
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
- **Output:** `/src/v2/docs/endpoints/[endpoint-name].md`
|
|
40
|
+
- Questions GENERATED from research findings
|
|
41
|
+
- Different question types: enum, continuous, boolean
|
|
42
|
+
- See [api-interview.md](api-interview.md)
|
|
52
43
|
|
|
53
44
|
**`/api-research [library-or-service]`**
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
-
|
|
45
|
+
- Adaptive propose-approve flow (not shotgun)
|
|
46
|
+
- Research cached with 7-day freshness
|
|
47
|
+
- See [api-research.md](api-research.md)
|
|
48
|
+
|
|
49
|
+
**`/api-verify [endpoint-name]`** (NEW)
|
|
50
|
+
- Manual Phase 9 verification
|
|
51
|
+
- Re-read docs, compare to implementation
|
|
52
|
+
- Report gaps, loop back or document omissions
|
|
53
|
+
- See [api-verify.md](api-verify.md)
|
|
59
54
|
|
|
60
55
|
**`/api-env [endpoint-name]`**
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
- Provides setup instructions for missing keys
|
|
64
|
-
- **Output:** Terminal report + action items
|
|
56
|
+
- Check API keys and environment
|
|
57
|
+
- See [api-env.md](api-env.md)
|
|
65
58
|
|
|
66
|
-
**`/api-status [endpoint-name]`**
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
- Updates V2 implementation status document
|
|
70
|
-
- **Output:** Progress report
|
|
59
|
+
**`/api-status [endpoint-name]`**
|
|
60
|
+
- Track progress through 12 phases
|
|
61
|
+
- See [api-status.md](api-status.md)
|
|
71
62
|
|
|
72
|
-
###
|
|
63
|
+
### TDD Commands
|
|
73
64
|
|
|
74
|
-
|
|
65
|
+
From [@wbern/claude-instructions](https://github.com/wbern/claude-instructions):
|
|
75
66
|
- `/red` - Write ONE failing test
|
|
76
67
|
- `/green` - Minimal implementation to pass
|
|
77
|
-
- `/refactor` - Clean up
|
|
78
|
-
- `/cycle [description]` - Full Red → Green → Refactor
|
|
68
|
+
- `/refactor` - Clean up while tests pass
|
|
69
|
+
- `/cycle [description]` - Full Red → Green → Refactor
|
|
79
70
|
|
|
80
|
-
##
|
|
71
|
+
## 12-Phase Flow
|
|
81
72
|
|
|
82
|
-
### Option 1: Fully Automated
|
|
83
|
-
```bash
|
|
84
|
-
/api-create generate-css
|
|
85
73
|
```
|
|
86
|
-
|
|
87
|
-
1
|
|
88
|
-
2
|
|
89
|
-
3
|
|
90
|
-
4
|
|
91
|
-
5
|
|
92
|
-
6
|
|
93
|
-
7
|
|
94
|
-
8
|
|
95
|
-
9
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
/api-interview generate-css
|
|
101
|
-
# (Answer 20 questions about purpose, usage, requirements)
|
|
102
|
-
|
|
103
|
-
# Phase 2: Research
|
|
104
|
-
/api-research google-generative-ai
|
|
105
|
-
# (Discovers all Gemini SDK parameters)
|
|
106
|
-
|
|
107
|
-
# Phase 3: Environment
|
|
108
|
-
/api-env generate-css
|
|
109
|
-
# (Verifies GOOGLE_GENERATIVE_AI_API_KEY exists)
|
|
110
|
-
|
|
111
|
-
# Phase 4: TDD Implementation
|
|
112
|
-
/red
|
|
113
|
-
# (Write failing tests based on interview + research)
|
|
114
|
-
|
|
115
|
-
/green
|
|
116
|
-
# (Implement route handler with Zod schemas)
|
|
74
|
+
Phase 0: DISAMBIGUATION - Clarify ambiguous terms
|
|
75
|
+
Phase 1: SCOPE - Confirm understanding
|
|
76
|
+
Phase 2: INITIAL RESEARCH - 2-3 targeted searches
|
|
77
|
+
Phase 3: INTERVIEW - Questions FROM research
|
|
78
|
+
Phase 4: DEEP RESEARCH - Adaptive propose-approve
|
|
79
|
+
Phase 5: SCHEMA - Zod from research + interview
|
|
80
|
+
Phase 6: ENVIRONMENT - Verify API keys
|
|
81
|
+
Phase 7: TDD RED - Write failing tests
|
|
82
|
+
Phase 8: TDD GREEN - Minimal implementation
|
|
83
|
+
Phase 9: VERIFY - Re-research, find gaps
|
|
84
|
+
Phase 10: TDD REFACTOR - Clean up code
|
|
85
|
+
Phase 11: DOCUMENTATION - Update manifests
|
|
86
|
+
Phase 12: COMPLETION - Final verification
|
|
87
|
+
```
|
|
117
88
|
|
|
118
|
-
|
|
119
|
-
# (Clean up, extract patterns, improve code)
|
|
89
|
+
## State File
|
|
120
90
|
|
|
121
|
-
|
|
122
|
-
# (Update api-tests-manifest.json, OpenAPI spec, status doc)
|
|
91
|
+
All progress tracked in `.claude/api-dev-state.json`:
|
|
123
92
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"version": "3.0.0",
|
|
96
|
+
"endpoint": "brandfetch",
|
|
97
|
+
"turn_count": 23,
|
|
98
|
+
"phases": {
|
|
99
|
+
"disambiguation": { "status": "complete" },
|
|
100
|
+
"scope": { "status": "complete" },
|
|
101
|
+
"research_initial": { "status": "complete" },
|
|
102
|
+
"interview": { "status": "complete", "decisions": {...} },
|
|
103
|
+
"research_deep": {
|
|
104
|
+
"proposed_searches": [...],
|
|
105
|
+
"approved_searches": [...],
|
|
106
|
+
"skipped_searches": [...]
|
|
107
|
+
},
|
|
108
|
+
"verify": {
|
|
109
|
+
"gaps_found": 2,
|
|
110
|
+
"gaps_fixed": 2,
|
|
111
|
+
"intentional_omissions": [...]
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"reground_history": [...]
|
|
115
|
+
}
|
|
127
116
|
```
|
|
128
117
|
|
|
129
|
-
##
|
|
130
|
-
|
|
131
|
-
| Command | When to Use | Output |
|
|
132
|
-
|---------|-------------|--------|
|
|
133
|
-
| `/api-create [endpoint]` | Starting new endpoint | Complete implementation |
|
|
134
|
-
| `/api-interview [endpoint]` | Need to understand requirements | Documentation file |
|
|
135
|
-
| `/api-research [library]` | Integrating external API/SDK | Research document |
|
|
136
|
-
| `/api-env [endpoint]` | Before implementation | Environment check report |
|
|
137
|
-
| `/api-status [endpoint]` | Check progress | Status report |
|
|
138
|
-
| `/red` | Write test first | Failing test |
|
|
139
|
-
| `/green` | Make test pass | Working implementation |
|
|
140
|
-
| `/refactor` | Clean up code | Improved code |
|
|
141
|
-
| `/cycle [desc]` | Implement feature | Full TDD cycle |
|
|
118
|
+
## Research Cache
|
|
142
119
|
|
|
143
|
-
|
|
120
|
+
Research cached in `.claude/research/`:
|
|
144
121
|
|
|
145
|
-
Each endpoint creates this structure:
|
|
146
122
|
```
|
|
147
|
-
|
|
148
|
-
├──
|
|
149
|
-
├──
|
|
150
|
-
│
|
|
151
|
-
└──
|
|
152
|
-
|
|
153
|
-
src/v2/docs/
|
|
154
|
-
├── endpoints/
|
|
155
|
-
│ └── [endpoint-name].md # Interview results
|
|
156
|
-
└── research/
|
|
157
|
-
└── [library-name].md # External API research
|
|
158
|
-
|
|
159
|
-
src/app/api-test/
|
|
160
|
-
└── api-tests-manifest.json # Updated with new tests
|
|
161
|
-
|
|
162
|
-
src/lib/openapi/endpoints/
|
|
163
|
-
└── [endpoint-name].ts # OpenAPI spec
|
|
123
|
+
.claude/research/
|
|
124
|
+
├── brandfetch/
|
|
125
|
+
│ ├── 2025-12-08_initial.md
|
|
126
|
+
│ ├── 2025-12-08_deep.md
|
|
127
|
+
│ └── CURRENT.md
|
|
128
|
+
└── index.json ← Freshness tracking (7-day validity)
|
|
164
129
|
```
|
|
165
130
|
|
|
166
|
-
##
|
|
167
|
-
|
|
168
|
-
###
|
|
169
|
-
**Never write code without understanding WHY it exists.**
|
|
170
|
-
- Interview before implementation
|
|
171
|
-
- Document real-world usage
|
|
172
|
-
- Understand edge cases
|
|
173
|
-
|
|
174
|
-
### 2. Research Thoroughly
|
|
175
|
-
**Find ALL parameters, not just the documented ones.**
|
|
176
|
-
- Read official docs
|
|
177
|
-
- Check source code
|
|
178
|
-
- Review TypeScript definitions
|
|
179
|
-
- Test assumptions
|
|
180
|
-
|
|
181
|
-
### 3. Test First (TDD)
|
|
182
|
-
**No implementation without a failing test.**
|
|
183
|
-
- Red: Write test that fails
|
|
184
|
-
- Green: Minimal code to pass
|
|
185
|
-
- Refactor: Improve while tests pass
|
|
186
|
-
|
|
187
|
-
### 4. Document Everything
|
|
188
|
-
**Future you needs to understand this.**
|
|
189
|
-
- Interview results
|
|
190
|
-
- Research findings
|
|
191
|
-
- API schemas
|
|
192
|
-
- Code examples
|
|
193
|
-
- Testing notes
|
|
194
|
-
|
|
195
|
-
### 5. Verify Environment
|
|
196
|
-
**Check API keys before starting.**
|
|
197
|
-
- Identify required services
|
|
198
|
-
- Verify keys exist
|
|
199
|
-
- Document setup
|
|
200
|
-
- Test connections
|
|
201
|
-
|
|
202
|
-
## Integration with Existing Tools
|
|
203
|
-
|
|
204
|
-
These commands work alongside:
|
|
205
|
-
- **`/plan`** - Create implementation checklist
|
|
206
|
-
- **`/gap`** - Find missing pieces
|
|
207
|
-
- **`/issue [url]`** - Start from GitHub issue
|
|
208
|
-
- **`/commit`** - AI-generated semantic commits
|
|
209
|
-
- **`/pr`** - Create pull request
|
|
210
|
-
|
|
211
|
-
## Why This Approach Works
|
|
212
|
-
|
|
213
|
-
### Problems with Previous Approach
|
|
214
|
-
❌ Tests written without understanding purpose
|
|
215
|
-
❌ Missing parameters from incomplete research
|
|
216
|
-
❌ Failed tests due to missing API keys
|
|
217
|
-
❌ No documentation of real-world usage
|
|
218
|
-
❌ Mechanical testing without context
|
|
219
|
-
|
|
220
|
-
### Benefits of New Approach
|
|
221
|
-
✅ Deep understanding before coding
|
|
222
|
-
✅ Complete parameter coverage
|
|
223
|
-
✅ Environment verified upfront
|
|
224
|
-
✅ Documentation drives implementation
|
|
225
|
-
✅ Tests reflect actual usage patterns
|
|
226
|
-
✅ Consistent, repeatable process
|
|
227
|
-
✅ Nothing gets forgotten
|
|
228
|
-
|
|
229
|
-
## Getting Started
|
|
230
|
-
|
|
231
|
-
### First Time Setup
|
|
232
|
-
1. Review this README
|
|
233
|
-
2. Read `/src/v2/docs/AI_WORKFLOW.md`
|
|
234
|
-
3. Read `/src/v2/docs/Main Doc – V2 Development Patterns.md`
|
|
235
|
-
4. Try `/api-create` with a simple endpoint
|
|
236
|
-
|
|
237
|
-
### For Each New Endpoint
|
|
131
|
+
## Quick Start
|
|
132
|
+
|
|
133
|
+
### Automated
|
|
238
134
|
```bash
|
|
239
|
-
|
|
240
|
-
/api-create [endpoint-name]
|
|
241
|
-
|
|
242
|
-
# Or manual for learning
|
|
243
|
-
/api-interview [endpoint-name]
|
|
244
|
-
/api-research [library]
|
|
245
|
-
/api-env [endpoint-name]
|
|
246
|
-
/cycle [description]
|
|
247
|
-
/commit
|
|
135
|
+
/api-create my-endpoint
|
|
248
136
|
```
|
|
249
137
|
|
|
250
|
-
###
|
|
138
|
+
### Manual Step-by-Step
|
|
251
139
|
```bash
|
|
252
|
-
/api-
|
|
253
|
-
/api-
|
|
254
|
-
|
|
140
|
+
/api-research [library] # Initial research
|
|
141
|
+
/api-interview [endpoint] # Questions from research
|
|
142
|
+
/api-env [endpoint] # Verify environment
|
|
143
|
+
/red # Failing tests
|
|
144
|
+
/green # Make tests pass
|
|
145
|
+
/api-verify [endpoint] # Compare to docs
|
|
146
|
+
/refactor # Clean up
|
|
147
|
+
/commit # Semantic commit
|
|
255
148
|
```
|
|
256
149
|
|
|
257
150
|
## Installation
|
|
258
151
|
|
|
259
|
-
Install via NPX command:
|
|
260
152
|
```bash
|
|
261
153
|
npx @hustle-together/api-dev-tools --scope=project
|
|
262
154
|
```
|
|
263
155
|
|
|
264
|
-
|
|
265
|
-
-
|
|
266
|
-
-
|
|
267
|
-
-
|
|
268
|
-
-
|
|
156
|
+
Installs:
|
|
157
|
+
- Commands in `.claude/commands/`
|
|
158
|
+
- Hooks in `.claude/hooks/`
|
|
159
|
+
- Settings in `.claude/settings.json`
|
|
160
|
+
- State template in `.claude/api-dev-state.json`
|
|
161
|
+
- Research index in `.claude/research/index.json`
|
|
269
162
|
|
|
270
|
-
### Team-Wide
|
|
163
|
+
### Team-Wide
|
|
271
164
|
|
|
272
|
-
Add to
|
|
165
|
+
Add to `package.json`:
|
|
273
166
|
```json
|
|
274
167
|
{
|
|
275
168
|
"scripts": {
|
|
@@ -278,35 +171,15 @@ Add to your project's `package.json`:
|
|
|
278
171
|
}
|
|
279
172
|
```
|
|
280
173
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
## References
|
|
284
|
-
|
|
285
|
-
- **AI Workflow:** `/src/v2/docs/AI_WORKFLOW.md`
|
|
286
|
-
- **V2 Patterns:** `/src/v2/docs/Main Doc – V2 Development Patterns.md`
|
|
287
|
-
- **AI SDK Catalog:** `/src/v2/docs/ai-sdk-catalog.json`
|
|
288
|
-
- **API Testing Plan:** `/src/v2/docs/API_TESTING_PLAN.md`
|
|
289
|
-
- **Implementation Status:** `/src/v2/docs/v2-api-implementation-status.md`
|
|
290
|
-
|
|
291
|
-
## Support
|
|
292
|
-
|
|
293
|
-
If commands aren't working:
|
|
294
|
-
1. Check that files exist in `.claude/commands/`
|
|
295
|
-
2. Verify command syntax matches usage examples
|
|
296
|
-
3. Review error messages for missing dependencies
|
|
297
|
-
4. Check that required docs exist in `/src/v2/docs/`
|
|
298
|
-
|
|
299
|
-
## Contributing
|
|
174
|
+
## Key Principles
|
|
300
175
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
5. Commit improvements
|
|
176
|
+
1. **Loop Until Green** - Every verification loops back if not successful
|
|
177
|
+
2. **Continuous Interviews** - Checkpoints at EVERY phase transition
|
|
178
|
+
3. **Adaptive Research** - Propose based on context, not shotgun
|
|
179
|
+
4. **Self-Documenting** - State file captures everything
|
|
180
|
+
5. **Verify After Green** - Re-research to catch memory errors
|
|
307
181
|
|
|
308
182
|
---
|
|
309
183
|
|
|
310
|
-
**
|
|
311
|
-
**
|
|
312
|
-
**Status:** Ready for use
|
|
184
|
+
**Version:** 3.0.0
|
|
185
|
+
**Last Updated:** 2025-12-08
|