structured-errors
CommunityDeliver clear, traceable error responses.
Software Engineering#error handling#API design#FastAPI#traceability#exception handling#request ID#JSON errors#structured errors
Authorricardoroche
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill enforces consistent, structured JSON error responses in APIs and tools, addressing issues like vague error messages, lack of traceability, and accidental exposure of sensitive data. It improves the developer experience for API consumers and simplifies debugging by providing clear, actionable error information.
Core Features & Use Cases
- Consistent Structure: Defines a mandatory structure for all error responses, including
error,request_id,timestamp, andstatus_code. - Custom Exception Classes: Guides on creating custom exception classes (
APIError,NotFoundError) that automatically generate structured error responses. - FastAPI Integration: Provides patterns for integrating structured error handling with FastAPI, including global exception handlers.
- Security & Logging: Emphasizes never exposing sensitive data in errors and logging full error details internally for debugging.
- Use Case: An API endpoint fails to find a user. Instead of returning a plain "User not found" string, this skill helps the developer return a structured JSON response with a unique
request_idfor tracing, a timestamp, and specific details about the missing user, making it easier for client applications to handle the error.
Quick Start
Create a helper function create_error_response that returns a structured JSON error including error, request_id, timestamp, and status_code.
Dependency Matrix
Required Modules
fastapipydantic
Components
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: structured-errors Download link: https://github.com/ricardoroche/ricardos-claude-code/archive/main.zip#structured-errors Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.