api-client
REST API client builder with authentication, error handling, retry logic, and request management. Supports OAuth, JWT, API keys. Use when building API integrations, creating API clients, or working with REST services.
Best use case
api-client is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
REST API client builder with authentication, error handling, retry logic, and request management. Supports OAuth, JWT, API keys. Use when building API integrations, creating API clients, or working with REST services.
Teams using api-client should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/api-client/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How api-client Compares
| Feature / Agent | api-client | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
REST API client builder with authentication, error handling, retry logic, and request management. Supports OAuth, JWT, API keys. Use when building API integrations, creating API clients, or working with REST services.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# API Client Builder
## Overview
Build robust REST API clients with authentication, comprehensive error handling, automatic retries, and request/response management.
## Quick Start
### Basic API Client
```javascript
const client = new APIClient({
baseURL: 'https://api.example.com',
apiKey: process.env.API_KEY
});
const response = await client.get('/users');
console.log(response.data);
```
## Features
- ✓ Multiple authentication methods (API key, OAuth, JWT)
- ✓ Automatic retry with exponential backoff
- ✓ Request/response logging
- ✓ Error classification and handling
- ✓ Rate limiting support
- ✓ Request timeout configuration
## Workflow
### Step 1: Configure Client
Create client with base configuration:
```javascript
const client = new APIClient({
baseURL: 'https://api.example.com',
timeout: 5000,
retries: 3
});
```
### Step 2: Add Authentication
See [references/authentication-guide.md](references/authentication-guide.md) for all methods.
**API Key**:
```javascript
client.setAuth({
type: 'apiKey',
key: process.env.API_KEY
});
```
**OAuth 2.0**:
```javascript
client.setAuth({
type: 'oauth',
clientId: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET
});
```
### Step 3: Make Requests
```javascript
// GET request
const users = await client.get('/users');
// POST request
const newUser = await client.post('/users', {
name: 'John Doe',
email: 'john@example.com'
});
// PUT request
const updated = await client.put('/users/123', {
name: 'Jane Doe'
});
// DELETE request
await client.delete('/users/123');
```
### Step 4: Handle Errors
```javascript
try {
const response = await client.get('/users');
console.log(response.data);
} catch (error) {
if (error.status === 401) {
console.error('Authentication failed');
} else if (error.status === 429) {
console.error('Rate limit exceeded');
} else {
console.error('Request failed:', error.message);
}
}
```
## Configuration
### Complete Configuration Options
```javascript
const client = new APIClient({
// Base configuration
baseURL: 'https://api.example.com',
timeout: 5000, // Request timeout (ms)
// Retry configuration
retries: 3, // Number of retries
retryDelay: 1000, // Initial retry delay (ms)
retryMult iplier: 2, // Exponential backoff multiplier
// Authentication (see references/authentication-guide.md)
auth: {
type: 'apiKey',
key: process.env.API_KEY
},
// Headers
headers: {
'Content-Type': 'application/json',
'Custom-Header': 'value'
},
// Logging
logging: true, // Enable request/response logging
logLevel: 'info' // debug, info, warn, error
});
```
See [templates/api-config-template.json](templates/api-config-template.json) for complete configuration template.
## Authentication Methods
### Method 1: API Key
```javascript
client.setAuth({
type: 'apiKey',
key: process.env.API_KEY,
header: 'X-API-Key' // Optional, default: 'Authorization'
});
```
### Method 2: OAuth 2.0
See [references/authentication-guide.md#oauth](references/authentication-guide.md#oauth) for complete OAuth flow.
### Method 3: JWT
See [references/authentication-guide.md#jwt](references/authentication-guide.md#jwt) for JWT implementation.
## Error Handling
### Error Classification
Errors are classified into categories for appropriate handling:
| Status Code | Category | Retry? | Action |
|-------------|----------|--------|--------|
| 400 | Client Error | No | Fix request |
| 401 | Auth Error | No | Refresh token |
| 403 | Permission | No | Check permissions |
| 404 | Not Found | No | Check endpoint |
| 429 | Rate Limit | Yes | Wait and retry |
| 500 | Server Error | Yes | Retry |
| 503 | Unavailable | Yes | Retry |
See [references/error-handling.md](references/error-handling.md) for complete error handling strategies.
## Validation
Validate API configuration before using:
```bash
python scripts/validate-config.py config.json
```
## Templates
Copy templates from `templates/` directory:
- `api-config-template.json` - Complete configuration
- `error-handler-template.js` - Error handling code
- `retry-logic-template.js` - Retry implementation
## References
- [Authentication Guide](references/authentication-guide.md) - All auth methods
- [Error Handling](references/error-handling.md) - Comprehensive error strategies
- [Rate Limiting](references/rate-limiting.md) - Handle rate limits
- [Testing](references/testing-apis.md) - Test API clients
---
**Version**: 1.0
**Last Updated**: October 25, 2025
**Example Type**: Complex skill (full structure)Related Skills
ai-generation-client
External AI API integration with retry logic, rate limiting, content safety detection, and multi-turn conversation support for image generation.
apollo-client-patterns
Use when implementing Apollo Client patterns for queries, mutations, cache management, and local state in React applications.
api-client-patterns
HTTP client patterns, API integration, request/response handling, error handling, retry logic, axios usage. Use when building API clients, integrating external services, handling API errors, or making HTTP requests.
api-client-development
Creating API clients with OpenAPI specs, authentication, and OAuth scopes for SCAPI and similar APIs
bgo
Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.
moai-lang-r
R 4.4+ best practices with testthat 3.2, lintr 3.2, and data analysis patterns.
moai-lang-python
Python 3.13+ development specialist covering FastAPI, Django, async patterns, data science, testing with pytest, and modern Python features. Use when developing Python APIs, web applications, data pipelines, or writing tests.
moai-icons-vector
Vector icon libraries ecosystem guide covering 10+ major libraries with 200K+ icons, including React Icons (35K+), Lucide (1000+), Tabler Icons (5900+), Iconify (200K+), Heroicons, Phosphor, and Radix Icons with implementation patterns, decision trees, and best practices.
moai-foundation-trust
Complete TRUST 4 principles guide covering Test First, Readable, Unified, Secured. Validation methods, enterprise quality gates, metrics, and November 2025 standards. Enterprise v4.0 with 50+ software quality standards references.
moai-foundation-memory
Persistent memory across sessions using MCP Memory Server for user preferences, project context, and learned patterns
moai-foundation-core
MoAI-ADK's foundational principles - TRUST 5, SPEC-First TDD, delegation patterns, token optimization, progressive disclosure, modular architecture, agent catalog, command reference, and execution rules for building AI-powered development workflows
moai-cc-claude-md
Authoring CLAUDE.md Project Instructions. Design project-specific AI guidance, document workflows, define architecture patterns. Use when creating CLAUDE.md files for projects, documenting team standards, or establishing AI collaboration guidelines.