error-handling

Standardize error handling with a unified taxonomy and central middleware.

4|Updated Mar 6, 2026
One-click install
npx skills add https://github.com/accolver/skill-maker --skill error-handling-accolver
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-handling
Source: https://github.com/accolver/skill-maker/tree/main/error-handling
Command: npx skills add https://github.com/accolver/skill-maker --skill error-handling-accolver

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Standardize error handling across a codebase by implementing a unified error taxonomy, stable error codes, proper propagation chains, and structured logging. The core principle: every error must be categorized, coded, wrapped with context, and split into a safe user-facing message and a detailed internal log entry.

Core Features & Use Cases

  • Establish error taxonomy mapping to HTTP status codes and provide a stable string code for programmatic matching.
  • Implement a base AppError class with code, message, statusCode, category, details, and cause, plus domain-specific subclasses (ValidationError, NotFoundError, AuthenticationError, AuthorizationError, ConflictError, RateLimitError, InternalError).
  • Centralize error propagation with a single middleware/handler that converts errors to consistent HTTP responses, logs full causal chains, and includes a requestId for tracing.
  • Enforce user-facing vs internal error separation, ensuring safe messages and stable codes in responses while logging full context internally.
  • Include a documented error response schema and an error code registry for cross-service interoperability.
  • Add structured logging fields such as code, message, category, correlationId, path, method, and stack.

Quick Start

Create a new error-handling skill by implementing the base AppError, several domain errors, and a centralized middleware, then integrate it with your API routes and logging.

Frequently Asked Questions about error-handling

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

FAQPage Schema
How do I standardize API error handling across microservices?

Standardize API error handling by implementing a unified error taxonomy with stable error codes, proper propagation chains, and centralized middleware that converts errors into consistent HTTP responses and structured internal logs.

What is an error taxonomy and how does it map to HTTP status codes?

An error taxonomy is a classification system mapping domain-specific errors like ValidationError or NotFoundError to HTTP status codes and stable string codes, enabling consistent API responses and programmatic error matching across services.

How do I separate user-facing API errors from internal stack traces and logs?

Separate user-facing API errors from internal logs by returning safe messages with stable codes in HTTP responses, while logging full causal chains, stack traces, and structured context fields like correlationId internally.

What's the best way to trace errors propagating through multiple API layers?

Trace errors propagating through API layers by wrapping them with context using exception chaining, attaching a unique requestId, and logging the full causal chain and structured fields like path and method in centralized middleware.

Does centralized error handling middleware work for existing API routes?

Centralized error handling middleware works for existing API routes by acting as a single error boundary that intercepts thrown errors, converts them to a standardized response schema, and logs structured details without altering route logic.