errors-and-status-codes

Design API error responses with RFC 9457 envelopes and status codes.

28|3|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/oborchers/fractional-cto --skill errors-and-status-codes
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: errors-and-status-codes
Source: https://github.com/oborchers/fractional-cto/tree/main/api-design-principles/skills/errors-and-status-codes
Command: npx skills add https://github.com/oborchers/fractional-cto --skill errors-and-status-codes

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the challenge of creating clear, consistent, and informative error responses for APIs, ensuring that developers integrating with your API can easily understand and handle issues.

Core Features & Use Cases

  • HTTP Status Code Selection: Provides guidance on choosing the most appropriate HTTP status code (2xx, 3xx, 4xx, 5xx) for various error scenarios.
  • Consistent Error Envelopes: Defines a standardized JSON structure for error responses, adhering to RFC 9457 Problem Details.
  • Per-Field Validation: Details how to return specific validation errors for individual fields within a request.
  • Use Case: When designing a new API endpoint, use this Skill to ensure all error responses follow best practices, including correct status codes, a well-defined error envelope, and actionable error messages, reducing integration friction for consumers.

Quick Start

Use the errors-and-status-codes skill to design a consistent error envelope for API responses.

Frequently Asked Questions about errors-and-status-codes

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is the difference between HTTP 400 and 422 status codes for API validation errors?

HTTP 400 indicates malformed syntax, while 422 signifies semantic validation errors. This Skill provides guidance on differentiating between 400 and 422 to ensure correct status code selection for API error responses.

How do I structure consistent API error responses using RFC 9457?

You structure API error responses using RFC 9457 Problem Details to create a standardized JSON envelope. This Skill defines a consistent error structure that helps developers integrating with your API easily understand and handle issues.

What is the difference between 401 and 403 HTTP status codes in API design?

HTTP 401 indicates missing or invalid authentication, whereas 403 means the authenticated user lacks permissions. This Skill covers best practices for 4xx error categorization, including differentiating between 401 and 403.

How do I return per-field validation errors in an API response?

You return per-field validation errors by detailing specific issues for individual fields within the request body. This Skill provides comprehensive guidance on incorporating these detailed validation errors into your API error responses.

When should I use 4xx versus 5xx HTTP status codes for API errors?

Use 4xx status codes for client errors and 5xx for server-side failures. This Skill covers best practices for 4xx and 5xx error categorization to help you choose the most appropriate code.

How do I add request and trace IDs to API error responses?

You add request and trace IDs to API error responses to improve debuggability and supportability. This Skill provides comprehensive guidance on incorporating these identifiers into your standardized error envelopes.