@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/commands/api-create.md
CHANGED
|
@@ -1,149 +1,328 @@
|
|
|
1
|
-
# API Create - Comprehensive API Development Workflow
|
|
1
|
+
# API Create - Comprehensive API Development Workflow v3.0
|
|
2
2
|
|
|
3
3
|
**Usage:** `/api-create [endpoint-name]`
|
|
4
4
|
|
|
5
|
-
**Purpose:** Orchestrates the complete API development workflow using interview-driven, test-first methodology.
|
|
6
|
-
|
|
7
|
-
## Workflow Steps
|
|
8
|
-
|
|
9
|
-
This command executes the following phases automatically:
|
|
10
|
-
|
|
11
|
-
### Phase 1: Planning & Research
|
|
12
|
-
1. **Documentation Discovery**
|
|
13
|
-
- Search for official API documentation
|
|
14
|
-
- Track all documentation links
|
|
15
|
-
- Identify available SDKs and libraries
|
|
16
|
-
- Document version requirements
|
|
17
|
-
|
|
18
|
-
2. **User Interview** (Anthropic Interviewer methodology)
|
|
19
|
-
- What is this API endpoint for? (Purpose)
|
|
20
|
-
- Who will use it? (Users)
|
|
21
|
-
- When/where will it be used? (Context)
|
|
22
|
-
- What are common use cases? (Real-world scenarios)
|
|
23
|
-
- What are edge cases to handle? (Boundaries)
|
|
24
|
-
- What are dependencies? (External services, API keys)
|
|
25
|
-
|
|
26
|
-
### Phase 2: Documentation & Schema
|
|
27
|
-
3. **Schema Documentation**
|
|
28
|
-
- Document ALL request parameters (required + optional)
|
|
29
|
-
- Document ALL response fields
|
|
30
|
-
- Create Zod request schema
|
|
31
|
-
- Create Zod response schema
|
|
32
|
-
- Document validation rules
|
|
33
|
-
- Document error cases
|
|
34
|
-
|
|
35
|
-
4. **Environment Setup**
|
|
36
|
-
- Identify required API keys
|
|
37
|
-
- Check .env.example for keys
|
|
38
|
-
- Verify environment variables
|
|
39
|
-
- Document custom header support
|
|
40
|
-
- Create setup instructions
|
|
41
|
-
|
|
42
|
-
### Phase 3: TDD Implementation
|
|
43
|
-
5. **Red Phase** - Write failing tests
|
|
44
|
-
- Test basic success case
|
|
45
|
-
- Test all parameter combinations
|
|
46
|
-
- Test validation failures
|
|
47
|
-
- Test error handling
|
|
48
|
-
- Test edge cases from interview
|
|
49
|
-
- Run tests (should fail)
|
|
50
|
-
|
|
51
|
-
6. **Green Phase** - Minimal implementation
|
|
52
|
-
- Create route handler
|
|
53
|
-
- Implement Zod validation
|
|
54
|
-
- Add AI SDK integration
|
|
55
|
-
- Pass all tests
|
|
56
|
-
- Run tests (should pass)
|
|
57
|
-
|
|
58
|
-
7. **Refactor Phase** - Clean up
|
|
59
|
-
- Extract reusable patterns
|
|
60
|
-
- Improve error messages
|
|
61
|
-
- Add JSDoc comments
|
|
62
|
-
- Optimize performance
|
|
63
|
-
- Run tests (should still pass)
|
|
64
|
-
|
|
65
|
-
### Phase 4: Documentation & Integration
|
|
66
|
-
8. **Update Documentation**
|
|
67
|
-
- Add to `/src/app/api-test/api-tests-manifest.json`
|
|
68
|
-
- Update `/src/v2/docs/v2-api-implementation-status.md`
|
|
69
|
-
- Add OpenAPI spec to `/src/lib/openapi/`
|
|
70
|
-
- Include code examples
|
|
71
|
-
- Document real-world outputs
|
|
72
|
-
- Add testing notes
|
|
73
|
-
|
|
74
|
-
9. **Final Validation**
|
|
75
|
-
- Run full test suite
|
|
76
|
-
- Check test coverage (must be 100%)
|
|
77
|
-
- Verify TypeScript compilation
|
|
78
|
-
- Test in API test interface
|
|
79
|
-
- Create commit with `/commit`
|
|
80
|
-
|
|
81
|
-
## Template for Interview
|
|
82
|
-
|
|
83
|
-
When executing this command, conduct the following interview:
|
|
5
|
+
**Purpose:** Orchestrates the complete API development workflow using interview-driven, research-first, test-first methodology with continuous verification loops.
|
|
84
6
|
|
|
7
|
+
## Key Principles
|
|
8
|
+
|
|
9
|
+
1. **Loop Until Green** - Every verification phase loops back if not successful
|
|
10
|
+
2. **Continuous Interviews** - Checkpoints at EVERY phase transition
|
|
11
|
+
3. **Adaptive Research** - Propose searches based on context, not shotgun approach
|
|
12
|
+
4. **Self-Documenting** - State file captures everything for re-grounding
|
|
13
|
+
5. **Verify After Green** - Re-research docs to catch memory-based implementation errors
|
|
14
|
+
|
|
15
|
+
## Complete Phase Flow
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
/api-create [endpoint]
|
|
19
|
+
│
|
|
20
|
+
▼
|
|
21
|
+
┌─ PHASE 0: DISAMBIGUATION ─────────────────────────────────┐
|
|
22
|
+
│ Search 3-5 variations of the term: │
|
|
23
|
+
│ • "[term]" │
|
|
24
|
+
│ • "[term] API" │
|
|
25
|
+
│ • "[term] SDK" │
|
|
26
|
+
│ • "[term] npm package" │
|
|
27
|
+
│ │
|
|
28
|
+
│ If multiple interpretations found, ask: │
|
|
29
|
+
│ ┌───────────────────────────────────────────────────────┐ │
|
|
30
|
+
│ │ I found multiple things matching "[term]": │ │
|
|
31
|
+
│ │ │ │
|
|
32
|
+
│ │ [A] Option A - Description │ │
|
|
33
|
+
│ │ [B] Option B - Description │ │
|
|
34
|
+
│ │ [C] Both │ │
|
|
35
|
+
│ │ [D] Something else: ____ │ │
|
|
36
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
37
|
+
│ │
|
|
38
|
+
│ ──── Loop back if ambiguous ──── │
|
|
39
|
+
└───────────────────────────────────────────────────────────┘
|
|
40
|
+
│ Clear
|
|
41
|
+
▼
|
|
42
|
+
┌─ PHASE 1: SCOPE CONFIRMATION ─────────────────────────────┐
|
|
43
|
+
│ │
|
|
44
|
+
│ ┌───────────────────────────────────────────────────────┐ │
|
|
45
|
+
│ │ SCOPE CONFIRMATION │ │
|
|
46
|
+
│ │ │ │
|
|
47
|
+
│ │ I understand you want: /api/v2/[endpoint] │ │
|
|
48
|
+
│ │ Purpose: [inferred purpose] │ │
|
|
49
|
+
│ │ External API: [service name] (URL) │ │
|
|
50
|
+
│ │ │ │
|
|
51
|
+
│ │ Is this correct? [Y/n] │ │
|
|
52
|
+
│ │ Additional context? ____ │ │
|
|
53
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
54
|
+
│ │
|
|
55
|
+
└───────────────────────────────────────────────────────────┘
|
|
56
|
+
│
|
|
57
|
+
▼
|
|
58
|
+
┌─ PHASE 2: INITIAL RESEARCH ───────────────────────────────┐
|
|
59
|
+
│ │
|
|
60
|
+
│ Execute 2-3 initial searches: │
|
|
61
|
+
│ • Context7: "[library/api name]" │
|
|
62
|
+
│ • WebSearch: "[name] official documentation" │
|
|
63
|
+
│ • WebSearch: "site:[domain] api reference" │
|
|
64
|
+
│ │
|
|
65
|
+
│ Present summary: │
|
|
66
|
+
│ ┌───────────────────────────────────────────────────────┐ │
|
|
67
|
+
│ │ RESEARCH SUMMARY │ │
|
|
68
|
+
│ │ │ │
|
|
69
|
+
│ │ │ Source │ Found │ │
|
|
70
|
+
│ │ ├────────────────┼────────────────────────────────────│ │
|
|
71
|
+
│ │ │ Official docs │ ✓ [URL] │ │
|
|
72
|
+
│ │ │ API Reference │ ✓ REST v2 │ │
|
|
73
|
+
│ │ │ Auth method │ ✓ Bearer token │ │
|
|
74
|
+
│ │ │ NPM package │ ? Not found │ │
|
|
75
|
+
│ │ │ │
|
|
76
|
+
│ │ Proceed? [Y] / Search more? [n] ____ │ │
|
|
77
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
78
|
+
│ │
|
|
79
|
+
│ ──── Loop back if user wants more research ──── │
|
|
80
|
+
└───────────────────────────────────────────────────────────┘
|
|
81
|
+
│
|
|
82
|
+
▼
|
|
83
|
+
┌─ PHASE 3: INTERVIEW (Generated FROM Research) ────────────┐
|
|
84
|
+
│ │
|
|
85
|
+
│ Generate questions based on discovered parameters: │
|
|
86
|
+
│ │
|
|
87
|
+
│ ┌───────────────────────────────────────────────────────┐ │
|
|
88
|
+
│ │ Based on research, [API] has N parameters: │ │
|
|
89
|
+
│ │ │ │
|
|
90
|
+
│ │ 1. DOMAIN (required) - string │ │
|
|
91
|
+
│ │ → No question needed (always required) │ │
|
|
92
|
+
│ │ │ │
|
|
93
|
+
│ │ 2. FORMAT: ["json", "svg", "png", "raw"] │ │
|
|
94
|
+
│ │ Q: Which formats do you need? │ │
|
|
95
|
+
│ │ [x] json [x] svg [x] png [ ] raw │ │
|
|
96
|
+
│ │ │ │
|
|
97
|
+
│ │ 3. QUALITY: 1-100 (continuous range) │ │
|
|
98
|
+
│ │ Q: How should we TEST this? │ │
|
|
99
|
+
│ │ [ ] All values (100 tests) │ │
|
|
100
|
+
│ │ [x] Boundary (1, 50, 100) │ │
|
|
101
|
+
│ │ [ ] Sample (1, 25, 50, 75, 100) │ │
|
|
102
|
+
│ │ [ ] Custom: ____ │ │
|
|
103
|
+
│ │ │ │
|
|
104
|
+
│ │ ... (continues for ALL discovered parameters) │ │
|
|
105
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
106
|
+
│ │
|
|
107
|
+
│ Decisions are saved to state file for consistency. │
|
|
108
|
+
└───────────────────────────────────────────────────────────┘
|
|
109
|
+
│
|
|
110
|
+
▼
|
|
111
|
+
┌─ PHASE 4: DEEP RESEARCH (Adaptive) ───────────────────────┐
|
|
112
|
+
│ │
|
|
113
|
+
│ Based on interview answers, PROPOSE additional research: │
|
|
114
|
+
│ │
|
|
115
|
+
│ ┌───────────────────────────────────────────────────────┐ │
|
|
116
|
+
│ │ PROPOSED DEEP RESEARCH │ │
|
|
117
|
+
│ │ │ │
|
|
118
|
+
│ │ Based on your selections, I want to research: │ │
|
|
119
|
+
│ │ │ │
|
|
120
|
+
│ │ [x] Error response format (for error handling) │ │
|
|
121
|
+
│ │ [x] Rate limiting behavior (short cache selected) │ │
|
|
122
|
+
│ │ [ ] Webhook support (not selected) │ │
|
|
123
|
+
│ │ [x] SVG optimization (SVG format selected) │ │
|
|
124
|
+
│ │ │ │
|
|
125
|
+
│ │ Approve these searches? [Y] │ │
|
|
126
|
+
│ │ Add more: ____ │ │
|
|
127
|
+
│ │ Skip and proceed: [n] │ │
|
|
128
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
129
|
+
│ │
|
|
130
|
+
│ KEY: Research is PROPOSED, not automatic shotgun. │
|
|
131
|
+
└───────────────────────────────────────────────────────────┘
|
|
132
|
+
│
|
|
133
|
+
▼
|
|
134
|
+
┌─ PHASE 5: SCHEMA DESIGN ──────────────────────────────────┐
|
|
135
|
+
│ │
|
|
136
|
+
│ Create Zod schema from research + interview: │
|
|
137
|
+
│ │
|
|
138
|
+
│ ┌───────────────────────────────────────────────────────┐ │
|
|
139
|
+
│ │ SCHEMA REVIEW │ │
|
|
140
|
+
│ │ │ │
|
|
141
|
+
│ │ const RequestSchema = z.object({ │ │
|
|
142
|
+
│ │ domain: z.string().min(1), │ │
|
|
143
|
+
│ │ format: z.enum(["json", "svg", "png"]), │ │
|
|
144
|
+
│ │ quality: z.number().min(1).max(100).default(80) │ │
|
|
145
|
+
│ │ }); │ │
|
|
146
|
+
│ │ │ │
|
|
147
|
+
│ │ Schema matches interview answers? [Y/n] │ │
|
|
148
|
+
│ │ Missing fields? ____ │ │
|
|
149
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
150
|
+
│ │
|
|
151
|
+
│ ──── Loop back if schema wrong ──── │
|
|
152
|
+
└───────────────────────────────────────────────────────────┘
|
|
153
|
+
│
|
|
154
|
+
▼
|
|
155
|
+
┌─ PHASE 6: ENVIRONMENT CHECK ──────────────────────────────┐
|
|
156
|
+
│ │
|
|
157
|
+
│ ┌───────────────────────────────────────────────────────┐ │
|
|
158
|
+
│ │ ENVIRONMENT CHECK │ │
|
|
159
|
+
│ │ │ │
|
|
160
|
+
│ │ │ Variable │ Status │ Source │ │
|
|
161
|
+
│ │ ├──────────────────┼──────────┼──────────────────────│ │
|
|
162
|
+
│ │ │ API_KEY │ ✓ Found │ .env.local │ │
|
|
163
|
+
│ │ │ │
|
|
164
|
+
│ │ Ready for testing? [Y/n] │ │
|
|
165
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
166
|
+
│ │
|
|
167
|
+
│ ──── Loop back if keys missing ──── │
|
|
168
|
+
└───────────────────────────────────────────────────────────┘
|
|
169
|
+
│
|
|
170
|
+
▼
|
|
171
|
+
┌─ PHASE 7: TDD RED (Write Failing Tests) ──────────────────┐
|
|
172
|
+
│ │
|
|
173
|
+
│ Generate test matrix from schema + interview decisions: │
|
|
174
|
+
│ │
|
|
175
|
+
│ ┌───────────────────────────────────────────────────────┐ │
|
|
176
|
+
│ │ TEST MATRIX REVIEW │ │
|
|
177
|
+
│ │ │ │
|
|
178
|
+
│ │ │ Parameter │ Valid Values │ Invalid Values │ │
|
|
179
|
+
│ │ ├────────────┼────────────────────┼───────────────────│ │
|
|
180
|
+
│ │ │ domain │ "x.com", "a.co" │ "", null │ │
|
|
181
|
+
│ │ │ format │ "json", "svg" │ "gif", "webp" │ │
|
|
182
|
+
│ │ │ quality │ 1, 50, 100 │ 0, 101, -1 │ │
|
|
183
|
+
│ │ │ │
|
|
184
|
+
│ │ Total tests: 23 (pairwise reduction from 156) │ │
|
|
185
|
+
│ │ │ │
|
|
186
|
+
│ │ Approve test matrix? [Y/n] │ │
|
|
187
|
+
│ │ Add test cases? ____ │ │
|
|
188
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
189
|
+
│ │
|
|
190
|
+
│ HOOK: PreToolUse blocks Write if no research/interview │
|
|
191
|
+
└───────────────────────────────────────────────────────────┘
|
|
192
|
+
│
|
|
193
|
+
▼
|
|
194
|
+
┌─ PHASE 8: TDD GREEN (Minimal Implementation) ─────────────┐
|
|
195
|
+
│ │
|
|
196
|
+
│ Write minimal code to pass ALL tests. │
|
|
197
|
+
│ Tests derived from schema. │
|
|
198
|
+
│ Implementation validates with schema. │
|
|
199
|
+
│ │
|
|
200
|
+
│ Run tests → All must pass before proceeding. │
|
|
201
|
+
│ │
|
|
202
|
+
│ HOOK: PreToolUse blocks Write if test file doesn't exist │
|
|
203
|
+
└───────────────────────────────────────────────────────────┘
|
|
204
|
+
│
|
|
205
|
+
▼
|
|
206
|
+
┌─ PHASE 9: VERIFY (Re-Research After Green) ───────────────┐
|
|
207
|
+
│ │
|
|
208
|
+
│ MANDATORY: Re-read original documentation. │
|
|
209
|
+
│ Compare implementation to docs feature-by-feature: │
|
|
210
|
+
│ │
|
|
211
|
+
│ ┌───────────────────────────────────────────────────────┐ │
|
|
212
|
+
│ │ IMPLEMENTATION VERIFICATION │ │
|
|
213
|
+
│ │ │ │
|
|
214
|
+
│ │ │ Feature │ In Docs │ Implemented │ Status │ │
|
|
215
|
+
│ │ ├───────────────┼─────────┼─────────────┼─────────────│ │
|
|
216
|
+
│ │ │ domain param │ ✓ │ ✓ │ ✅ Match │ │
|
|
217
|
+
│ │ │ format opts │ 4 │ 3 │ ⚠️ Missing │ │
|
|
218
|
+
│ │ │ size max │ 4096 │ 2048 │ ⚠️ Wrong │ │
|
|
219
|
+
│ │ │ webhook │ ✓ │ ✗ │ ℹ️ Optional │ │
|
|
220
|
+
│ │ │ │
|
|
221
|
+
│ │ DISCREPANCIES: 2 found │ │
|
|
222
|
+
│ │ │ │
|
|
223
|
+
│ │ Fix these gaps? [Y] → Returns to Phase 7 (Red) │ │
|
|
224
|
+
│ │ Skip (intentional)? [n] → Document as omissions │ │
|
|
225
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
226
|
+
│ │
|
|
227
|
+
│ HOOK: PostToolUse triggers after test pass │
|
|
228
|
+
│ │
|
|
229
|
+
│ ──── Loop back to Phase 7 if gaps need fixing ──── │
|
|
230
|
+
└───────────────────────────────────────────────────────────┘
|
|
231
|
+
│
|
|
232
|
+
▼
|
|
233
|
+
┌─ PHASE 10: TDD REFACTOR ──────────────────────────────────┐
|
|
234
|
+
│ │
|
|
235
|
+
│ Clean up code while tests stay green: │
|
|
236
|
+
│ • Extract reusable patterns │
|
|
237
|
+
│ • Improve error messages │
|
|
238
|
+
│ • Add JSDoc comments │
|
|
239
|
+
│ • Optimize performance │
|
|
240
|
+
│ │
|
|
241
|
+
│ Run tests after EVERY change → Must still pass. │
|
|
242
|
+
└───────────────────────────────────────────────────────────┘
|
|
243
|
+
│
|
|
244
|
+
▼
|
|
245
|
+
┌─ PHASE 11: DOCUMENTATION ─────────────────────────────────┐
|
|
246
|
+
│ │
|
|
247
|
+
│ ┌───────────────────────────────────────────────────────┐ │
|
|
248
|
+
│ │ DOCUMENTATION REVIEW │ │
|
|
249
|
+
│ │ │ │
|
|
250
|
+
│ │ Files to update: │ │
|
|
251
|
+
│ │ │ │
|
|
252
|
+
│ │ [x] api-tests-manifest.json - Manifest entry │ │
|
|
253
|
+
│ │ [x] OpenAPI spec - Endpoint documented │ │
|
|
254
|
+
│ │ [x] .claude/research/[api]/CURRENT.md - Cached │ │
|
|
255
|
+
│ │ │ │
|
|
256
|
+
│ │ Documentation complete? [Y/n] │ │
|
|
257
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
258
|
+
│ │
|
|
259
|
+
│ HOOK: Stop hook blocks if docs incomplete │
|
|
260
|
+
└───────────────────────────────────────────────────────────┘
|
|
261
|
+
│
|
|
262
|
+
▼
|
|
263
|
+
┌─ PHASE 12: COMPLETION ────────────────────────────────────┐
|
|
264
|
+
│ │
|
|
265
|
+
│ Final verification: │
|
|
266
|
+
│ • All tests passing │
|
|
267
|
+
│ • 100% coverage │
|
|
268
|
+
│ • TypeScript compiles │
|
|
269
|
+
│ • Docs updated │
|
|
270
|
+
│ • State file shows all phases complete │
|
|
271
|
+
│ │
|
|
272
|
+
│ Run /commit to create semantic commit. │
|
|
273
|
+
└───────────────────────────────────────────────────────────┘
|
|
85
274
|
```
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
### 5. Edge Cases & Errors
|
|
111
|
-
- **What can go wrong?**
|
|
112
|
-
- **How should errors be handled?**
|
|
113
|
-
- **What are boundary conditions?**
|
|
114
|
-
- **What should be validated?**
|
|
115
|
-
|
|
116
|
-
### 6. Documentation Sources
|
|
117
|
-
- **Official documentation links:**
|
|
118
|
-
- **SDK/library documentation:**
|
|
119
|
-
- **Related endpoints or examples:**
|
|
275
|
+
|
|
276
|
+
## State File Tracking
|
|
277
|
+
|
|
278
|
+
All phases are tracked in `.claude/api-dev-state.json`:
|
|
279
|
+
|
|
280
|
+
```json
|
|
281
|
+
{
|
|
282
|
+
"endpoint": "brandfetch",
|
|
283
|
+
"turn_count": 23,
|
|
284
|
+
"phases": {
|
|
285
|
+
"disambiguation": { "status": "complete" },
|
|
286
|
+
"scope": { "status": "complete" },
|
|
287
|
+
"research_initial": { "status": "complete", "sources": [...] },
|
|
288
|
+
"interview": { "status": "complete", "decisions": {...} },
|
|
289
|
+
"research_deep": { "status": "complete" },
|
|
290
|
+
"schema_creation": { "status": "complete" },
|
|
291
|
+
"environment_check": { "status": "complete" },
|
|
292
|
+
"tdd_red": { "status": "complete", "test_count": 23 },
|
|
293
|
+
"tdd_green": { "status": "complete" },
|
|
294
|
+
"verify": { "status": "complete", "gaps_found": 2, "gaps_fixed": 2 },
|
|
295
|
+
"tdd_refactor": { "status": "complete" },
|
|
296
|
+
"documentation": { "status": "complete" }
|
|
297
|
+
}
|
|
298
|
+
}
|
|
120
299
|
```
|
|
121
300
|
|
|
122
301
|
## Output Artifacts
|
|
123
302
|
|
|
124
303
|
This command creates:
|
|
125
304
|
|
|
126
|
-
1. **
|
|
127
|
-
2. **
|
|
128
|
-
3. **
|
|
129
|
-
4. **
|
|
130
|
-
5. **
|
|
305
|
+
1. **State File**: `.claude/api-dev-state.json` (tracks all progress)
|
|
306
|
+
2. **Research Cache**: `.claude/research/[api-name]/CURRENT.md`
|
|
307
|
+
3. **Route Handler**: `/src/app/api/v2/[endpoint-name]/route.ts`
|
|
308
|
+
4. **Test Suite**: `/src/app/api/v2/[endpoint-name]/__tests__/[endpoint-name].api.test.ts`
|
|
309
|
+
5. **OpenAPI Spec**: `/src/lib/openapi/endpoints/[endpoint-name].ts`
|
|
310
|
+
6. **Updated Manifests**:
|
|
131
311
|
- `/src/app/api-test/api-tests-manifest.json`
|
|
132
312
|
- `/src/v2/docs/v2-api-implementation-status.md`
|
|
133
313
|
|
|
134
|
-
##
|
|
314
|
+
## Hooks That Enforce This Workflow
|
|
135
315
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
10. ✅ Create semantic commit
|
|
316
|
+
| Phase | Hook | Purpose |
|
|
317
|
+
|-------|------|---------|
|
|
318
|
+
| 0 | `enforce-external-research.py` | Detects API terms, requires disambiguation |
|
|
319
|
+
| 2-4 | `track-tool-use.py` | Logs all research, tracks turns |
|
|
320
|
+
| 7-8 | `enforce-research.py` | Blocks Write if no research done |
|
|
321
|
+
| 7-8 | `enforce-interview.py` | Injects interview decisions |
|
|
322
|
+
| 8 | `verify-implementation.py` | Blocks route if no test file |
|
|
323
|
+
| 9 | `verify-after-green.py` | Triggers verification after tests pass |
|
|
324
|
+
| All | `periodic-reground.py` | Re-grounds every 7 turns |
|
|
325
|
+
| 11 | `api-workflow-check.py` | Blocks completion if docs incomplete |
|
|
147
326
|
|
|
148
327
|
<claude-commands-template>
|
|
149
328
|
## Project-Specific Rules
|
|
@@ -158,9 +337,12 @@ Execute this command and I will:
|
|
|
158
337
|
8. **Test Command**: `pnpm test:run` before commits
|
|
159
338
|
|
|
160
339
|
## Never Skip
|
|
161
|
-
|
|
162
|
-
-
|
|
163
|
-
-
|
|
164
|
-
-
|
|
165
|
-
-
|
|
340
|
+
|
|
341
|
+
- Phase 0 (Disambiguation) - Clarify before research
|
|
342
|
+
- Phase 2 (Initial Research) - Find ALL parameters
|
|
343
|
+
- Phase 3 (Interview) - Questions FROM research, not templates
|
|
344
|
+
- Phase 7 (TDD Red) - Failing tests FIRST
|
|
345
|
+
- Phase 9 (Verify) - Re-research after Green
|
|
346
|
+
- Phase 11 (Documentation) - Keep docs in sync
|
|
347
|
+
- Coverage verification - 100% required
|
|
166
348
|
</claude-commands-template>
|