error-handling-patterns

Implement exceptions, result types, retries, and circuit breakers in Python and TypeScript.

1|Updated Nov 23, 2025
One-click install
npx skills add https://github.com/zmre/nix-pai --skill error-handling-patterns-zmre
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-handling-patterns
Source: https://github.com/zmre/nix-pai/tree/main/claude/skills/developer-essentials/error-handling-patterns
Command: npx skills add https://github.com/zmre/nix-pai --skill error-handling-patterns-zmre

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Poor error handling can lead to application crashes, data corruption, and a frustrating user experience. This skill provides effective patterns for implementing graceful degradation, centralized logging, and user-friendly error messages, significantly improving your application's reliability.

Core Features & Use Cases

  • Graceful Degradation: Strategies for handling errors without crashing the entire application, ensuring continuity.
  • Centralized Logging: Best practices for collecting and analyzing error logs efficiently, simplifying debugging.
  • User-Friendly Messages: Guidance on crafting clear and helpful error messages for end-users, improving UX.
  • Use Case: Your application occasionally encounters unexpected API errors. Use this skill to design an error handling strategy that catches these errors, logs them centrally, and presents a polite, actionable message to the user instead of a technical error page.

Quick Start

Use the error-handling-patterns skill to design an error handling strategy for a critical API endpoint in a web application.

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 error handling to prevent application crashes?

Error handling prevents crashes by catching exceptions, categorizing them as recoverable or unrecoverable, and executing appropriate recovery logic. Implement try-catch blocks, use result types to encapsulate success or failure, and apply retry strategies for transient failures to maintain application stability.

What's the best way to design centralized logging for errors?

Centralized logging collects all error events in one location for analysis and debugging. Standardize error messages with context (timestamp, stack trace, user ID), route logs to a central system, and structure them consistently across your application to simplify root-cause analysis.

How do I handle API errors gracefully without crashing the app?

Graceful degradation handles API errors by catching them, logging details, and returning a user-friendly message instead of exposing technical errors. Use circuit-breaker patterns to stop retrying failed services, apply exponential backoff for transient failures, and degrade functionality rather than fail entirely.

When should I use exception handling versus result types?

Exceptions suit unexpected or unrecoverable errors; result types (return objects with success/failure states) suit expected outcomes like invalid input. Combine both: use exceptions for programming errors and system failures, result types for predictable validation and business logic failures.

Can I apply these error handling patterns across Python and TypeScript projects?

Yes, error handling patterns are language-agnostic principles. This skill provides concrete code examples in both Python and TypeScript, demonstrating how to implement exceptions, retry strategies, and circuit-breaker patterns with each language's native syntax and libraries.

What's a circuit-breaker pattern and why do I need it?

A circuit-breaker pattern prevents cascading failures by stopping requests to a failing service after repeated errors, then gradually retrying. It reduces load on struggling systems, improves user experience by failing fast, and protects dependent services from resource exhaustion.