error-handling

Designs structured error types, response formats, logging patterns, and monitoring for applications.

1|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts --skill error-handling-kalilurrahman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-handling
Source: https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts/tree/main/01-software-dev/error-handling
Command: npx skills add https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts --skill error-handling-kalilurrahman

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Applications often handle errors inconsistently, leaking stack traces to users, logging without context, and returning vague messages that make debugging production issues painful. This Skill produces a complete error handling strategy with categorized error types, consistent response formats, and actionable logging. ## Core Features & Use Cases - Error Type Hierarchy: Defines categorized error classes (client, server, business logic, infrastructure, timeout, unexpected) with unique codes and HTTP status mappings. - Consistent Response Format: Generates a standard JSON error structure with codes, messages, request IDs, and details across all endpoints. - Logging & Monitoring Strategy: Specifies structured logging with request correlation, log levels per error category, and error-rate alerting rules. - Use Case: When building a REST API in Express or Django, use this Skill to produce the full error handling layer—exception classes, middleware, user-friendly message mapping, and Prometheus alert queries—instead of scattering try/catch blocks ad hoc. ## Quick Start Ask the AI to design a complete error handling strategy for your application, specifying your language and framework such as Python with FastAPI or JavaScript with Express.

Frequently Asked Questions about error-handling

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

FAQPage Schema
How do I design a consistent API error response format?

Use a standard JSON structure with a machine-readable code, human-readable message, request_id for log correlation, timestamp, and optional details object. Apply the same format across all endpoints so clients can parse errors predictably.

How to structure custom exception classes in Python?

Create a base AppError class carrying message, code, http_status, and details, then subclass it for each category like ValidationError, NotFoundError, and DatabaseError. Each subclass sets its own error code and HTTP status so handlers stay generic.

Should 4xx client errors be logged as ERROR level?

No. Client errors (4xx) represent expected behavior and should be logged at INFO level, while server errors (5xx) indicate failures requiring investigation and belong at ERROR level. This keeps error alerts actionable.

How do I handle third-party API failures like Stripe timeouts?

Wrap calls with explicit timeouts, catch timeout and HTTP exceptions separately, and re-raise them as a typed ExternalServiceError with the service name in details. Log the failure with context and make the operation retryable with exponential backoff.

Why should error responses never expose stack traces?

Stack traces leak internal implementation details that attackers can exploit and confuse end users. Return a generic INTERNAL_SERVER_ERROR message with a request_id instead, and keep the full stack trace only in server-side logs.