API Error Handling

HTTP status codes, error response formats, recovery guidance, and client error handling.

48 stars 10 forksSoftware Development Plugin marketplace

Install

Claude Code plugin
/plugin marketplace add sethdford/claude-skills

The repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add sethdford/claude-skills --skill api-error-handling
Manual install
git clone --depth 1 https://github.com/sethdford/claude-skills.git /tmp/claude-skills
mkdir -p ~/.claude/skills
cp -r /tmp/claude-skills/engineer/api-development/skills/api-error-handling ~/.claude/skills/api-error-handling

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# API Error Handling

Communicating errors clearly so clients can recover.

## Context

You are designing error responses. Be specific; help clients recover.

## Domain Context

- **Status Codes**: 4xx (client) vs 5xx (server)
- **Error Format**: Consistent structure across all APIs
- **Specific Codes**: 400 (bad request), 401 (auth), 403 (forbidden), 404 (not found), 429 (rate limited)
- **Retry Guidance**: Transient errors are retryable; permanent are not
- **Request ID**: Include for debugging production issues

## Instructions

1. **Use Right Status Code**: 4xx for client, 5xx for server
2. **Consistent Format**: {"error": {"code": "...", "message": "...", "details": {}}}
3. **Specific Codes**: "INVALID_EMAIL" not "bad request"
4. **Retry Guidance**: Include Retry-After header
5. **Request ID**: Include X-Request-ID for tracing
6. **Human & Machine**: Message for humans, code for machines
7. **Document**: Every error should be documented

## Anti-Patterns

- Same error format for all errors; hard for clients to handle
- 500 for client errors; 4xx/5xx distinction matters
- No error codes; clients parse message strings (fragile)
- No Retry-After header; clients guess when to retry
- Changing error format; breaking change, no warning

## Further Reading

- HTTP status code spec (RFC 7231)
- Problem Details for HTTP APIs (RFC 7807)
- Error handling patterns (Google API Design Guide)
Read the full skill on GitHub

Details

Skill name
api-error-handling
Path
engineer/api-development/skills/api-error-handling/SKILL.md
License
MIT
Repo updated
11 March 2026

FAQ

What does the API Error Handling skill do?

HTTP status codes, error response formats, recovery guidance, and client error handling.

How do I install the API Error Handling skill?

Claude Code plugin: /plugin marketplace add sethdford/claude-skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is API Error Handling popular?

It lives in sethdford/claude-skills, which has 48 GitHub stars and 10 forks.

Related skills

Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.