api-error-handling
Implements standardized API error responses with proper status codes, logging, and user-friendly messages. Use when building production APIs, implementing error recovery patterns, or integrating error monitoring services.
npx skills add majiayu000/claude-skill-registry --skill api-error-handling --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 Error Handling Implement robust error handling with standardized responses and proper logging. ## Standard Error Response Format ```json { "error": { "code": "VALIDATION_ERROR", "message": "Invalid request parameters", "status": 400, "requestId": "req_abc123", "timestamp": "2025-01-15T10:30:00Z", "details": [ { "field": "email", "message": "Invalid email format" } ] } } ``` ## Error Class (Node.js) ```javascript class ApiError extends Error { constructor(code, message, status = 500, details = null) { super(message); this.code = code; this.status = status; this.details = details; } static badRequest(message, details) { return new ApiError('BAD_REQUEST', message, 400, details); } static notFound(resource) { return new ApiError('NOT_FOUND', `${resource} not found`, 404); } static unauthorized() { return new ApiError('UNAUTHORIZED', 'Authentication required', 401); } } // Global error handler app.use((err, req, res, next) => { const status = err.status || 500; const response = { error: { code: err.code || 'INTERNAL_ERROR', message: status === 500 ? 'Internal server error' : err.message, status, requestId: req.id } }; if (err.details) response.error.details = err.details; if (stat
- Standard Error Response Format
- Error Class (Node.js)
- Circuit Breaker Pattern
- Additional Implementations
- Best Practices
What does the api-error-handling skill do?
Implements standardized API error responses with proper status codes, logging, and user-friendly messages. Use when building production APIs, implementing error recovery patterns, or integrating error monitoring services.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill api-error-handling --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.
