@hustle-together/api-dev-tools 3.10.1 → 3.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/.claude/api-dev-state.json +159 -0
  2. package/.claude/commands/README.md +185 -0
  3. package/.claude/commands/add-command.md +209 -0
  4. package/.claude/commands/api-create.md +499 -0
  5. package/.claude/commands/api-env.md +50 -0
  6. package/.claude/commands/api-interview.md +331 -0
  7. package/.claude/commands/api-research.md +331 -0
  8. package/.claude/commands/api-status.md +259 -0
  9. package/.claude/commands/api-verify.md +231 -0
  10. package/.claude/commands/beepboop.md +97 -0
  11. package/.claude/commands/busycommit.md +112 -0
  12. package/.claude/commands/commit.md +83 -0
  13. package/.claude/commands/cycle.md +142 -0
  14. package/.claude/commands/gap.md +86 -0
  15. package/.claude/commands/green.md +142 -0
  16. package/.claude/commands/issue.md +192 -0
  17. package/.claude/commands/plan.md +168 -0
  18. package/.claude/commands/pr.md +122 -0
  19. package/.claude/commands/red.md +142 -0
  20. package/.claude/commands/refactor.md +142 -0
  21. package/.claude/commands/spike.md +142 -0
  22. package/.claude/commands/summarize.md +94 -0
  23. package/.claude/commands/tdd.md +144 -0
  24. package/.claude/commands/worktree-add.md +315 -0
  25. package/.claude/commands/worktree-cleanup.md +281 -0
  26. package/.claude/hooks/api-workflow-check.py +227 -0
  27. package/.claude/hooks/enforce-deep-research.py +185 -0
  28. package/.claude/hooks/enforce-disambiguation.py +155 -0
  29. package/.claude/hooks/enforce-documentation.py +192 -0
  30. package/.claude/hooks/enforce-environment.py +253 -0
  31. package/.claude/hooks/enforce-external-research.py +328 -0
  32. package/.claude/hooks/enforce-interview.py +421 -0
  33. package/.claude/hooks/enforce-refactor.py +189 -0
  34. package/.claude/hooks/enforce-research.py +159 -0
  35. package/.claude/hooks/enforce-schema.py +186 -0
  36. package/.claude/hooks/enforce-scope.py +160 -0
  37. package/.claude/hooks/enforce-tdd-red.py +250 -0
  38. package/.claude/hooks/enforce-verify.py +186 -0
  39. package/.claude/hooks/periodic-reground.py +154 -0
  40. package/.claude/hooks/session-startup.py +151 -0
  41. package/.claude/hooks/track-tool-use.py +626 -0
  42. package/.claude/hooks/verify-after-green.py +282 -0
  43. package/.claude/hooks/verify-implementation.py +225 -0
  44. package/.claude/research/index.json +6 -0
  45. package/.claude/settings.json +93 -0
  46. package/.claude/settings.local.json +11 -0
  47. package/.claude-plugin/marketplace.json +112 -0
  48. package/.skills/README.md +291 -0
  49. package/.skills/_shared/convert-commands.py +192 -0
  50. package/.skills/_shared/hooks/api-workflow-check.py +227 -0
  51. package/.skills/_shared/hooks/enforce-deep-research.py +185 -0
  52. package/.skills/_shared/hooks/enforce-disambiguation.py +155 -0
  53. package/.skills/_shared/hooks/enforce-documentation.py +192 -0
  54. package/.skills/_shared/hooks/enforce-environment.py +253 -0
  55. package/.skills/_shared/hooks/enforce-external-research.py +328 -0
  56. package/.skills/_shared/hooks/enforce-interview.py +421 -0
  57. package/.skills/_shared/hooks/enforce-refactor.py +189 -0
  58. package/.skills/_shared/hooks/enforce-research.py +159 -0
  59. package/.skills/_shared/hooks/enforce-schema.py +186 -0
  60. package/.skills/_shared/hooks/enforce-scope.py +160 -0
  61. package/.skills/_shared/hooks/enforce-tdd-red.py +250 -0
  62. package/.skills/_shared/hooks/enforce-verify.py +186 -0
  63. package/.skills/_shared/hooks/periodic-reground.py +154 -0
  64. package/.skills/_shared/hooks/session-startup.py +151 -0
  65. package/.skills/_shared/hooks/track-tool-use.py +626 -0
  66. package/.skills/_shared/hooks/verify-after-green.py +282 -0
  67. package/.skills/_shared/hooks/verify-implementation.py +225 -0
  68. package/.skills/_shared/install.sh +114 -0
  69. package/.skills/_shared/settings.json +93 -0
  70. package/.skills/add-command/SKILL.md +222 -0
  71. package/.skills/api-create/SKILL.md +512 -0
  72. package/.skills/api-env/SKILL.md +63 -0
  73. package/.skills/api-interview/SKILL.md +344 -0
  74. package/.skills/api-research/SKILL.md +344 -0
  75. package/.skills/api-status/SKILL.md +272 -0
  76. package/.skills/api-verify/SKILL.md +244 -0
  77. package/.skills/beepboop/SKILL.md +110 -0
  78. package/.skills/busycommit/SKILL.md +125 -0
  79. package/.skills/commit/SKILL.md +96 -0
  80. package/.skills/cycle/SKILL.md +155 -0
  81. package/.skills/gap/SKILL.md +99 -0
  82. package/.skills/green/SKILL.md +155 -0
  83. package/.skills/issue/SKILL.md +205 -0
  84. package/.skills/plan/SKILL.md +181 -0
  85. package/.skills/pr/SKILL.md +135 -0
  86. package/.skills/red/SKILL.md +155 -0
  87. package/.skills/refactor/SKILL.md +155 -0
  88. package/.skills/spike/SKILL.md +155 -0
  89. package/.skills/summarize/SKILL.md +107 -0
  90. package/.skills/tdd/SKILL.md +157 -0
  91. package/.skills/update-todos/SKILL.md +228 -0
  92. package/.skills/worktree-add/SKILL.md +328 -0
  93. package/.skills/worktree-cleanup/SKILL.md +294 -0
  94. package/CHANGELOG.md +97 -0
  95. package/README.md +58 -17
  96. package/package.json +22 -11
