@hustle-together/api-dev-tools 2.0.6 → 3.0.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 +283 -478
- package/bin/cli.js +55 -11
- 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 +516 -0
- package/demo/audio/generate-voice-previews.js +140 -0
- package/demo/audio/narration-adam-timing.json +3666 -0
- package/demo/audio/narration-adam.mp3 +0 -0
- package/demo/audio/narration-creature-timing.json +3666 -0
- package/demo/audio/narration-creature.mp3 +0 -0
- package/demo/audio/narration-gaming-timing.json +3666 -0
- package/demo/audio/narration-gaming.mp3 +0 -0
- package/demo/audio/narration-hope-timing.json +3666 -0
- package/demo/audio/narration-hope.mp3 +0 -0
- package/demo/audio/narration-mark-timing.json +3666 -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 +1054 -544
- 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 +152 -0
- package/package.json +2 -2
- package/templates/api-dev-state.json +42 -7
- package/templates/research-index.json +6 -0
- package/templates/settings.json +23 -0
package/README.md
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
# API Development Tools for Claude Code
|
|
1
|
+
# API Development Tools for Claude Code v3.0
|
|
2
2
|
|
|
3
|
-
**Interview-driven, research-first API development workflow**
|
|
3
|
+
**Interview-driven, research-first API development workflow with continuous verification loops**
|
|
4
4
|
|
|
5
|
-
Automates the complete API development lifecycle from understanding requirements to deployment through structured interviews,
|
|
5
|
+
Automates the complete API development lifecycle from understanding requirements to deployment through structured interviews, adaptive research, test-driven development, and comprehensive documentation with automatic re-grounding.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## What's New in v3.0
|
|
8
|
+
|
|
9
|
+
- **Phase 0: Pre-Research Disambiguation** - Search variations to clarify ambiguous terms
|
|
10
|
+
- **Phase 9: Verify** - Re-research after tests pass to catch memory-based errors
|
|
11
|
+
- **Adaptive Research** - Propose searches based on interview answers, not shotgun approach
|
|
12
|
+
- **Questions FROM Research** - Interview questions generated from discovered parameters
|
|
13
|
+
- **7-Turn Re-grounding** - Periodic context injection prevents memory dilution
|
|
14
|
+
- **Research Freshness** - 7-day cache with automatic staleness warnings
|
|
15
|
+
- **Loop-Back Architecture** - Every verification loops back if not successful
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
8
18
|
|
|
9
19
|
```bash
|
|
10
20
|
# Install in your project
|
|
@@ -14,574 +24,369 @@ npx @hustle-together/api-dev-tools --scope=project
|
|
|
14
24
|
/api-create my-endpoint
|
|
15
25
|
```
|
|
16
26
|
|
|
17
|
-
##
|
|
27
|
+
## What This Installs
|
|
18
28
|
|
|
19
29
|
### Slash Commands
|
|
20
|
-
Five powerful slash commands for Claude Code:
|
|
21
30
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- **`/api-
|
|
31
|
+
Six powerful slash commands for Claude Code:
|
|
32
|
+
|
|
33
|
+
- **`/api-create [endpoint]`** - Complete workflow (Disambiguate → Research → Interview → TDD → Verify → Docs)
|
|
34
|
+
- **`/api-interview [endpoint]`** - Dynamic questions GENERATED from research findings
|
|
35
|
+
- **`/api-research [library]`** - Adaptive propose-approve research flow
|
|
36
|
+
- **`/api-verify [endpoint]`** - Re-research and compare implementation to docs
|
|
25
37
|
- **`/api-env [endpoint]`** - Check required API keys and environment setup
|
|
26
38
|
- **`/api-status [endpoint]`** - Track implementation progress and phase completion
|
|
27
39
|
|
|
28
|
-
### Enforcement Hooks
|
|
29
|
-
Six Python hooks that provide **real programmatic guarantees**:
|
|
30
|
-
|
|
31
|
-
- **`enforce-external-research.py`** - (v1.7.0) Detects external API questions and requires research before answering
|
|
32
|
-
- **`enforce-research.py`** - Blocks API code writing until research is complete
|
|
33
|
-
- **`enforce-interview.py`** - (v1.8.0+) Verifies structured questions with options were asked; (v1.9.0+) Injects decision reminders on writes
|
|
34
|
-
- **`verify-implementation.py`** - Checks implementation matches interview requirements
|
|
35
|
-
- **`track-tool-use.py`** - (v1.9.0+) Captures user decisions from AskUserQuestion; logs all research activity
|
|
36
|
-
- **`api-workflow-check.py`** - Prevents stopping until required phases are complete + git diff verification
|
|
37
|
-
|
|
38
|
-
### State Tracking
|
|
39
|
-
- **`.claude/api-dev-state.json`** - Persistent state file tracking all workflow progress
|
|
40
|
-
|
|
41
|
-
### MCP Servers (Auto-installed via `claude mcp add`)
|
|
42
|
-
- **Context7** - Fetches LIVE documentation from library source code (not training data)
|
|
43
|
-
- **GitHub** - Read/create issues, pull requests, and access repository data (requires `GITHUB_PERSONAL_ACCESS_TOKEN`)
|
|
44
|
-
|
|
45
|
-
## 🎯 Why Use This?
|
|
46
|
-
|
|
47
|
-
### Problems This Solves
|
|
40
|
+
### Enforcement Hooks (8 total)
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
- ❌ **Incomplete API research** → Missing optional parameters and edge cases
|
|
51
|
-
- ❌ **Runtime errors from missing API keys** → Tests fail due to configuration issues
|
|
52
|
-
- ❌ **No documentation of real usage** → Future developers don't understand context
|
|
53
|
-
- ❌ **Inconsistent implementation patterns** → Every endpoint looks different
|
|
42
|
+
Python hooks that provide **real programmatic guarantees**:
|
|
54
43
|
|
|
55
|
-
|
|
44
|
+
| Hook | Event | Purpose |
|
|
45
|
+
|------|-------|---------|
|
|
46
|
+
| `session-startup.py` | SessionStart | Inject current state at session start |
|
|
47
|
+
| `enforce-external-research.py` | UserPromptSubmit | Detect API terms, require research |
|
|
48
|
+
| `enforce-research.py` | PreToolUse | Block writes until research complete |
|
|
49
|
+
| `enforce-interview.py` | PreToolUse | Inject interview decisions on writes |
|
|
50
|
+
| `verify-implementation.py` | PreToolUse | Check test file exists before route |
|
|
51
|
+
| `track-tool-use.py` | PostToolUse | Log research, count turns |
|
|
52
|
+
| `periodic-reground.py` | PostToolUse | Re-inject context every 7 turns |
|
|
53
|
+
| `verify-after-green.py` | PostToolUse | Trigger Phase 9 after tests pass |
|
|
54
|
+
| `api-workflow-check.py` | Stop | Block completion if phases incomplete |
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
- ✅ **Comprehensive research** → Discover ALL parameters, not just documented ones
|
|
59
|
-
- ✅ **Environment validation** → Verify API keys before starting
|
|
60
|
-
- ✅ **TDD enforced** → Red → Green → Refactor cycle mandatory
|
|
61
|
-
- ✅ **Auto-documentation** → Updates manifests, OpenAPI specs, status tracking
|
|
62
|
-
- ✅ **Consistent workflow** → Repeatable, testable, maintainable
|
|
56
|
+
### State Tracking
|
|
63
57
|
|
|
64
|
-
|
|
58
|
+
- **`.claude/api-dev-state.json`** - Persistent workflow state with turn counting
|
|
59
|
+
- **`.claude/research/`** - Cached research with freshness tracking
|
|
60
|
+
- **`.claude/research/index.json`** - Research catalog with 7-day validity
|
|
65
61
|
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
/api-create generate-pdf
|
|
69
|
-
```
|
|
62
|
+
## Complete Phase Flow (12 Phases)
|
|
70
63
|
|
|
71
|
-
This single command:
|
|
72
|
-
1. **Interviews you** about the endpoint (20 structured questions)
|
|
73
|
-
2. **Researches** required libraries and external APIs
|
|
74
|
-
3. **Checks environment** for API keys and configuration
|
|
75
|
-
4. **Writes failing tests** first (TDD Red phase)
|
|
76
|
-
5. **Implements** minimal solution (TDD Green phase)
|
|
77
|
-
6. **Refactors** for quality (TDD Refactor phase)
|
|
78
|
-
7. **Updates documentation** (manifests, OpenAPI, examples)
|
|
79
|
-
8. **Creates commit** with semantic message
|
|
80
|
-
|
|
81
|
-
### Manual Step-by-Step
|
|
82
|
-
```bash
|
|
83
|
-
/api-interview generate-pdf # Understand purpose & requirements
|
|
84
|
-
/api-research pdf-lib # Research PDF library thoroughly
|
|
85
|
-
/api-env generate-pdf # Verify environment & API keys
|
|
86
|
-
/red # Write ONE failing test
|
|
87
|
-
/green # Implement to make it pass
|
|
88
|
-
/refactor # Clean up the code
|
|
89
|
-
/api-status generate-pdf # Update progress tracking
|
|
90
|
-
/commit # Create semantic commit
|
|
91
64
|
```
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
65
|
+
┌─ PHASE 0: DISAMBIGUATION ─────────────────────┐
|
|
66
|
+
│ Search 3-5 variations, clarify ambiguity │
|
|
67
|
+
│ Loop back if still unclear │
|
|
68
|
+
└───────────────────────────────────────────────┘
|
|
69
|
+
│
|
|
70
|
+
▼
|
|
71
|
+
┌─ PHASE 1: SCOPE CONFIRMATION ─────────────────┐
|
|
72
|
+
│ Confirm understanding of endpoint purpose │
|
|
73
|
+
└───────────────────────────────────────────────┘
|
|
74
|
+
│
|
|
75
|
+
▼
|
|
76
|
+
┌─ PHASE 2: INITIAL RESEARCH ───────────────────┐
|
|
77
|
+
│ 2-3 targeted searches (Context7, WebSearch) │
|
|
78
|
+
│ Present summary, ask to proceed or search more│
|
|
79
|
+
│ Loop back if user wants more │
|
|
80
|
+
└───────────────────────────────────────────────┘
|
|
81
|
+
│
|
|
82
|
+
▼
|
|
83
|
+
┌─ PHASE 3: INTERVIEW ──────────────────────────┐
|
|
84
|
+
│ Questions GENERATED from research findings │
|
|
85
|
+
│ - Enum params → multi-select │
|
|
86
|
+
│ - Continuous ranges → test strategy │
|
|
87
|
+
│ - Boolean params → enable/disable │
|
|
88
|
+
└───────────────────────────────────────────────┘
|
|
89
|
+
│
|
|
90
|
+
▼
|
|
91
|
+
┌─ PHASE 4: DEEP RESEARCH (Adaptive) ───────────┐
|
|
92
|
+
│ PROPOSE searches based on interview answers │
|
|
93
|
+
│ User approves/modifies/skips │
|
|
94
|
+
│ Not shotgun - targeted to selections │
|
|
95
|
+
└───────────────────────────────────────────────┘
|
|
96
|
+
│
|
|
97
|
+
▼
|
|
98
|
+
┌─ PHASE 5: SCHEMA DESIGN ──────────────────────┐
|
|
99
|
+
│ Create Zod schema from research + interview │
|
|
100
|
+
│ Loop back if schema wrong │
|
|
101
|
+
└───────────────────────────────────────────────┘
|
|
102
|
+
│
|
|
103
|
+
▼
|
|
104
|
+
┌─ PHASE 6: ENVIRONMENT CHECK ──────────────────┐
|
|
105
|
+
│ Verify API keys exist │
|
|
106
|
+
│ Loop back if keys missing │
|
|
107
|
+
└───────────────────────────────────────────────┘
|
|
108
|
+
│
|
|
109
|
+
▼
|
|
110
|
+
┌─ PHASE 7: TDD RED ────────────────────────────┐
|
|
111
|
+
│ Write failing tests from schema + decisions │
|
|
112
|
+
│ Test matrix derived from interview │
|
|
113
|
+
└───────────────────────────────────────────────┘
|
|
114
|
+
│
|
|
115
|
+
▼
|
|
116
|
+
┌─ PHASE 8: TDD GREEN ──────────────────────────┐
|
|
117
|
+
│ Minimal implementation to pass tests │
|
|
118
|
+
└───────────────────────────────────────────────┘
|
|
119
|
+
│
|
|
120
|
+
▼
|
|
121
|
+
┌─ PHASE 9: VERIFY (NEW) ───────────────────────┐
|
|
122
|
+
│ Re-read original documentation │
|
|
123
|
+
│ Compare implementation to docs feature-by- │
|
|
124
|
+
│ feature. Find gaps. │
|
|
125
|
+
│ │
|
|
126
|
+
│ Fix gaps? → Loop back to Phase 7 │
|
|
127
|
+
│ Skip (intentional)? → Document as omissions │
|
|
128
|
+
└───────────────────────────────────────────────┘
|
|
129
|
+
│
|
|
130
|
+
▼
|
|
131
|
+
┌─ PHASE 10: TDD REFACTOR ──────────────────────┐
|
|
132
|
+
│ Clean up code, tests still pass │
|
|
133
|
+
└───────────────────────────────────────────────┘
|
|
134
|
+
│
|
|
135
|
+
▼
|
|
136
|
+
┌─ PHASE 11: DOCUMENTATION ─────────────────────┐
|
|
137
|
+
│ Update manifests, OpenAPI, cache research │
|
|
138
|
+
└───────────────────────────────────────────────┘
|
|
139
|
+
│
|
|
140
|
+
▼
|
|
141
|
+
┌─ PHASE 12: COMPLETION ────────────────────────┐
|
|
142
|
+
│ All phases verified, commit │
|
|
143
|
+
└───────────────────────────────────────────────┘
|
|
99
144
|
```
|
|
100
145
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
Add to your project's `package.json`:
|
|
104
|
-
```json
|
|
105
|
-
{
|
|
106
|
-
"scripts": {
|
|
107
|
-
"postinstall": "npx @hustle-together/api-dev-tools --scope=project"
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
```
|
|
146
|
+
## Key Features
|
|
111
147
|
|
|
112
|
-
|
|
148
|
+
### Adaptive Research (Not Shotgun)
|
|
113
149
|
|
|
114
|
-
|
|
150
|
+
**OLD:** Run 20 searches blindly
|
|
115
151
|
|
|
116
|
-
|
|
152
|
+
**NEW:**
|
|
153
|
+
1. Run 2-3 initial searches
|
|
154
|
+
2. Present summary
|
|
155
|
+
3. PROPOSE additional searches based on context
|
|
156
|
+
4. User approves/modifies
|
|
157
|
+
5. Execute only approved searches
|
|
117
158
|
|
|
118
|
-
|
|
159
|
+
### Questions FROM Research
|
|
119
160
|
|
|
120
|
-
**
|
|
121
|
-
```bash
|
|
122
|
-
/api-create user-preferences
|
|
161
|
+
**OLD:** Generic template questions
|
|
123
162
|
```
|
|
124
|
-
|
|
125
|
-
**What it does:**
|
|
126
|
-
- Interviews you about requirements
|
|
127
|
-
- Researches dependencies (Next.js API routes, Zod, etc.)
|
|
128
|
-
- Checks environment (Supabase keys, etc.)
|
|
129
|
-
- Writes comprehensive tests
|
|
130
|
-
- Implements with Zod validation
|
|
131
|
-
- Updates all documentation
|
|
132
|
-
- Creates commit
|
|
133
|
-
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
### `/api-interview [endpoint-name]`
|
|
137
|
-
|
|
138
|
-
**Structured discovery.** 20-question interview based on Anthropic Interviewer methodology.
|
|
139
|
-
|
|
140
|
-
**Example:**
|
|
141
|
-
```bash
|
|
142
|
-
/api-interview send-email
|
|
163
|
+
"Which AI provider should this endpoint support?"
|
|
143
164
|
```
|
|
144
165
|
|
|
145
|
-
**Questions
|
|
146
|
-
- Purpose & context
|
|
147
|
-
- Real-world usage scenarios
|
|
148
|
-
- Required vs. optional parameters
|
|
149
|
-
- Dependencies & API keys
|
|
150
|
-
- Error handling & edge cases
|
|
151
|
-
- Documentation sources
|
|
152
|
-
|
|
153
|
-
**Output:** `/src/v2/docs/endpoints/[endpoint-name].md`
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
### `/api-research [library-or-service]`
|
|
158
|
-
|
|
159
|
-
**Deep dive.** Discovers ALL parameters by reading source code and documentation.
|
|
160
|
-
|
|
161
|
-
**Example:**
|
|
162
|
-
```bash
|
|
163
|
-
/api-research resend-api
|
|
166
|
+
**NEW:** Questions generated from discovered parameters
|
|
164
167
|
```
|
|
168
|
+
Based on research, Brandfetch API has 7 parameters:
|
|
165
169
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
- Complete request/response schemas
|
|
169
|
-
- Undocumented parameters (from source code)
|
|
170
|
-
- TypeScript type definitions
|
|
171
|
-
- Rate limits, quotas, costs
|
|
172
|
-
- Integration patterns
|
|
173
|
-
- Code examples
|
|
174
|
-
|
|
175
|
-
**Output:** `/src/v2/docs/research/[library-name].md`
|
|
170
|
+
1. DOMAIN (required) - string
|
|
171
|
+
→ No question needed
|
|
176
172
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
### `/api-env [endpoint-name]`
|
|
173
|
+
2. FORMAT: ["json", "svg", "png", "raw"]
|
|
174
|
+
Q: Which formats do you need?
|
|
180
175
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
/api-env send-email
|
|
176
|
+
3. QUALITY: 1-100 (continuous range)
|
|
177
|
+
Q: How should we TEST this?
|
|
178
|
+
[ ] All values (100 tests)
|
|
179
|
+
[x] Boundary (1, 50, 100)
|
|
186
180
|
```
|
|
187
181
|
|
|
188
|
-
|
|
189
|
-
- Required API keys exist in `.env.local`
|
|
190
|
-
- Templates in `.env.example`
|
|
191
|
-
- `.gitignore` protects secrets
|
|
192
|
-
- Service connectivity (optional)
|
|
193
|
-
|
|
194
|
-
**Output:** Terminal report + action items
|
|
195
|
-
|
|
196
|
-
---
|
|
197
|
-
|
|
198
|
-
### `/api-status [endpoint-name]`
|
|
182
|
+
### Phase 9: Verify (Catches Memory Errors)
|
|
199
183
|
|
|
200
|
-
|
|
184
|
+
After tests pass, automatically:
|
|
185
|
+
1. Re-read original documentation
|
|
186
|
+
2. Compare feature-by-feature
|
|
187
|
+
3. Report discrepancies:
|
|
201
188
|
|
|
202
|
-
**Examples:**
|
|
203
|
-
```bash
|
|
204
|
-
/api-status send-email # Specific endpoint
|
|
205
|
-
/api-status --all # All endpoints
|
|
206
189
|
```
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
**Output:** Progress report + status document updates
|
|
217
|
-
|
|
218
|
-
## 🔄 Workflow Integration
|
|
219
|
-
|
|
220
|
-
Works seamlessly with existing Claude Code commands:
|
|
221
|
-
|
|
222
|
-
```bash
|
|
223
|
-
/plan # Create implementation checklist
|
|
224
|
-
/gap # Find missing pieces
|
|
225
|
-
/issue [url] # Start from GitHub issue
|
|
226
|
-
|
|
227
|
-
/api-create # ← Run complete API workflow
|
|
228
|
-
|
|
229
|
-
/commit # Semantic commit message
|
|
230
|
-
/pr # Create pull request
|
|
190
|
+
│ Feature │ In Docs │ Implemented │ Status │
|
|
191
|
+
├───────────────┼─────────┼─────────────┼─────────────│
|
|
192
|
+
│ domain param │ ✓ │ ✓ │ ✅ Match │
|
|
193
|
+
│ format opts │ 4 │ 3 │ ⚠️ Missing │
|
|
194
|
+
│ webhook │ ✓ │ ✗ │ ℹ️ Optional │
|
|
195
|
+
|
|
196
|
+
Fix gaps? [Y] → Return to Phase 7
|
|
197
|
+
Skip? [n] → Document as omissions
|
|
231
198
|
```
|
|
232
199
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
Based on proven approaches:
|
|
236
|
-
|
|
237
|
-
- **[Anthropic Interviewer](https://www.anthropic.com/news/anthropic-interviewer)** - Structured interview methodology
|
|
238
|
-
- **TDD (Test-Driven Development)** - Red → Green → Refactor cycle
|
|
239
|
-
- **[@wbern/claude-instructions](https://github.com/wbern/claude-instructions)** - Slash command pattern
|
|
240
|
-
- **V2 Development Patterns** - Zod schemas, consistent structure
|
|
200
|
+
### 7-Turn Re-grounding
|
|
241
201
|
|
|
242
|
-
|
|
202
|
+
Prevents context dilution in long sessions:
|
|
203
|
+
- Every 7 turns, hook injects state summary
|
|
204
|
+
- Current phase, decisions, research cache location
|
|
205
|
+
- Ensures Claude stays aware of workflow
|
|
243
206
|
|
|
244
|
-
|
|
207
|
+
### Research Freshness
|
|
245
208
|
|
|
209
|
+
Research is cached with 7-day validity:
|
|
246
210
|
```
|
|
247
|
-
|
|
248
|
-
├──
|
|
249
|
-
├──
|
|
250
|
-
│ └──
|
|
251
|
-
└──
|
|
252
|
-
|
|
253
|
-
src/v2/docs/
|
|
254
|
-
├── endpoints/
|
|
255
|
-
│ └── [endpoint].md # Interview results & requirements
|
|
256
|
-
└── research/
|
|
257
|
-
└── [library].md # External API research findings
|
|
258
|
-
|
|
259
|
-
Updated files:
|
|
260
|
-
- src/app/api-test/api-tests-manifest.json # Test documentation
|
|
261
|
-
- src/lib/openapi/endpoints/[endpoint].ts # OpenAPI spec
|
|
262
|
-
- src/v2/docs/v2-api-implementation-status.md # Progress tracking
|
|
211
|
+
.claude/research/
|
|
212
|
+
├── brandfetch/
|
|
213
|
+
│ ├── 2025-12-08_initial.md
|
|
214
|
+
│ └── CURRENT.md
|
|
215
|
+
└── index.json ← Tracks freshness
|
|
263
216
|
```
|
|
264
217
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
This tool expects:
|
|
268
|
-
- **Next.js** API routes (`src/app/api/`)
|
|
269
|
-
- **Vitest** for testing
|
|
270
|
-
- **Zod** for validation
|
|
271
|
-
- **TypeScript** strict mode
|
|
272
|
-
|
|
273
|
-
Not tied to specific AI providers - works with any API architecture.
|
|
274
|
-
|
|
275
|
-
## 🔑 Key Principles
|
|
276
|
-
|
|
277
|
-
1. **Context First** - Understand WHY before HOW
|
|
278
|
-
2. **Research Thoroughly** - Find ALL parameters, not just documented
|
|
279
|
-
3. **Test First** - No implementation without failing test
|
|
280
|
-
4. **Document Everything** - Future you needs to understand this
|
|
281
|
-
5. **Verify Environment** - Check API keys before starting
|
|
282
|
-
6. **Consistent Process** - Same workflow every time
|
|
283
|
-
|
|
284
|
-
## 🆚 Comparison
|
|
285
|
-
|
|
286
|
-
### Without API Dev Tools
|
|
218
|
+
If research is >7 days old:
|
|
287
219
|
```
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
3. Discover missing API keys mid-development
|
|
291
|
-
4. Write tests after implementation (if at all)
|
|
292
|
-
5. Forget to update documentation
|
|
293
|
-
6. Inconsistent patterns across endpoints
|
|
294
|
-
7. No progress tracking
|
|
295
|
-
|
|
296
|
-
Result: Brittle APIs, poor docs, hard to maintain
|
|
220
|
+
⚠️ Research for "brandfetch" is 15 days old.
|
|
221
|
+
Re-research before using? [Y/n]
|
|
297
222
|
```
|
|
298
223
|
|
|
299
|
-
|
|
300
|
-
```
|
|
301
|
-
1. Interview to understand requirements
|
|
302
|
-
2. Research to find ALL parameters
|
|
303
|
-
3. Verify environment before coding
|
|
304
|
-
4. Write failing tests first (TDD)
|
|
305
|
-
5. Implement with minimal code
|
|
306
|
-
6. Auto-update all documentation
|
|
307
|
-
7. Track progress throughout
|
|
308
|
-
|
|
309
|
-
Result: Robust APIs, comprehensive docs, easy to maintain
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
## 🔒 Programmatic Enforcement (Hooks)
|
|
313
|
-
|
|
314
|
-
Unlike pure markdown instructions that rely on Claude following directions, this package includes **real Python hooks** that enforce workflow compliance.
|
|
315
|
-
|
|
316
|
-
### How Hooks Work
|
|
317
|
-
|
|
318
|
-
```
|
|
319
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
320
|
-
│ USER: "Add Vercel AI SDK" │
|
|
321
|
-
│ ↓ │
|
|
322
|
-
│ CLAUDE: Calls WebSearch for docs │
|
|
323
|
-
│ ↓ │
|
|
324
|
-
│ HOOK: PostToolUse (track-tool-use.py) │
|
|
325
|
-
│ → Logs search to api-dev-state.json │
|
|
326
|
-
│ ↓ │
|
|
327
|
-
│ CLAUDE: Tries to Write route.ts │
|
|
328
|
-
│ ↓ │
|
|
329
|
-
│ HOOK: PreToolUse (enforce-research.py) │
|
|
330
|
-
│ → Checks: Has research been completed? │
|
|
331
|
-
│ → If NO: BLOCKED with error message │
|
|
332
|
-
│ → If YES: Allowed to proceed │
|
|
333
|
-
│ ↓ │
|
|
334
|
-
│ CLAUDE: Tries to stop conversation │
|
|
335
|
-
│ ↓ │
|
|
336
|
-
│ HOOK: Stop (api-workflow-check.py) │
|
|
337
|
-
│ → Checks: Are all required phases complete? │
|
|
338
|
-
│ → If NO: BLOCKED with list of incomplete phases │
|
|
339
|
-
│ → If YES: Allowed to stop │
|
|
340
|
-
└─────────────────────────────────────────────────────────────┘
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
### What Gets Enforced
|
|
344
|
-
|
|
345
|
-
| Action | Hook | Enforcement |
|
|
346
|
-
|--------|------|-------------|
|
|
347
|
-
| Claude calls WebSearch/WebFetch/Context7 | `track-tool-use.py` | Logged to state file |
|
|
348
|
-
| Claude tries to write API code | `enforce-research.py` | **BLOCKED** if no research logged |
|
|
349
|
-
| Claude tries to stop | `api-workflow-check.py` | **BLOCKED** if phases incomplete |
|
|
350
|
-
|
|
351
|
-
### Check Progress Anytime
|
|
224
|
+
## Installation
|
|
352
225
|
|
|
353
226
|
```bash
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
# Or use the status command
|
|
358
|
-
/api-status
|
|
227
|
+
cd your-project
|
|
228
|
+
npx @hustle-together/api-dev-tools --scope=project
|
|
359
229
|
```
|
|
360
230
|
|
|
361
|
-
###
|
|
362
|
-
|
|
363
|
-
The `.claude/api-dev-state.json` file tracks:
|
|
231
|
+
### Team-Wide Auto-Installation
|
|
364
232
|
|
|
233
|
+
Add to `package.json`:
|
|
365
234
|
```json
|
|
366
235
|
{
|
|
367
|
-
"
|
|
368
|
-
|
|
369
|
-
"phases": {
|
|
370
|
-
"scope": { "status": "complete" },
|
|
371
|
-
"research_initial": {
|
|
372
|
-
"status": "complete",
|
|
373
|
-
"sources": [
|
|
374
|
-
{ "type": "context7", "tool": "resolve_library_id" },
|
|
375
|
-
{ "type": "websearch", "query": "Vercel AI SDK docs" },
|
|
376
|
-
{ "type": "webfetch", "url": "https://sdk.vercel.ai" }
|
|
377
|
-
]
|
|
378
|
-
},
|
|
379
|
-
"interview": { "status": "complete" },
|
|
380
|
-
"research_deep": { "status": "complete" },
|
|
381
|
-
"schema_creation": { "status": "in_progress" },
|
|
382
|
-
"tdd_red": { "status": "pending" },
|
|
383
|
-
"tdd_green": { "status": "pending" },
|
|
384
|
-
"tdd_refactor": { "status": "pending" },
|
|
385
|
-
"documentation": { "status": "pending" }
|
|
386
|
-
},
|
|
387
|
-
"verification": {
|
|
388
|
-
"all_sources_fetched": true,
|
|
389
|
-
"schema_matches_docs": false,
|
|
390
|
-
"tests_cover_params": false,
|
|
391
|
-
"all_tests_passing": false
|
|
236
|
+
"scripts": {
|
|
237
|
+
"postinstall": "npx @hustle-together/api-dev-tools --scope=project"
|
|
392
238
|
}
|
|
393
239
|
}
|
|
394
240
|
```
|
|
395
241
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
**Without hooks (pure markdown instructions):**
|
|
399
|
-
- Claude *might* skip research if confident
|
|
400
|
-
- Claude *might* use outdated training data
|
|
401
|
-
- No way to verify steps were actually completed
|
|
402
|
-
|
|
403
|
-
**With hooks (programmatic enforcement):**
|
|
404
|
-
- Research is **required** - can't write code without it
|
|
405
|
-
- All research activity is **logged** - auditable trail
|
|
406
|
-
- Workflow completion is **verified** - can't stop early
|
|
407
|
-
|
|
408
|
-
## 🔍 Gap Detection & Verification (v1.6.0+)
|
|
409
|
-
|
|
410
|
-
The workflow now includes automatic detection of common implementation gaps:
|
|
242
|
+
## Command Reference
|
|
411
243
|
|
|
412
|
-
###
|
|
413
|
-
**Problem:** AI paraphrases user terminology instead of using exact terms for research.
|
|
414
|
-
|
|
415
|
-
**Example:**
|
|
416
|
-
- User says: "Use Vercel AI Gateway"
|
|
417
|
-
- AI searches for: "Vercel AI SDK" (wrong!)
|
|
418
|
-
|
|
419
|
-
**Fix:** `verify-implementation.py` extracts key terms from interview answers and warns if those exact terms weren't used in research queries.
|
|
244
|
+
### `/api-create [endpoint-name]`
|
|
420
245
|
|
|
421
|
-
|
|
422
|
-
**Problem:** AI claims "all files updated" but doesn't verify which files actually changed.
|
|
246
|
+
Complete 12-phase workflow. See [commands/api-create.md](commands/api-create.md).
|
|
423
247
|
|
|
424
|
-
|
|
248
|
+
### `/api-interview [endpoint-name]`
|
|
425
249
|
|
|
426
|
-
|
|
427
|
-
**Problem:** AI accepts "9 tests skipped" without investigating why.
|
|
250
|
+
Dynamic interview with questions FROM research. See [commands/api-interview.md](commands/api-interview.md).
|
|
428
251
|
|
|
429
|
-
|
|
252
|
+
### `/api-research [library-name]`
|
|
430
253
|
|
|
431
|
-
|
|
432
|
-
**Problem:** AI marks task complete without verifying implementation matches interview.
|
|
254
|
+
Adaptive propose-approve research. See [commands/api-research.md](commands/api-research.md).
|
|
433
255
|
|
|
434
|
-
|
|
435
|
-
- Route files exist if endpoints mentioned
|
|
436
|
-
- Test files are tracked
|
|
437
|
-
- Key terms from interview appear in implementation
|
|
256
|
+
### `/api-verify [endpoint-name]`
|
|
438
257
|
|
|
439
|
-
|
|
440
|
-
**Problem:** Test files check different environment variables than production code.
|
|
258
|
+
Manual Phase 9 verification. See [commands/api-verify.md](commands/api-verify.md).
|
|
441
259
|
|
|
442
|
-
|
|
443
|
-
- Interview: "single gateway key"
|
|
444
|
-
- Production: uses `AI_GATEWAY_API_KEY`
|
|
445
|
-
- Test: still checks `OPENAI_API_KEY` (wrong!)
|
|
260
|
+
### `/api-env [endpoint-name]`
|
|
446
261
|
|
|
447
|
-
|
|
262
|
+
Environment and API key check. See [commands/api-env.md](commands/api-env.md).
|
|
448
263
|
|
|
449
|
-
###
|
|
450
|
-
**Problem:** AI answers questions about external APIs from potentially outdated training data instead of researching first.
|
|
264
|
+
### `/api-status [endpoint-name]`
|
|
451
265
|
|
|
452
|
-
|
|
453
|
-
- User asks: "What providers does Vercel AI Gateway support?"
|
|
454
|
-
- AI answers from memory: "Groq not in gateway" (WRONG!)
|
|
455
|
-
- Reality: Groq has 4 models in the gateway (Llama variants)
|
|
266
|
+
Progress tracking. See [commands/api-status.md](commands/api-status.md).
|
|
456
267
|
|
|
457
|
-
|
|
458
|
-
1. Detects questions about external APIs/SDKs using pattern matching
|
|
459
|
-
2. Injects context requiring research before answering
|
|
460
|
-
3. Works for ANY API (Brandfetch, Stripe, Twilio, etc.) - not just specific ones
|
|
461
|
-
4. Auto-allows WebSearch and Context7 without permission prompts
|
|
268
|
+
## State File Structure (v3.0)
|
|
462
269
|
|
|
270
|
+
```json
|
|
271
|
+
{
|
|
272
|
+
"version": "3.0.0",
|
|
273
|
+
"endpoint": "brandfetch",
|
|
274
|
+
"turn_count": 23,
|
|
275
|
+
"phases": {
|
|
276
|
+
"disambiguation": { "status": "complete" },
|
|
277
|
+
"scope": { "status": "complete" },
|
|
278
|
+
"research_initial": { "status": "complete", "sources": [...] },
|
|
279
|
+
"interview": {
|
|
280
|
+
"status": "complete",
|
|
281
|
+
"decisions": {
|
|
282
|
+
"format": ["json", "svg", "png"],
|
|
283
|
+
"quality_testing": "boundary"
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
"research_deep": {
|
|
287
|
+
"status": "complete",
|
|
288
|
+
"proposed_searches": [...],
|
|
289
|
+
"approved_searches": [...],
|
|
290
|
+
"skipped_searches": [...]
|
|
291
|
+
},
|
|
292
|
+
"schema_creation": { "status": "complete" },
|
|
293
|
+
"environment_check": { "status": "complete" },
|
|
294
|
+
"tdd_red": { "status": "complete", "test_count": 23 },
|
|
295
|
+
"tdd_green": { "status": "complete" },
|
|
296
|
+
"verify": {
|
|
297
|
+
"status": "complete",
|
|
298
|
+
"gaps_found": 2,
|
|
299
|
+
"gaps_fixed": 2,
|
|
300
|
+
"intentional_omissions": ["webhook support"]
|
|
301
|
+
},
|
|
302
|
+
"tdd_refactor": { "status": "complete" },
|
|
303
|
+
"documentation": { "status": "complete" }
|
|
304
|
+
},
|
|
305
|
+
"reground_history": [
|
|
306
|
+
{ "turn": 7, "phase": "interview" },
|
|
307
|
+
{ "turn": 14, "phase": "tdd_red" }
|
|
308
|
+
]
|
|
309
|
+
}
|
|
463
310
|
```
|
|
464
|
-
USER: "What providers does Brandfetch API support?"
|
|
465
|
-
↓
|
|
466
|
-
HOOK: Detects "Brandfetch", "API", "providers"
|
|
467
|
-
↓
|
|
468
|
-
INJECTS: "RESEARCH REQUIRED: Use Context7/WebSearch before answering"
|
|
469
|
-
↓
|
|
470
|
-
CLAUDE: Researches first → Gives accurate answer
|
|
471
|
-
```
|
|
472
|
-
|
|
473
|
-
### Gap 7: Interview Decisions Not Used During Implementation (v1.9.0+)
|
|
474
|
-
**Problem:** AI asks good interview questions but then ignores the answers when writing code.
|
|
475
|
-
|
|
476
|
-
**Example:**
|
|
477
|
-
- Interview: User selected "server environment variables only" for API key handling
|
|
478
|
-
- Implementation: AI writes code with custom header overrides (not what user wanted!)
|
|
479
311
|
|
|
480
|
-
|
|
312
|
+
## Hook Architecture
|
|
481
313
|
|
|
482
|
-
1. **track-tool-use.py** now captures:
|
|
483
|
-
- The user's actual response from AskUserQuestion
|
|
484
|
-
- Matches responses to option values
|
|
485
|
-
- Stores decisions in categorized `decisions` dict (purpose, api_key_handling, etc.)
|
|
486
|
-
|
|
487
|
-
2. **enforce-interview.py** now injects a decision summary on EVERY write:
|
|
488
314
|
```
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
315
|
+
┌──────────────────────────────────────────────────────────┐
|
|
316
|
+
│ SESSION START │
|
|
317
|
+
│ → session-startup.py injects current state │
|
|
318
|
+
└──────────────────────────────────────────────────────────┘
|
|
319
|
+
│
|
|
320
|
+
▼
|
|
321
|
+
┌──────────────────────────────────────────────────────────┐
|
|
322
|
+
│ USER PROMPT │
|
|
323
|
+
│ → enforce-external-research.py detects API terms │
|
|
324
|
+
└──────────────────────────────────────────────────────────┘
|
|
325
|
+
│
|
|
326
|
+
▼
|
|
327
|
+
┌──────────────────────────────────────────────────────────┐
|
|
328
|
+
│ RESEARCH TOOLS (WebSearch, Context7) │
|
|
329
|
+
│ → track-tool-use.py logs activity, counts turns │
|
|
330
|
+
│ → periodic-reground.py injects summary every 7 turns │
|
|
331
|
+
└──────────────────────────────────────────────────────────┘
|
|
332
|
+
│
|
|
333
|
+
▼
|
|
334
|
+
┌──────────────────────────────────────────────────────────┐
|
|
335
|
+
│ WRITE/EDIT TOOLS │
|
|
336
|
+
│ → enforce-research.py blocks if no research │
|
|
337
|
+
│ → enforce-interview.py injects decisions │
|
|
338
|
+
│ → verify-implementation.py checks test file exists │
|
|
339
|
+
└──────────────────────────────────────────────────────────┘
|
|
340
|
+
│
|
|
341
|
+
▼
|
|
342
|
+
┌──────────────────────────────────────────────────────────┐
|
|
343
|
+
│ TEST COMMANDS (pnpm test) │
|
|
344
|
+
│ → verify-after-green.py triggers Phase 9 after pass │
|
|
345
|
+
└──────────────────────────────────────────────────────────┘
|
|
346
|
+
│
|
|
347
|
+
▼
|
|
348
|
+
┌──────────────────────────────────────────────────────────┐
|
|
349
|
+
│ STOP │
|
|
350
|
+
│ → api-workflow-check.py blocks if phases incomplete │
|
|
351
|
+
└──────────────────────────────────────────────────────────┘
|
|
497
352
|
```
|
|
498
353
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
## 🔧 Requirements
|
|
354
|
+
## Requirements
|
|
502
355
|
|
|
503
356
|
- **Node.js** 14.0.0 or higher
|
|
504
357
|
- **Python 3** (for enforcement hooks)
|
|
505
358
|
- **Claude Code** (CLI tool for Claude)
|
|
506
359
|
- **Project structure** with `.claude/commands/` support
|
|
507
360
|
|
|
508
|
-
##
|
|
509
|
-
|
|
510
|
-
This package auto-configures two MCP servers:
|
|
361
|
+
## MCP Servers (Auto-installed)
|
|
511
362
|
|
|
512
363
|
### Context7
|
|
513
|
-
-
|
|
514
|
-
-
|
|
515
|
-
- **TypeScript type definitions** directly from packages
|
|
516
|
-
|
|
517
|
-
When you research a library like `@ai-sdk/core`, Context7 fetches the actual current documentation rather than relying on Claude's training data which may be outdated.
|
|
364
|
+
- Live documentation from library source code
|
|
365
|
+
- Current API parameters (not training data)
|
|
518
366
|
|
|
519
367
|
### GitHub
|
|
520
|
-
-
|
|
521
|
-
-
|
|
522
|
-
- **Repository access** - Browse repo contents and metadata
|
|
368
|
+
- Issue management
|
|
369
|
+
- Pull request creation
|
|
523
370
|
|
|
524
|
-
|
|
371
|
+
Set `GITHUB_PERSONAL_ACCESS_TOKEN` for GitHub MCP.
|
|
525
372
|
|
|
526
|
-
|
|
527
|
-
```bash
|
|
528
|
-
export GITHUB_PERSONAL_ACCESS_TOKEN=ghp_your_token_here
|
|
529
|
-
```
|
|
530
|
-
|
|
531
|
-
The installer runs `claude mcp add` commands directly, which registers the servers in your Claude Code config (`~/.claude.json`). Restart Claude Code after installation for MCP tools to be available.
|
|
532
|
-
|
|
533
|
-
## 📖 Documentation
|
|
534
|
-
|
|
535
|
-
After installation, see:
|
|
536
|
-
- `.claude/commands/README.md` - Complete command reference
|
|
537
|
-
- `.claude/commands/api-create.md` - Full workflow details
|
|
538
|
-
- `.claude/commands/api-interview.md` - Interview questions
|
|
539
|
-
- `.claude/commands/api-research.md` - Research methodology
|
|
373
|
+
## Acknowledgments
|
|
540
374
|
|
|
541
|
-
|
|
375
|
+
- **[@wbern/claude-instructions](https://github.com/wbern/claude-instructions)** - TDD commands
|
|
376
|
+
- **[Anthropic Interviewer](https://www.anthropic.com/news/anthropic-interviewer)** - Interview methodology
|
|
377
|
+
- **[Context7](https://context7.com)** - Live documentation lookup
|
|
542
378
|
|
|
543
|
-
|
|
379
|
+
## License
|
|
544
380
|
|
|
545
|
-
|
|
546
|
-
- Additional interview questions
|
|
547
|
-
- More research sources
|
|
548
|
-
- Integration with other tools
|
|
549
|
-
- Custom templates
|
|
550
|
-
- Multi-language support
|
|
381
|
+
MIT License
|
|
551
382
|
|
|
552
|
-
##
|
|
553
|
-
|
|
554
|
-
### @wbern/claude-instructions
|
|
555
|
-
The TDD workflow commands (`/red`, `/green`, `/refactor`, `/cycle`) are based on the excellent [@wbern/claude-instructions](https://github.com/wbern/claude-instructions) package by **William Bernmalm**. This project extends those patterns with interview-driven API development, research enforcement hooks, and comprehensive state tracking.
|
|
556
|
-
|
|
557
|
-
### Anthropic
|
|
558
|
-
The interview methodology is inspired by [Anthropic's Interviewer approach](https://www.anthropic.com/news/anthropic-interviewer) for structured discovery.
|
|
559
|
-
|
|
560
|
-
### Context7
|
|
561
|
-
Special thanks to the [Context7](https://context7.com) team for providing live documentation lookup that makes research-first development possible.
|
|
562
|
-
|
|
563
|
-
---
|
|
564
|
-
|
|
565
|
-
Thank you to the Claude Code community for making AI-assisted development more rigorous!
|
|
566
|
-
|
|
567
|
-
## 📄 License
|
|
568
|
-
|
|
569
|
-
MIT License - Use freely in your projects
|
|
570
|
-
|
|
571
|
-
## 🔗 Links
|
|
383
|
+
## Links
|
|
572
384
|
|
|
573
385
|
- **Repository:** https://github.com/hustle-together/api-dev-tools
|
|
574
|
-
- **Issues:** https://github.com/hustle-together/api-dev-tools/issues
|
|
575
386
|
- **NPM:** https://www.npmjs.com/package/@hustle-together/api-dev-tools
|
|
576
387
|
|
|
577
|
-
## 💬 Support
|
|
578
|
-
|
|
579
|
-
- Open an issue on GitHub
|
|
580
|
-
- Check command documentation in `.claude/commands/README.md`
|
|
581
|
-
- Review example workflows in the repository
|
|
582
|
-
|
|
583
388
|
---
|
|
584
389
|
|
|
585
|
-
**Made with
|
|
390
|
+
**Made with care for API developers using Claude Code**
|
|
586
391
|
|
|
587
|
-
*"
|
|
392
|
+
*"Disambiguate, research, interview, verify, repeat"*
|