Agent skill
api-client-generator
Use when creating REST API clients, SDK wrappers, or HTTP service integrations. Generates type-safe client code with retry logic, error handling, rate limiting, and comprehensive tests. Triggered by requests to integrate external APIs, build SDK clients, or create service wrappers.
Install this agent skill to your Project
npx add-skill https://github.com/blurphanatic/claude-skills/tree/main/example-bundled-skill
SKILL.md
API Client Generator
Overview
Generates production-ready API clients with type safety, error handling, and testing.
When to use:
- User asks to integrate with an external API
- Building SDK wrapper for a service
- Creating typed HTTP client
- Implementing service-to-service communication
Announce: "I'm using the api-client-generator skill to create a type-safe API client"
Process
Step 1: Analyze API Specification
Check for API documentation:
# Look for OpenAPI/Swagger spec
find . -name "*.yaml" -o -name "*.yml" | grep -E "(openapi|swagger)"
# Check for API docs
ls -la docs/api/ 2>/dev/null
If OpenAPI spec exists, use scripts/parse-openapi.sh to generate types.
Step 2: Generate Client Structure
Use the template generator:
scripts/generate-client.sh <service-name> <language>
This creates:
- Client class with configuration
- Request/response types
- Error handling
- Retry logic
- Rate limiting
Step 3: Implement Methods
For each API endpoint:
- Define request/response types
- Add method to client class
- Include error handling
- Add retry logic if idempotent
- Write unit test
Example from template:
async getUser(id: string): Promise<User> {
return this.request<User>({
method: 'GET',
path: `/users/${id}`,
retryable: true,
timeout: 5000
});
}
Step 4: Add Integration Tests
Use templates/integration-test.tpl to create tests:
templates/apply-template.sh integration-test.tpl > tests/integration.test.ts
Step 5: Generate Documentation
scripts/generate-docs.sh > API_CLIENT.md
Validation
- All endpoints have type-safe methods
- Error responses are properly typed
- Retry logic only on idempotent operations
- Rate limiting is configurable
- Authentication is properly handled
- Tests achieve >80% coverage
- Documentation includes all examples
Common Issues
Issue: Rate limit errors
- Solution: Implement exponential backoff with jitter
Issue: Type mismatches
- Solution: Regenerate from latest API spec
Issue: Network timeouts
- Solution: Make timeout configurable per endpoint
Resources
scripts/parse-openapi.sh- Parse OpenAPI spec to TypeScript/Python typesscripts/generate-client.sh- Generate client boilerplatescripts/generate-docs.sh- Create markdown documentationtemplates/client-class.tpl- Base client class templatetemplates/integration-test.tpl- Integration test templatereference/best-practices.md- API client best practices
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
presentation-transformation
Use when transforming presentations from basic to professional quality - employs parallel multi-agent execution, research-driven design, and McKinsey/BCG/Deloitte best practices to create executive-ready decks
skill-lifecycle-manager
Use when creating, testing, iterating, or managing Claude Code skills. Handles skill scaffolding, git versioning, symlink management, auto-discovery testing, and quality assurance. Triggered by requests to create new skills, improve existing skills, test skill loading, or manage skill infrastructure.
edit-article
Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
handoff
Compact the current conversation into a handoff document for another agent to pick up.
obsidian-vault
Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian.
setup-pre-commit
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.
Didn't find tool you were looking for?