Skill
API Error Responses
Defines one error format with stable machine codes and problem details, then applies it to every endpoint so clients can handle failures reliably.
1One error shape, one place that produces it.
2Steps
31. Inventory first. Grep for every place that builds an error response (`res.status(4`, `raise HTTPException`, `ResponseEntity.badRequest`, exception handlers). List the distinct shapes you find.
42. Define the envelope, based on RFC 9457: `type` (a stable URL or slug), `title`, `status`, `detail`, `instance` (the request id), plus `code` (SCREAMING_SNAKE, stable forever) and, for validation, `errors: [{ field, code, message }]`.
53. Build one error class and one global handler. Domain code throws typed errors; only the handler touches status codes and serialization. Set `Content-Type: application/problem+json`.
Claude CodeCodex
API Error Responses
SkillBackend and APIs
Free