api-error-handling

Implements error handling for REST and GraphQL endpoints with retries and circuit breaking.

Updated May 17, 2026
One-click install
npx skills add https://github.com/cenjie/skills --skill api-error-handling-cenjie
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-error-handling
Source: https://github.com/cenjie/skills/tree/main/skills/api-error-handling
Command: npx skills add https://github.com/cenjie/skills --skill api-error-handling-cenjie

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Build consistent, observable, and recoverable error handling for HTTP APIs so clients receive actionable error responses while services remain debuggable and resilient.

Core Features & Use Cases

  • Standardized Error Responses: Consistent JSON error shape with code, message, statusCode, requestId, traceId, timestamp, and optional details for field errors.
  • Observability & Monitoring: Structured logging, Sentry integration, and error-rate metrics with endpoints for exposing aggregated error stats.
  • Resilience Patterns: Retry strategies with exponential backoff and jitter, circuit breaker implementation, and async route wrappers to reduce boilerplate.
  • Validation & Guards: Input schema validation examples (Zod/Pydantic) and upstream response guards to prevent downstream failures.
  • Use Case: Apply these practices to a Node.js Express or Python Flask service to unify 4xx/5xx handling, enable tracing, and reduce incident noise.

Quick Start

Use the api-error-handling skill to add standardized error responses, structured logging, Sentry tracking, and retry/circuit-breaker patterns to your Node.js or Python API.

Frequently Asked Questions about api-error-handling

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

FAQPage Schema
How do I standardize API error responses in Node.js or Python?

To standardize API error responses, implement a consistent JSON error shape containing code, message, statusCode, requestId, traceId, timestamp, and optional field error details across your Node.js Express or Python Flask services.

What's the best way to add retry strategies and circuit breakers for HTTP APIs?

Add resilience to HTTP APIs by implementing retry strategies with exponential backoff and jitter, alongside circuit breaker patterns, to gracefully handle transient failures and prevent cascading downstream service crashes.

How does structured logging and Sentry integration improve API observability?

Structured logging and Sentry integration improve API observability by capturing standardized error data and exposing error-rate metrics, enabling endpoints that aggregate error stats for debugging and monitoring.

Can I use schema validation to guard against upstream API failures?

Yes, you can use input schema validation examples like Zod or Pydantic and upstream response guards to validate data formats, preventing downstream failures before they propagate through your HTTP service.

Does this API error handling approach work for both REST and GraphQL endpoints?

Yes, this API error handling approach applies across backend services, REST endpoints, and GraphQL endpoints to unify 4xx/5xx handling, enable request tracing, and reduce incident noise during production.