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.
npx skills add majiayu000/claude-skill-registry --skill api-client-patterns-bpmstc-websiteagent --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# API Client Patterns ## Core Principles 1. **Single Responsibility** - One client per service 2. **Centralized Configuration** - Base URL, headers, timeouts in one place 3. **Comprehensive Error Handling** - Catch and transform errors appropriately 4. **Type Safety** - Define request/response interfaces 5. **Retry Logic** - Handle transient failures gracefully --- ## API Client Structure ### CORRECT: Well-Structured API Client ```javascript // client/src/utils/api.js import axios from 'axios'; // Configuration const API_BASE = import.meta.env.VITE_API_BASE || 'http://localhost:3001/api'; const TIMEOUT = 30000; // 30 seconds // Create axios instance with defaults const apiClient = axios.create({ baseURL: API_BASE, timeout: TIMEOUT, headers: { 'Content-Type': 'application/json' } }); // Request interceptor (optional - for auth, logging, etc.) apiClient.interceptors.request.use( (config) => { // Add auth token if available const token = localStorage.getItem('token'); if (token) { config.headers.Authorization = `Bearer ${token}`; } return config; }, (error) => Promise.reject(error) ); // Response interceptor (optional - for error transformation) apiClient.interceptors.response.use( (r
- Core Principles
- API Client Structure
- CORRECT: Well-Structured API Client
- WRONG: Scattered API Calls
- Error Handling Patterns
- CORRECT: Comprehensive Error Handling
- Component Error Handling
- Request Configuration Patterns
- With Timeout
- With Abort Controller (Cancellation)
- Streaming Responses Pattern
- Retry Logic Pattern
- File Upload Pattern
- With Progress Tracking
What does the api-client-patterns skill do?
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.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill api-client-patterns-bpmstc-websiteagent --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
