error-handling-patterns

Design error handling with exceptions, Result/Option types, retries, and circuit breakers.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you turn ad-hoc try/catch blocks into a consistent error-handling strategy that preserves context, enables recovery where possible, and makes failures easy to diagnose.

Core Features & Use Cases

  • Decision guide by failure type: Choose between exceptions, Result/Option types, and panic/abort based on whether failures are expected, recoverable, or programming invariants.
  • Core resilience patterns: Implement retry with exponential backoff, circuit breakers, error aggregation for batch operations, and graceful degradation with visibility.
  • Production-grade error shaping: Use typed exception hierarchies (or typed error models), narrow catches, preserve causal chains, and produce meaningful messages instead of generic “something broke” errors.

Quick Start

Use the error-handling-patterns skill to review and refactor your service’s current error flows and external-call handling for retries, circuit breaking, and context-preserving exception/result design.

Frequently Asked Questions about error-handling-patterns

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

FAQPage Schema
How do I design an error handling strategy that preserves context and enables recovery?

Design an error handling strategy by categorizing failures as recoverable or unrecoverable, then applying typed Result/Option outcomes or exception hierarchies with narrow catch boundaries to preserve causal chains and enable recovery.

When should I use typed Result types instead of exceptions for fault tolerance?

Use typed Result types for expected, recoverable failures where explicit handling is required, and use exceptions for unrecoverable errors or invariant violations, ensuring errors remain structured and matchable for clear fault tolerance.

How do I implement retries and circuit breakers for transient external dependency failures?

Implement retries with exponential backoff and circuit breakers to handle transient external dependency failures, applying graceful degradation and error aggregation to maintain visibility and prevent cascading system faults.

What is the best way to structure matchable errors for API service code?

Structure matchable errors for API service code by shaping typed exception hierarchies or typed error models, narrowing catch boundaries, and preserving causal chains to produce meaningful, context-rich diagnostic messages.

How do I handle partial failures in batch operations without losing error context?

Handle partial failures in batch operations through error aggregation, collecting and preserving context for each individual failure while applying graceful degradation to ensure the overall system remains observable and recoverable.

Can I use graceful degradation to keep services running when external dependencies partially fail?

Yes, implement graceful degradation with visibility to keep services running when external dependencies partially fail, combining it with circuit breakers and structured error handling to maintain system stability and observability.