error-responses

Implement centralized error models with codes, messages, and requestId for API endpoints.

13|2|Updated Jan 21, 2026
One-click install
npx skills add https://github.com/yanko-belov/code-craft --skill error-responses
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-responses
Source: https://github.com/yanko-belov/code-craft/tree/main/skills/error-responses
Command: npx skills add https://github.com/yanko-belov/code-craft --skill error-responses

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

APIs frequently reveal internal details through raw or inconsistent errors. This Skill enforces safe, structured, client-friendly error responses that protect internals and guide users.

Core Features & Use Cases

  • Centralized error model with machine-readable codes and human-friendly messages.
  • Consistent error payload structure across controllers, middlewares, and clients.
  • Use cases include validation failures, not-found resources, and internal server errors with safe payloads.

Quick Start

Implement a centralized error handler and error schema that standardizes responses. Provide a small example of a route returning a NotFound and a ValidationError in a safe format.

Frequently Asked Questions about error-responses

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

FAQPage Schema
How do I prevent API error responses from leaking internal details?

Implement a centralized error model that standardizes responses with safe, client-friendly payloads, using machine-readable codes and messages to protect internal details across controllers and middleware.

What is a structured API error response model?

A structured API error response model is a centralized schema that enforces consistent payloads across endpoints, combining error codes, human-friendly messages, optional details, and a requestId for traceability.

How do I return safe validation failures and not-found resources in an API?

Return safe validation failures and not-found resources by routing them through a centralized error schema that replaces raw errors with consistent, client-friendly payloads containing error codes and messages.

Does this approach to error handling work across controllers and middleware?

Yes, this error handling approach works across controllers and middleware by applying a centralized error model that enforces consistent payload structures for all client-facing API errors.

What is the best way to standardize API error payloads for traceability?

The best way to standardize API error payloads for traceability is to implement a centralized error model that includes a unique requestId alongside error codes and human-friendly messages in every response.