api-integration
SKILL.md
API Integration Skill
Purpose
Expert knowledge in building robust API clients with proper error handling, rate limiting, authentication, and retry logic.
Core Principles
- Resilience - Handle failures gracefully
- Rate Limiting - Respect API limits
- Retry Logic - Exponential backoff
- Circuit Breaker - Fail fast when needed
- Security - Secure credential storage
Enforces
- REST/GraphQL client patterns
- Rate limiting and throttling
- Retry logic with exponential backoff
- Circuit breaker pattern
- Error handling and recovery
- Authentication (OAuth, API keys, JWT)
- Request/response logging
- Timeout configuration
API Client Pattern
class APIClient {
constructor(config) {
this.baseUrl = config.baseUrl;
this.timeout = config.timeout || 30000;
this.retries = config.retries || 3;
this.circuitBreaker = new CircuitBreaker();
}
async request(endpoint, options = {}) {
if (this.circuitBreaker.isOpen()) {
throw new Error('Circuit breaker open');
}
for (let attempt = 1; attempt <= this.retries; attempt++) {
try {
const response = await fetch(
`${this.baseUrl}${endpoint}`,
{ ...options, timeout: this.timeout }
);
if (!response.ok) {
throw new APIError(response.status, response.statusText);
}
this.circuitBreaker.recordSuccess();
return await response.json();
} catch (error) {
if (attempt === this.retries) {
this.circuitBreaker.recordFailure();
throw error;
}
await this.delay(1000 * Math.pow(2, attempt));
}
}
}
}
When to Use
- Building API clients
- Integrating external services
- Handling API failures
- Rate limit management
- Authentication implementation
References
Version: 1.0 | Last Updated: 2026-02-06 | Category: Development & Operations
Weekly Installs
2
Repository
hack23/riksdagsmonitorGitHub Stars
2
First Seen
12 days ago
Security Audits
Installed on
amp2
cline2
opencode2
cursor2
kimi-cli2
codex2