error-handling-standardizer

Implements consistent error handling with custom error classes, HTTP status mapping, and structured logging.

Updated Mar 16, 2026
One-click install
npx skills add https://github.com/zinohome/RTMessage --skill error-handling-standardizer-zinohome
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: error-handling-standardizer
Source: https://github.com/zinohome/RTMessage/tree/main/.github/skills/error-handling-standardizer
Command: npx skills add https://github.com/zinohome/RTMessage --skill error-handling-standardizer-zinohome

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires winston.

What problem does it solve? Inconsistent error handling across an application leads to leaked stack traces, unclear client messages, and debugging nightmares. This Skill standardizes how errors are defined, logged, and returned to clients. ## Core Features & Use Cases - Custom Error Taxonomy: Define AppError base classes with codes, HTTP status mapping, and operational vs programming error distinction. - Error Handler Middleware: Centralized Express middleware that logs errors with context and returns safe, structured JSON responses with trace IDs. - Structured Logging: Winston-based JSON logging with timestamps, stack traces, and contextual metadata. - Use Case: When building an Express API, apply this Skill to wrap async routes, map domain errors to HTTP status codes, and ensure clients never see internal stack traces. ## Quick Start Standardize the error handling in my Express application with custom error classes, middleware, and structured logging.

Frequently Asked Questions about error-handling-standardizer

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

FAQPage Schema
How do I create custom error classes in TypeScript?▼

Extend a base AppError class that captures a code, message, HTTP status code, and operational flag. Subclasses like ValidationError or NotFoundError then set fixed codes and statuses, keeping error creation consistent across the codebase.

How to handle async errors in Express routes?▼

Wrap async route handlers in an asyncHandler utility that forwards rejected promises to next(). This ensures all async errors reach the centralized error-handling middleware instead of crashing the process.

What is the difference between operational and programming errors?▼

Operational errors are expected conditions like validation failures or missing resources, marked with isOperational true and safe to expose. Programming errors are unexpected bugs, which should return a generic 500 message without internal details.

Should I expose stack traces to API clients?▼

No, never expose stack traces to clients. Return only safe operational error messages or a generic internal error message, and log full stack traces server-side with a trace ID for debugging.

How do I add structured logging to error handling?▼

Use Winston with JSON formatting, timestamps, and error stack support. Log errors with contextual metadata such as request path, method, user ID, and trace ID to make production debugging and monitoring effective.