error-handling-patterns

Implements circuit breakers, retry mechanisms, and error aggregation for Python, TypeScript, Rust, and Go.

2|1|Updated Sep 16, 2024
One-click install
npx skills add https://github.com/mvandermeulen/nvim --skill error-handling-patterns-mvandermeulen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-handling-patterns
Source: https://github.com/mvandermeulen/nvim/tree/main/.claude/skills/error-handling-patterns
Command: npx skills add https://github.com/mvandermeulen/nvim --skill error-handling-patterns-mvandermeulen

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This skill addresses the challenge of managing application failures gracefully, preventing cascading crashes, and ensuring that errors provide actionable debugging information rather than silent failures.

Core Features & Use Cases

  • Resilience Patterns: Implements circuit breakers, retry logic with exponential backoff, and error aggregation to handle distributed system failures.
  • Language-Specific Strategies: Provides idiomatic approaches for Python (exceptions/context managers), TypeScript (Result types/async handling), Rust (Result/Option), and Go (explicit error returns).
  • Use Case: Use this skill when designing a new microservice to ensure that external API timeouts are handled via a circuit breaker, or when refactoring legacy code to replace silent error swallowing with robust, type-safe error propagation.

Quick Start

Apply the error handling patterns skill to refactor the current module by implementing a custom exception hierarchy and adding a retry decorator to all external service calls.

Frequently Asked Questions about error-handling-patterns

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

FAQPage Schema
How do I implement a circuit breaker to prevent cascading failures in a microservice?

A circuit breaker prevents cascading failures by halting requests to failing services. This skill provides architectural guidance and scripts to implement circuit breakers, ensuring external API timeouts are managed gracefully without crashing your distributed system.

What is the best way to add retry logic with exponential backoff for external service calls?

Retry logic with exponential backoff recovers from transient failures by progressively delaying retries. This skill implements robust retry mechanisms for external service calls, replacing silent error swallowing with reliable fault-tolerant execution patterns.

How do I handle exceptions properly in Python and TypeScript to avoid silent failures?

Proper exception handling in Python and TypeScript prevents silent failures by enforcing error propagation. This skill provides idiomatic strategies like Python context managers and TypeScript Result types to ensure errors surface actionable debugging information.

Does this error handling approach work with Rust and Go fault tolerance patterns?

Yes, the error handling approach supports Rust and Go fault tolerance patterns. It provides idiomatic strategies for Rust using Result and Option types, and for Go using explicit error returns to manage recoverable and unrecoverable failures.

How do I refactor legacy code to stop swallowing errors and implement a custom exception hierarchy?

Refactoring legacy code to stop swallowing errors involves creating a custom exception hierarchy and applying type-safe error propagation. This skill provides quick start scripts to refactor modules, replacing silent failures with robust, aggregated error reporting.

When should I not use a circuit breaker for error handling in distributed systems?

A circuit breaker should not be used when failures are permanent or when system requirements demand immediate error propagation without delay. This skill distinguishes between recoverable and unrecoverable failures to guide appropriate fault-tolerance architecture.