@hustle-together/api-dev-tools 1.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.
@@ -0,0 +1,279 @@
1
+ # API Research - Documentation Discovery & Schema Extraction
2
+
3
+ **Usage:** `/api-research [library-or-service-name]`
4
+
5
+ **Purpose:** Automatically research external APIs, SDKs, and libraries to discover ALL available parameters, options, and features.
6
+
7
+ ## What This Command Does
8
+
9
+ 1. **Searches for Official Documentation**
10
+ - Official API docs
11
+ - SDK/library documentation
12
+ - GitHub repositories
13
+ - npm package pages (if applicable)
14
+
15
+ 2. **Extracts Complete Schemas**
16
+ - All request parameters (required + optional)
17
+ - All response fields
18
+ - Type definitions
19
+ - Validation rules
20
+ - Default values
21
+
22
+ 3. **Discovers Hidden Features**
23
+ - Undocumented parameters (from source code)
24
+ - Advanced configuration options
25
+ - Beta/experimental features
26
+ - Deprecated options to avoid
27
+
28
+ 4. **Documents Integration Requirements**
29
+ - Required environment variables
30
+ - API key setup
31
+ - Rate limits and quotas
32
+ - Pricing/cost information
33
+ - Version compatibility
34
+
35
+ ## Research Process
36
+
37
+ ### Step 1: Find Official Sources
38
+ ```
39
+ - Web search for "[library-name] documentation"
40
+ - Check npm registry for package info
41
+ - Find GitHub repository
42
+ - Look for TypeScript definitions
43
+ - Search for community resources
44
+ ```
45
+
46
+ ### Step 2: Deep Dive into Documentation
47
+ ```
48
+ - Read API reference pages
49
+ - Review SDK documentation
50
+ - Check TypeScript type definitions (.d.ts files)
51
+ - Look at example code
52
+ - Find changelog for recent changes
53
+ ```
54
+
55
+ ### Step 3: Source Code Analysis
56
+ ```
57
+ - Review actual implementation code
58
+ - Check for undocumented parameters
59
+ - Find default values in source
60
+ - Identify validation logic
61
+ - Discover error cases
62
+ ```
63
+
64
+ ### Step 4: Test & Verify
65
+ ```
66
+ - Check what parameters are actually used
67
+ - Verify parameter names and types
68
+ - Test edge cases
69
+ - Document observed behavior
70
+ ```
71
+
72
+ ## Output Format
73
+
74
+ Creates: `/src/v2/docs/research/[library-name].md`
75
+
76
+ ```markdown
77
+ # Research: [Library/Service Name]
78
+
79
+ **Date:** [current-date]
80
+ **Version:** [version-number]
81
+ **Status:** Research Complete
82
+
83
+ ## 1. Official Documentation Links
84
+ - Main docs: [URL]
85
+ - API reference: [URL]
86
+ - GitHub repo: [URL]
87
+ - npm package: [URL]
88
+ - TypeScript types: [URL]
89
+
90
+ ## 2. Installation & Setup
91
+ ### Installation
92
+ ```bash
93
+ [installation command]
94
+ ```
95
+
96
+ ### Environment Variables
97
+ ```env
98
+ [required env vars]
99
+ ```
100
+
101
+ ### API Key Setup
102
+ [How to obtain and configure]
103
+
104
+ ## 3. Complete Request Schema
105
+ ### Required Parameters
106
+ | Parameter | Type | Description | Validation |
107
+ |-----------|------|-------------|------------|
108
+ | [name] | [type] | [desc] | [rules] |
109
+
110
+ ### Optional Parameters
111
+ | Parameter | Type | Default | Description | Notes |
112
+ |-----------|------|---------|-------------|-------|
113
+ | [name] | [type] | [default] | [desc] | [notes] |
114
+
115
+ ### Zod Schema (Preliminary)
116
+ ```typescript
117
+ const RequestSchema = z.object({
118
+ // Required
119
+ requiredParam: z.string().min(1),
120
+
121
+ // Optional with defaults
122
+ optionalParam: z.string().default('default-value'),
123
+
124
+ // Enums
125
+ mode: z.enum(['option1', 'option2']).default('option1'),
126
+
127
+ // Nested objects
128
+ config: z.object({
129
+ setting: z.boolean().default(true),
130
+ }).optional(),
131
+ });
132
+ ```
133
+
134
+ ## 4. Complete Response Schema
135
+ ### Success Response
136
+ ```typescript
137
+ interface SuccessResponse {
138
+ [field]: [type]; // [description]
139
+ }
140
+ ```
141
+
142
+ ### Error Response
143
+ ```typescript
144
+ interface ErrorResponse {
145
+ error: string;
146
+ code?: string;
147
+ details?: unknown;
148
+ }
149
+ ```
150
+
151
+ ### Zod Schema (Preliminary)
152
+ ```typescript
153
+ const ResponseSchema = z.object({
154
+ // Response fields
155
+ });
156
+ ```
157
+
158
+ ## 5. Features & Capabilities
159
+ ### Core Features
160
+ - [Feature 1]: [description]
161
+ - [Feature 2]: [description]
162
+
163
+ ### Advanced Features
164
+ - [Advanced 1]: [description + how to enable]
165
+ - [Advanced 2]: [description + how to enable]
166
+
167
+ ### Experimental/Beta Features
168
+ - [Beta feature]: [description + stability notes]
169
+
170
+ ## 6. Limitations & Constraints
171
+ - Rate limits: [details]
172
+ - Size limits: [details]
173
+ - Timeout: [details]
174
+ - Quotas: [details]
175
+ - Costs: [details]
176
+
177
+ ## 7. Integration Notes
178
+ ### Vercel AI SDK Integration
179
+ [If using AI SDK, document integration patterns]
180
+
181
+ ### Error Handling
182
+ [Common errors and how to handle]
183
+
184
+ ### Best Practices
185
+ - [Practice 1]
186
+ - [Practice 2]
187
+
188
+ ## 8. Code Examples
189
+ ### Basic Usage
190
+ ```typescript
191
+ [minimal example]
192
+ ```
193
+
194
+ ### Advanced Usage
195
+ ```typescript
196
+ [example with optional parameters]
197
+ ```
198
+
199
+ ### Error Handling
200
+ ```typescript
201
+ [example with try/catch]
202
+ ```
203
+
204
+ ## 9. Testing Considerations
205
+ - [ ] Test basic success case
206
+ - [ ] Test all optional parameters
207
+ - [ ] Test validation failures
208
+ - [ ] Test rate limiting
209
+ - [ ] Test timeout scenarios
210
+ - [ ] Test error responses
211
+
212
+ ## 10. Version History & Changes
213
+ [Notable changes in recent versions]
214
+
215
+ ## 11. Related Resources
216
+ - [Community examples]
217
+ - [Blog posts]
218
+ - [Stack Overflow discussions]
219
+ - [Alternative libraries]
220
+ ```
221
+
222
+ ## Usage Examples
223
+
224
+ ### Research an AI SDK
225
+ ```bash
226
+ /api-research vercel-ai-sdk-generateText
227
+ ```
228
+
229
+ ### Research an External API
230
+ ```bash
231
+ /api-research firecrawl-api
232
+ ```
233
+
234
+ ### Research a Library
235
+ ```bash
236
+ /api-research anthropic-sdk
237
+ ```
238
+
239
+ ## Research Workflow
240
+
241
+ 1. **Execute command**: `/api-research [name]`
242
+ 2. **I search and analyze**: Web search → Documentation → Source code
243
+ 3. **Document everything**: Create comprehensive research doc
244
+ 4. **Review together**: You verify accuracy and completeness
245
+ 5. **Use in implementation**: Reference during TDD cycle
246
+
247
+ ## Why This Matters
248
+
249
+ Without thorough research:
250
+ - ❌ Miss optional parameters that users need
251
+ - ❌ Don't test edge cases properly
252
+ - ❌ Implement wrong validation rules
253
+ - ❌ Create brittle integrations
254
+
255
+ With thorough research:
256
+ - ✅ Know ALL available options
257
+ - ✅ Test comprehensively
258
+ - ✅ Proper validation
259
+ - ✅ Robust implementation
260
+ - ✅ Better documentation
261
+
262
+ <claude-commands-template>
263
+ ## Research Guidelines
264
+
265
+ 1. **Read actual code** - TypeScript definitions reveal truth
266
+ 2. **Test assumptions** - Verify parameters actually work
267
+ 3. **Document sources** - Track ALL links for future reference
268
+ 4. **Check versions** - Note version-specific features
269
+ 5. **Find examples** - Real code > documentation
270
+ 6. **Look for gotchas** - Common mistakes, limitations, bugs
271
+
272
+ ## Integration with API Development
273
+
274
+ After research:
275
+ - Use in `/api-interview` to ask informed questions
276
+ - Reference in `/api-create` for schema creation
277
+ - Base tests on discovered parameters
278
+ - Update if API changes
279
+ </claude-commands-template>
@@ -0,0 +1,259 @@
1
+ # API Status - Track Implementation Progress
2
+
3
+ **Usage:** `/api-status [endpoint-name]` or `/api-status --all`
4
+
5
+ **Purpose:** View and update API implementation status, track progress, and manage V2 migration.
6
+
7
+ ## State File Integration
8
+
9
+ This command reads from `.claude/api-dev-state.json` which is automatically updated by the enforcement hooks.
10
+
11
+ ### Reading Current State
12
+
13
+ **FIRST: Read the state file to understand current progress:**
14
+
15
+ ```
16
+ Tool: Read
17
+ Path: .claude/api-dev-state.json
18
+ ```
19
+
20
+ Parse the JSON and display a formatted status report showing:
21
+ - Current endpoint being worked on
22
+ - Phase completion status (scope, research, interview, TDD, docs)
23
+ - Sources consulted during research
24
+ - Timestamps for each phase
25
+ - Verification status
26
+
27
+ ### Example State Display
28
+
29
+ ```
30
+ 📊 API Development Progress
31
+
32
+ Endpoint: stream-text
33
+ Library: vercel-ai-sdk
34
+ Started: 2025-12-06T20:00:00Z
35
+
36
+ PHASES:
37
+ ✅ Scope defined (20:00:30)
38
+ ✅ Initial research - 4 sources consulted (20:02:00)
39
+ 🔄 Interview - in progress
40
+ ⬜ Deep research
41
+ ⬜ Schema creation
42
+ ⬜ Environment check
43
+ ⬜ TDD Red
44
+ ⬜ TDD Green
45
+ ⬜ TDD Refactor
46
+ ⬜ Documentation
47
+
48
+ RESEARCH SOURCES:
49
+ • context7: @ai-sdk/core (20:01:00)
50
+ • websearch: "Vercel AI SDK streamText 2025" (20:01:30)
51
+ • webfetch: https://sdk.vercel.ai/docs (20:01:45)
52
+
53
+ VERIFICATION:
54
+ ❌ All sources fetched: false
55
+ ❌ Schema matches docs: false
56
+ ❌ Tests cover params: false
57
+ ❌ All tests passing: false
58
+ ```
59
+
60
+ ## What This Shows
61
+
62
+ ### For Specific Endpoint
63
+ ```
64
+ 📊 Status: /api/v2/generate-css
65
+
66
+ Phase: ✅ Complete
67
+ Tests: 33/33 passing (100% coverage)
68
+ Documentation: ✅ Complete
69
+
70
+ Timeline:
71
+ ✅ Interview completed (2025-12-06)
72
+ ✅ Research completed (2025-12-06)
73
+ ✅ Environment verified (2025-12-06)
74
+ ✅ Tests written (Red phase)
75
+ ✅ Implementation complete (Green phase)
76
+ ✅ Refactored (Refactor phase)
77
+ ✅ Documentation updated
78
+ ✅ Committed to git
79
+
80
+ Files:
81
+ - Route: src/app/api/v2/generate-css/route.ts
82
+ - Tests: src/app/api/v2/generate-css/__tests__/generate-css.api.test.ts
83
+ - Docs: src/v2/docs/endpoints/generate-css.md
84
+ - Research: src/v2/docs/research/gemini-flash.md
85
+
86
+ Next Steps: None - endpoint complete
87
+ ```
88
+
89
+ ### For All Endpoints
90
+ ```
91
+ 📊 V2 API Implementation Status
92
+
93
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
94
+
95
+ ✅ COMPLETE (2)
96
+ • /api/v2/health (15 tests)
97
+ • /api/v2/monitor (23 tests)
98
+
99
+ 🚧 IN PROGRESS (1)
100
+ • /api/v2/generate-css (interview complete, implementing)
101
+
102
+ 📋 PLANNED (3)
103
+ • /api/v2/generate-html
104
+ • /api/v2/chat
105
+ • /api/v2/scrape
106
+
107
+ ❌ NOT STARTED (0)
108
+
109
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
110
+
111
+ Summary:
112
+ Total endpoints: 6
113
+ Complete: 2 (33%)
114
+ In progress: 1 (17%)
115
+ Planned: 3 (50%)
116
+ Total tests: 38
117
+ Coverage: 100%
118
+
119
+ Last updated: 2025-12-06
120
+ ```
121
+
122
+ ## Commands
123
+
124
+ ### View Status
125
+ ```bash
126
+ /api-status generate-css # Specific endpoint
127
+ /api-status --all # All endpoints
128
+ ```
129
+
130
+ ### Update Status
131
+ ```bash
132
+ /api-status generate-css --phase=testing
133
+ /api-status generate-css --complete
134
+ ```
135
+
136
+ ## Status Tracking File
137
+
138
+ Updates: `/src/v2/docs/v2-api-implementation-status.md`
139
+
140
+ **Format:**
141
+ ```markdown
142
+ # V2 API Implementation Status
143
+
144
+ **Last Updated:** 2025-12-06
145
+ **Total Endpoints:** 6
146
+ **Completed:** 2 (33%)
147
+
148
+ ## Endpoints
149
+
150
+ ### ✅ /api/v2/health
151
+ - **Status:** Complete
152
+ - **Tests:** 15/15 passing
153
+ - **Coverage:** 100%
154
+ - **Interview:** [Link to docs]
155
+ - **Implemented:** 2025-12-06
156
+ - **Purpose:** System health check with dependency validation
157
+
158
+ ### 🚧 /api/v2/generate-css
159
+ - **Status:** In Progress (Testing)
160
+ - **Tests:** 20/33 passing
161
+ - **Coverage:** 85%
162
+ - **Interview:** [Link to docs]
163
+ - **Started:** 2025-12-06
164
+ - **Blocked by:** None
165
+ - **Next:** Complete remaining tests
166
+
167
+ ### 📋 /api/v2/generate-html
168
+ - **Status:** Planned
169
+ - **Priority:** High
170
+ - **Dependencies:** None
171
+ - **Interview:** Not started
172
+ - **Estimated effort:** Medium
173
+ ```
174
+
175
+ ## Integration with Workflow
176
+
177
+ ### After Interview
178
+ ```bash
179
+ /api-interview generate-css
180
+ /api-status generate-css --phase=interview-complete
181
+ ```
182
+
183
+ ### After Research
184
+ ```bash
185
+ /api-research gemini-flash
186
+ /api-status generate-css --phase=research-complete
187
+ ```
188
+
189
+ ### After TDD Cycle
190
+ ```bash
191
+ /cycle generate CSS with Gemini
192
+ /api-status generate-css --complete
193
+ ```
194
+
195
+ ### Before Commit
196
+ ```bash
197
+ pnpm test:run
198
+ /api-status --all # Verify all green
199
+ /commit
200
+ ```
201
+
202
+ ## Automatic Updates
203
+
204
+ The `/api-create` command automatically updates status:
205
+ - Interview phase → "Interview Complete"
206
+ - Red phase → "Tests Written"
207
+ - Green phase → "Implementation Complete"
208
+ - Refactor phase → "Refactored"
209
+ - Documentation → "Documentation Updated"
210
+ - Commit → "Complete"
211
+
212
+ ## Status Phases
213
+
214
+ 1. **Not Started** - No work begun
215
+ 2. **Interview Complete** - Understanding documented
216
+ 3. **Research Complete** - External docs reviewed
217
+ 4. **Environment Ready** - API keys verified
218
+ 5. **Tests Written** - Red phase complete
219
+ 6. **Implementation Complete** - Green phase complete
220
+ 7. **Refactored** - Code cleaned up
221
+ 8. **Documentation Updated** - Manifests updated
222
+ 9. **Complete** - All tests passing, committed
223
+
224
+ ## Reports
225
+
226
+ ### Coverage Report
227
+ ```bash
228
+ /api-status --coverage
229
+ ```
230
+ Shows test coverage for all V2 endpoints.
231
+
232
+ ### Migration Report
233
+ ```bash
234
+ /api-status --migration
235
+ ```
236
+ Shows progress from legacy to V2.
237
+
238
+ ### Blockers Report
239
+ ```bash
240
+ /api-status --blocked
241
+ ```
242
+ Shows endpoints blocked by missing keys, dependencies, etc.
243
+
244
+ <claude-commands-template>
245
+ ## Status Management
246
+
247
+ - Update status after each phase completion
248
+ - Keep v2-api-implementation-status.md current
249
+ - Use status to plan next work
250
+ - Reference in standup/progress reports
251
+ - Track blockers and dependencies
252
+
253
+ ## Integration Points
254
+
255
+ - Used by /api-create to track progress
256
+ - Used by /commit to verify readiness
257
+ - Used by team to see what's done
258
+ - Used for planning future work
259
+ </claude-commands-template>
@@ -0,0 +1,97 @@
1
+ ---
2
+ description: Communicate AI-generated content with transparent attribution
3
+ argument-hint: <task-description>
4
+ ---
5
+
6
+ # AI-Attributed Communication Command
7
+
8
+ Execute the user's requested task (e.g., posting PR comments, GitHub issue comments, or other communications through various MCPs), but frame the output with clear AI attribution.
9
+
10
+ ## General Guidelines
11
+
12
+ ### Output Style
13
+
14
+ - **Never explicitly mention TDD** in code, comments, commits, PRs, or issues
15
+ - Write natural, descriptive code without meta-commentary about the development process
16
+ - The code should speak for itself - TDD is the process, not the product
17
+
18
+ ## Instructions
19
+
20
+ Arguments: $ARGUMENTS
21
+
22
+ **IMPORTANT Communication Format:**
23
+
24
+ 1. **Opening**: Begin with "*Beep boop, I am Claude Code 🤖, my user has reviewed and approved the following written by me:*"
25
+ - Use italics for this line
26
+ - Clearly establishes AI authorship
27
+
28
+ 2. **Middle**: Perform the requested task (post comment, create review, etc.)
29
+ - Execute whatever communication task the user requested
30
+ - Write the actual content that accomplishes the user's goal
31
+
32
+ 3. **Closing**: End with "*Beep boop, Claude Code 🤖 out!*"
33
+ - Use italics for this line
34
+ - Provides clear closure
35
+
36
+ ## Purpose
37
+
38
+ This command ensures transparency about AI usage while maintaining that the user has reviewed and approved the content. It prevents offloading review responsibility to other users while being open about AI assistance.
39
+
40
+ ## Examples
41
+
42
+ - Posting a GitHub PR review comment
43
+ - Adding a comment to a GitHub issue
44
+ - Responding to feedback with AI-generated explanations
45
+ - Any communication where AI attribution is valuable
46
+
47
+
48
+ ## 🛡 Project Rules (Injected into every command)
49
+
50
+ 1. **NO BROKEN BUILDS:**
51
+ - Run `pnpm test` before every `/commit`
52
+ - Ensure all tests pass
53
+ - Fix any type errors immediately
54
+
55
+ 2. **API DEVELOPMENT:**
56
+ - All new APIs MUST have Zod request/response schemas
57
+ - All APIs MUST be documented in both:
58
+ - OpenAPI spec ([src/lib/openapi/](src/lib/openapi/))
59
+ - API test manifest ([src/app/api-test/api-tests-manifest.json](src/app/api-test/api-tests-manifest.json))
60
+ - Test ALL parameters and edge cases
61
+ - Include code examples and real-world outputs
62
+
63
+ 3. **TDD WORKFLOW:**
64
+ - ALWAYS use /red → /green → /refactor cycle
65
+ - NEVER write implementation without failing test first
66
+ - Use /cycle for feature development
67
+ - Use characterization tests for refactoring
68
+
69
+ 4. **API KEY MANAGEMENT:**
70
+ - Support three loading methods:
71
+ - Server environment variables
72
+ - NEXT_PUBLIC_ variables (client-side)
73
+ - Custom headers (X-OpenAI-Key, X-Anthropic-Key, etc.)
74
+ - Never hardcode API keys
75
+ - Always validate key availability before use
76
+
77
+ 5. **COMPREHENSIVE TESTING:**
78
+ - When researching APIs, read actual implementation code
79
+ - Discover ALL possible parameters (not just documented ones)
80
+ - Test with various parameter combinations
81
+ - Document custom headers, query params, request/response schemas
82
+ - Include validation rules and testing notes
83
+
84
+ 6. **NO UI BLOAT:**
85
+ - This is an API project with minimal frontend
86
+ - Only keep necessary test/documentation interfaces
87
+ - Delete unused components immediately
88
+ - No unnecessary UI libraries or features
89
+
90
+ 7. **DOCUMENTATION:**
91
+ - If you change an API, you MUST update:
92
+ - OpenAPI spec
93
+ - api-tests-manifest.json
94
+ - Code examples
95
+ - Testing notes
96
+ - Document expected behavior and edge cases
97
+ - Include real-world output examples