@@ -0,0 +1,512 @@
1
+ ---
2
+ name: api-create
3
+ description: Complete API development workflow using interview-driven, research-first, test-first methodology with continuous verification loops. Use when creating new V2 API endpoints. Includes 13 phases from disambiguation through completion with loop-back architecture. Keywords: api, endpoint, tdd, research, interview, verification, workflow, testing, documentation
4
+ license: MIT
5
+ compatibility: Requires Claude Code with MCP servers (Context7 for docs, GitHub for PRs), Python 3.9+ for enforcement hooks, pnpm 10.11.0+ for package management, Vitest for testing
6
+ metadata:
7
+ version: "3.0.0"
8
+ category: "development"
9
+ tags: ["api", "tdd", "workflow", "research", "interview", "verification", "testing"]
10
+ author: "Hustle Together"
11
+ allowed-tools: WebSearch WebFetch mcp__context7 mcp__github AskUserQuestion Read Write Edit Bash TodoWrite
12
+ ---
13
+
14
+ # API Create - Comprehensive API Development Workflow v3.0
15
+
16
+ **Usage:** `/api-create [endpoint-name]`
17
+
18
+ **Purpose:** Orchestrates the complete API development workflow using interview-driven, research-first, test-first methodology with continuous verification loops.
19
+
20
+ ## ⚠️ CRITICAL: MANDATORY USER INTERACTION
21
+
22
+ **YOU MUST USE THE `AskUserQuestion` TOOL AT EVERY CHECKPOINT.**
23
+
24
+ This workflow requires REAL user input at each phase. You are **FORBIDDEN** from:
25
+ - Self-answering questions
26
+ - Assuming user responses
27
+ - Proceeding without explicit user confirmation
28
+ - Making decisions on behalf of the user
29
+
30
+ ### How to Ask Questions Correctly
31
+
32
+ At every `[Y/n]` or multiple-choice prompt in this workflow, you MUST call the `AskUserQuestion` tool with this EXACT schema:
33
+
34
+ ```json
35
+ {
36
+ "questions": [
37
+ {
38
+ "question": "Your question here? (must end with ?)",
39
+ "header": "Phase",
40
+ "multiSelect": false,
41
+ "options": [
42
+ {"label": "Option A", "description": "What this option means"},
43
+ {"label": "Option B", "description": "What this option means"},
44
+ {"label": "Other", "description": "I'll type my own answer"}
45
+ ]
46
+ }
47
+ ]
48
+ }
49
+ ```
50
+
51
+ **CRITICAL REQUIREMENTS:**
52
+ - `header`: Max 12 characters (e.g., "Scope", "Research", "Format")
53
+ - `options`: 2-4 options, each with `label` (1-5 words) and `description`
54
+ - `multiSelect`: Required boolean (true for checkboxes, false for radio)
55
+ - `question`: Must end with a question mark
56
+ - Users can always select "Other" to provide custom input
57
+
58
+ **WAIT for the user's response before proceeding.** The tool will show a UI dialog and pause execution until the user answers. Do NOT continue until you receive the response.
59
+
60
+ ### Violation Detection
61
+
62
+ The enforcement hooks will BLOCK your progress if:
63
+ - `user_question_asked` is false for any phase
64
+ - `user_confirmed`/`user_approved`/`user_completed` is false
65
+ - `phase_exit_confirmed` is false (user must explicitly approve proceeding to next phase)
66
+ - Questions were not asked via the AskUserQuestion tool
67
+
68
+ If you see "BLOCKED" messages, it means you skipped user interaction.
69
+
70
+ ### Phase Exit Confirmation (NEW in v3.5.0)
71
+
72
+ **Every phase requires an EXIT CONFIRMATION question** before proceeding to the next phase. This prevents Claude from self-answering and moving on without explicit user approval.
73
+
74
+ The exit confirmation question MUST:
75
+ 1. Summarize what was accomplished in the current phase
76
+ 2. Ask if user is ready to proceed to the next phase
77
+ 3. Include options like "Yes, proceed", "No, I have changes", "Add more"
78
+
79
+ Example exit confirmation:
80
+ ```json
81
+ {
82
+ "questions": [{
83
+ "question": "Phase complete. Research found 5 sources. Ready to proceed to Interview phase?",
84
+ "header": "Proceed",
85
+ "multiSelect": false,
86
+ "options": [
87
+ {"label": "Yes, proceed", "description": "Move to next phase"},
88
+ {"label": "No, more research", "description": "I need additional research on [topic]"},
89
+ {"label": "Review sources", "description": "Show me what was found"}
90
+ ]
91
+ }]
92
+ }
93
+ ```
94
+
95
+ The `phase_exit_confirmed` flag is automatically set when:
96
+ 1. An `AskUserQuestion` is called with a question containing words like "proceed", "continue", "ready", "confirm", "approve"
97
+ 2. The user responds with an affirmative answer (yes, proceed, confirm, approve, etc.)
98
+
99
+ Both conditions must be true for the flag to be set.
100
+
101
+ ---
102
+
103
+ ## Key Principles
104
+
105
+ 1. **Loop Until Green** - Every verification phase loops back if not successful
106
+ 2. **Continuous Interviews** - Checkpoints at EVERY phase transition (USE AskUserQuestion!)
107
+ 3. **Adaptive Research** - Propose searches based on context, not shotgun approach
108
+ 4. **Self-Documenting** - State file captures everything for re-grounding
109
+ 5. **Verify After Green** - Re-research docs to catch memory-based implementation errors
110
+
111
+ ## Complete Phase Flow
112
+
113
+ ```
114
+ /api-create [endpoint]
115
+
116
+
117
+ ┌─ PHASE 1: DISAMBIGUATION ─────────────────────────────────┐
118
+ │ Search 3-5 variations of the term: │
119
+ │ • "[term]" │
120
+ │ • "[term] API" │
121
+ │ • "[term] SDK" │
122
+ │ • "[term] npm package" │
123
+ │ │
124
+ │ ⚠️ REQUIRED: Use AskUserQuestion tool with EXACT schema: │
125
+ │ │
126
+ │ { │
127
+ │ "questions": [{ │
128
+ │ "question": "Which interpretation of [term]?", │
129
+ │ "header": "Disambig", │
130
+ │ "multiSelect": false, │
131
+ │ "options": [ │
132
+ │ {"label": "REST API", "description": "Official API"},│
133
+ │ {"label": "SDK/Package", "description": "NPM wrapper"},│
134
+ │ {"label": "Both", "description": "API + SDK"} │
135
+ │ ] │
136
+ │ }] │
137
+ │ } │
138
+ │ │
139
+ │ WAIT for user response. Do NOT proceed without it. │
140
+ │ ──── Loop back if user selects "Something else" ──── │
141
+ └───────────────────────────────────────────────────────────┘
142
+ │ Clear
143
+
144
+ ┌─ PHASE 2: SCOPE CONFIRMATION ─────────────────────────────┐
145
+ │ │
146
+ │ Present your understanding, then: │
147
+ │ │
148
+ │ ⚠️ REQUIRED: Use AskUserQuestion tool: │
149
+ │ │
150
+ │ AskUserQuestion({ │
151
+ │ questions: [{ │
152
+ │ question: "I understand you want /api/v2/[endpoint] │
153
+ │ to [purpose]. Using [external API]. │
154
+ │ Is this correct?", │
155
+ │ header: "Scope", │
156
+ │ options: [ │
157
+ │ "Yes, proceed", │
158
+ │ "I have modifications to add", │
159
+ │ "No, let me clarify the purpose" │
160
+ │ ] │
161
+ │ }] │
162
+ │ }) │
163
+ │ │
164
+ │ WAIT for user response. Do NOT assume "yes". │
165
+ │ ──── Loop back if user has modifications ──── │
166
+ └───────────────────────────────────────────────────────────┘
167
+
168
+
169
+ ┌─ PHASE 3: INITIAL RESEARCH ───────────────────────────────┐
170
+ │ │
171
+ │ Execute 2-3 initial searches: │
172
+ │ • Context7: "[library/api name]" │
173
+ │ • WebSearch: "[name] official documentation" │
174
+ │ • WebSearch: "site:[domain] api reference" │
175
+ │ │
176
+ │ Present summary table, then: │
177
+ │ │
178
+ │ ⚠️ REQUIRED: Use AskUserQuestion tool: │
179
+ │ │
180
+ │ AskUserQuestion({ │
181
+ │ questions: [{ │
182
+ │ question: "Research summary above. Found [N] │
183
+ │ sources. Should I proceed or search │
184
+ │ for more?", │
185
+ │ header: "Research", │
186
+ │ options: [ │
187
+ │ "Proceed to interview", │
188
+ │ "Search more - I need [specific topic]", │
189
+ │ "Search for something specific (I'll describe)" │
190
+ │ ] │
191
+ │ }] │
192
+ │ }) │
193
+ │ │
194
+ │ WAIT for user response. Do NOT auto-proceed. │
195
+ │ ──── Loop back if user wants more research ──── │
196
+ └───────────────────────────────────────────────────────────┘
197
+
198
+
199
+ ┌─ PHASE 4: INTERVIEW (Generated FROM Research) ────────────┐
200
+ │ │
201
+ │ For EACH parameter discovered in research, ask ONE │
202
+ │ question at a time using AskUserQuestion: │
203
+ │ │
204
+ │ ⚠️ REQUIRED: Use AskUserQuestion for EACH question: │
205
+ │ │
206
+ │ // Question 1: Format preference │
207
+ │ AskUserQuestion({ │
208
+ │ questions: [{ │
209
+ │ question: "Which response formats do you need?", │
210
+ │ header: "Format", │
211
+ │ multiSelect: true, │
212
+ │ options: ["JSON", "SVG", "PNG", "All formats"] │
213
+ │ }] │
214
+ │ }) │
215
+ │ // WAIT for response, record in state, then next Q │
216
+ │ │
217
+ │ // Question 2: Error handling │
218
+ │ AskUserQuestion({ │
219
+ │ questions: [{ │
220
+ │ question: "How should errors be handled?", │
221
+ │ header: "Errors", │
222
+ │ options: [ │
223
+ │ "Throw exceptions", │
224
+ │ "Return error objects", │
225
+ │ "Both (configurable)" │
226
+ │ ] │
227
+ │ }] │
228
+ │ }) │
229
+ │ // Continue for ALL parameters... │
230
+ │ │
231
+ │ After ALL questions answered: │
232
+ │ │
233
+ │ AskUserQuestion({ │
234
+ │ questions: [{ │
235
+ │ question: "Interview complete. Your decisions: │
236
+ │ [summary]. All correct?", │
237
+ │ header: "Confirm", │
238
+ │ options: [ │
239
+ │ "Yes, proceed to schema", │
240
+ │ "Change an answer", │
241
+ │ "Add another question" │
242
+ │ ] │
243
+ │ }] │
244
+ │ }) │
245
+ │ │
246
+ │ Decisions saved to state file for consistency. │
247
+ │ ──── Loop back if user wants to change answers ──── │
248
+ └───────────────────────────────────────────────────────────┘
249
+
250
+
251
+ ┌─ PHASE 5: DEEP RESEARCH (Adaptive) ───────────────────────┐
252
+ │ │
253
+ │ Based on interview answers, PROPOSE additional research. │
254
+ │ │
255
+ │ ⚠️ REQUIRED: Use AskUserQuestion tool: │
256
+ │ │
257
+ │ AskUserQuestion({ │
258
+ │ questions: [{ │
259
+ │ question: "Based on your interview answers, I │
260
+ │ want to research: [list]. Approve?", │
261
+ │ header: "Deep Research", │
262
+ │ options: [ │
263
+ │ "Yes, run these searches", │
264
+ │ "Add more - I also need [topic]", │
265
+ │ "Skip deep research, proceed to schema" │
266
+ │ ] │
267
+ │ }] │
268
+ │ }) │
269
+ │ │
270
+ │ WAIT for user response. Do NOT auto-approve. │
271
+ │ KEY: Research is PROPOSED, not automatic shotgun. │
272
+ │ ──── Loop back if user wants to add topics ──── │
273
+ └───────────────────────────────────────────────────────────┘
274
+
275
+
276
+ ┌─ PHASE 6: SCHEMA DESIGN ──────────────────────────────────┐
277
+ │ │
278
+ │ Create Zod schema from research + interview, then: │
279
+ │ │
280
+ │ ⚠️ REQUIRED: Use AskUserQuestion tool: │
281
+ │ │
282
+ │ AskUserQuestion({ │
283
+ │ questions: [{ │
284
+ │ question: "Schema created based on your interview. │
285
+ │ [show schema]. Does this match your │
286
+ │ requirements?", │
287
+ │ header: "Schema", │
288
+ │ options: [ │
289
+ │ "Yes, schema looks correct", │
290
+ │ "No, I need changes (I'll describe)", │
291
+ │ "Let's redo the interview" │
292
+ │ ] │
293
+ │ }] │
294
+ │ }) │
295
+ │ │
296
+ │ WAIT for user response. Do NOT assume approval. │
297
+ │ ──── Loop back if schema needs changes ──── │
298
+ └───────────────────────────────────────────────────────────┘
299
+
300
+
301
+ ┌─ PHASE 7: ENVIRONMENT CHECK ──────────────────────────────┐
302
+ │ │
303
+ │ Check required API keys, show status table, then: │
304
+ │ │
305
+ │ ⚠️ REQUIRED: Use AskUserQuestion tool: │
306
+ │ │
307
+ │ AskUserQuestion({ │
308
+ │ questions: [{ │
309
+ │ question: "Environment check: [N] keys found, │
310
+ │ [M] missing. Ready to start TDD?", │
311
+ │ header: "Environment", │
312
+ │ options: [ │
313
+ │ "Yes, ready to write tests", │
314
+ │ "No, need to set up API keys first", │
315
+ │ "No, need to fix something else" │
316
+ │ ] │
317
+ │ }] │
318
+ │ }) │
319
+ │ │
320
+ │ WAIT for user response. Do NOT auto-proceed. │
321
+ │ ──── Loop back if keys missing ──── │
322
+ └───────────────────────────────────────────────────────────┘
323
+
324
+
325
+ ┌─ PHASE 8: TDD RED (Write Failing Tests) ──────────────────┐
326
+ │ │
327
+ │ Generate test matrix from schema + interview, then: │
328
+ │ │
329
+ │ ⚠️ REQUIRED: Use AskUserQuestion tool: │
330
+ │ │
331
+ │ AskUserQuestion({ │
332
+ │ questions: [{ │
333
+ │ question: "Test matrix: [N] test scenarios based │
334
+ │ on your interview. Covers: [list]. │
335
+ │ Approve this test plan?", │
336
+ │ header: "Tests", │
337
+ │ options: [ │
338
+ │ "Yes, write these tests", │
339
+ │ "Add more scenarios (I'll describe)", │
340
+ │ "Change a scenario (I'll describe)" │
341
+ │ ] │
342
+ │ }] │
343
+ │ }) │
344
+ │ │
345
+ │ WAIT for user response. Do NOT auto-approve. │
346
+ │ HOOK: PreToolUse blocks Write if no research/interview │
347
+ │ ──── Loop back if user wants changes ──── │
348
+ └───────────────────────────────────────────────────────────┘
349
+
350
+
351
+ ┌─ PHASE 9: TDD GREEN (Minimal Implementation) ─────────────┐
352
+ │ │
353
+ │ Write minimal code to pass ALL tests. │
354
+ │ Tests derived from schema. │
355
+ │ Implementation validates with schema. │
356
+ │ │
357
+ │ Run tests → All must pass before proceeding. │
358
+ │ │
359
+ │ HOOK: PreToolUse blocks Write if test file doesn't exist │
360
+ └───────────────────────────────────────────────────────────┘
361
+
362
+
363
+ ┌─ PHASE 10: VERIFY (Re-Research After Green) ───────────────┐
364
+ │ │
365
+ │ MANDATORY: Re-read original documentation. │
366
+ │ Compare implementation to docs, then: │
367
+ │ │
368
+ │ ⚠️ REQUIRED: Use AskUserQuestion tool: │
369
+ │ │
370
+ │ AskUserQuestion({ │
371
+ │ questions: [{ │
372
+ │ question: "Verification found [N] gap(s) between │
373
+ │ docs and implementation: [list]. │
374
+ │ How should I proceed?", │
375
+ │ header: "Verify", │
376
+ │ options: [ │
377
+ │ "Fix gaps - loop back to Red phase", │
378
+ │ "Skip - these are intentional omissions", │
379
+ │ "Fix some, skip others (I'll specify)" │
380
+ │ ] │
381
+ │ }] │
382
+ │ }) │
383
+ │ │
384
+ │ WAIT for user response. Do NOT auto-decide. │
385
+ │ HOOK: PostToolUse triggers after test pass │
386
+ │ ──── Loop back to Phase 8 if user wants fixes ──── │
387
+ └───────────────────────────────────────────────────────────┘
388
+
389
+
390
+ ┌─ PHASE 11: TDD REFACTOR ──────────────────────────────────┐
391
+ │ │
392
+ │ Clean up code while tests stay green: │
393
+ │ • Extract reusable patterns │
394
+ │ • Improve error messages │
395
+ │ • Add JSDoc comments │
396
+ │ • Optimize performance │
397
+ │ │
398
+ │ Run tests after EVERY change → Must still pass. │
399
+ └───────────────────────────────────────────────────────────┘
400
+
401
+
402
+ ┌─ PHASE 12: DOCUMENTATION ─────────────────────────────────┐
403
+ │ │
404
+ │ Update documentation files, then: │
405
+ │ │
406
+ │ ⚠️ REQUIRED: Use AskUserQuestion tool: │
407
+ │ │
408
+ │ AskUserQuestion({ │
409
+ │ questions: [{ │
410
+ │ question: "Documentation checklist: [list files]. │
411
+ │ All documentation complete?", │
412
+ │ header: "Docs", │
413
+ │ options: [ │
414
+ │ "Yes, all documentation is done", │
415
+ │ "No, I need to add something (I'll describe)", │
416
+ │ "Skip docs for now (not recommended)" │
417
+ │ ] │
418
+ │ }] │
419
+ │ }) │
420
+ │ │
421
+ │ WAIT for user response. Do NOT auto-complete. │
422
+ │ HOOK: Stop hook blocks if docs incomplete │
423
+ │ ──── Loop back if user needs to add docs ──── │
424
+ └───────────────────────────────────────────────────────────┘
425
+
426
+
427
+ ┌─ PHASE 13: COMPLETION ────────────────────────────────────┐
428
+ │ │
429
+ │ Final verification: │
430
+ │ • All tests passing │
431
+ │ • 100% coverage │
432
+ │ • TypeScript compiles │
433
+ │ • Docs updated │
434
+ │ • State file shows all phases complete │
435
+ │ │
436
+ │ Run /commit to create semantic commit. │
437
+ └───────────────────────────────────────────────────────────┘
438
+ ```
439
+
440
+ ## State File Tracking
441
+
442
+ All phases are tracked in `.claude/api-dev-state.json`:
443
+
444
+ ```json
445
+ {
446
+ "endpoint": "brandfetch",
447
+ "turn_count": 23,
448
+ "phases": {
449
+ "disambiguation": { "status": "complete" },
450
+ "scope": { "status": "complete" },
451
+ "research_initial": { "status": "complete", "sources": [...] },
452
+ "interview": { "status": "complete", "decisions": {...} },
453
+ "research_deep": { "status": "complete" },
454
+ "schema_creation": { "status": "complete" },
455
+ "environment_check": { "status": "complete" },
456
+ "tdd_red": { "status": "complete", "test_count": 23 },
457
+ "tdd_green": { "status": "complete" },
458
+ "verify": { "status": "complete", "gaps_found": 2, "gaps_fixed": 2 },
459
+ "tdd_refactor": { "status": "complete" },
460
+ "documentation": { "status": "complete" }
461
+ }
462
+ }
463
+ ```
464
+
465
+ ## Output Artifacts
466
+
467
+ This command creates:
468
+
469
+ 1. **State File**: `.claude/api-dev-state.json` (tracks all progress)
470
+ 2. **Research Cache**: `.claude/research/[api-name]/CURRENT.md`
471
+ 3. **Route Handler**: `/src/app/api/v2/[endpoint-name]/route.ts`
472
+ 4. **Test Suite**: `/src/app/api/v2/[endpoint-name]/__tests__/[endpoint-name].api.test.ts`
473
+ 5. **OpenAPI Spec**: `/src/lib/openapi/endpoints/[endpoint-name].ts`
474
+ 6. **Updated Manifests**:
475
+ - `/src/app/api-test/api-tests-manifest.json`
476
+ - `/src/v2/docs/v2-api-implementation-status.md`
477
+
478
+ ## Hooks That Enforce This Workflow
479
+
480
+ | Phase | Hook | Purpose |
481
+ |-------|------|---------|
482
+ | 0 | `enforce-external-research.py` | Detects API terms, requires disambiguation |
483
+ | 2-4 | `track-tool-use.py` | Logs all research, tracks turns |
484
+ | 7-8 | `enforce-research.py` | Blocks Write if no research done |
485
+ | 7-8 | `enforce-interview.py` | Injects interview decisions |
486
+ | 8 | `verify-implementation.py` | Blocks route if no test file |
487
+ | 9 | `verify-after-green.py` | Triggers verification after tests pass |
488
+ | All | `periodic-reground.py` | Re-grounds every 7 turns |
489
+ | 11 | `api-workflow-check.py` | Blocks completion if docs incomplete |
490
+
491
+ <claude-commands-template>
492
+ ## Project-Specific Rules
493
+
494
+ 1. **API Location**: All V2 APIs go in `/src/app/api/v2/[endpoint-name]/`
495
+ 2. **Testing**: Use Vitest, require 100% coverage
496
+ 3. **Validation**: All requests/responses use Zod schemas
497
+ 4. **AI SDK**: Use Vercel AI SDK 5.0.11 patterns from `/src/v2/docs/ai-sdk-catalog.json`
498
+ 5. **Package Manager**: Use `pnpm` for all operations
499
+ 6. **Documentation**: Follow patterns in `/src/v2/docs/Main Doc – V2 Development Patterns.md`
500
+ 7. **API Keys**: Support three methods (env, NEXT_PUBLIC_, custom headers)
501
+ 8. **Test Command**: `pnpm test:run` before commits
502
+
503
+ ## Never Skip
504
+
505
+ - Phase 1 (Disambiguation) - Clarify before research
506
+ - Phase 3 (Initial Research) - Find ALL parameters
507
+ - Phase 4 (Interview) - Questions FROM research, not templates
508
+ - Phase 8 (TDD Red) - Failing tests FIRST
509
+ - Phase 10 (Verify) - Re-research after Green
510
+ - Phase 12 (Documentation) - Keep docs in sync
511
+ - Coverage verification - 100% required
512
+ </claude-commands-template>
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: api-env
3
+ description: Check required API keys and environment variables. Supports server env vars, NEXT_PUBLIC_ vars, and custom headers. Use before starting implementation. Keywords: environment, api-keys, configuration, setup, validation
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: "development"
9
+ tags: ['environment', 'api-keys', 'configuration', 'setup']
10
+ author: "Hustle Together"
11
+ allowed-tools: WebSearch WebFetch mcp__context7 mcp__github AskUserQuestion Read Write Edit Bash TodoWrite
12
+ ---
13
+
14
+ # API Environment - Check API Keys & Configuration
15
+
16
+ **Usage:** `/api-env [endpoint-name]`
17
+
18
+ **Purpose:** Quick check for required API keys and environment setup before implementation.
19
+
20
+ ## What This Checks
21
+
22
+ 1. **Reads endpoint documentation** to identify required services
23
+ 2. **Checks .env.local** for API keys
24
+ 3. **Verifies .env.example** has templates
25
+ 4. **Reports missing keys** with setup instructions
26
+
27
+ ## Output
28
+
29
+ ```
30
+ 🔑 Environment Check: [endpoint-name]
31
+
32
+ Required API Keys:
33
+ ✅ OPENAI_API_KEY (found)
34
+ ❌ FIRECRAWL_API_KEY (missing)
35
+
36
+ Action Required:
37
+ 1. Get key from https://firecrawl.dev
38
+ 2. Add to .env.local: FIRECRAWL_API_KEY=fc-...
39
+ 3. Add to .env.example template
40
+
41
+ Status: BLOCKED - Cannot proceed without FIRECRAWL_API_KEY
42
+ ```
43
+
44
+ ## Usage in Workflow
45
+
46
+ ```bash
47
+ # Before starting implementation
48
+ /api-interview generate-css
49
+ /api-research firecrawl
50
+ /api-env generate-css ← Check keys
51
+ /red ← Start TDD if ready
52
+ ```
53
+
54
+ <claude-commands-template>
55
+ ## API Key Support
56
+
57
+ The project supports three methods:
58
+ 1. Server env: `OPENAI_API_KEY=sk-...`
59
+ 2. Client env: `NEXT_PUBLIC_OPENAI_API_KEY=sk-...`
60
+ 3. Custom headers: `X-OpenAI-Key: sk-...`
61
+
62
+ Check src/lib/api-keys.ts for implementation.
63
+ </claude-commands-template>