global-error-handling
Implement robust error handling with user-friendly messages, specific exception types, centralized handling, and graceful degradation. Use this skill when adding try-catch blocks, error boundaries, or exception handling. When creating custom error types or exception classes. When deciding where to handle errors (controller vs. service layer). When writing user-facing error messages. When implementing retry logic with exponential backoff. When ensuring resources are cleaned up in finally blocks or equivalent patterns.
When & Why to Use This Skill
This Claude skill facilitates the implementation of robust, production-ready error handling frameworks. It focuses on creating resilient software architectures through centralized exception management, custom error hierarchies, and graceful degradation strategies. By adhering to these standards, developers can ensure system stability, improve maintainability, and provide clear, user-friendly feedback during application failures.
Use Cases
- Architecting centralized error handling middleware for API boundaries to ensure consistent and secure error responses.
- Designing custom exception classes to distinguish between recoverable business logic errors and critical system failures.
- Implementing resilient communication patterns, such as exponential backoff and retry logic, for unstable external service integrations.
- Refactoring legacy codebases to replace fragmented try-catch blocks with a unified global error handling strategy.
- Ensuring resource integrity and preventing memory leaks by implementing guaranteed cleanup patterns in complex asynchronous operations.
- Improving frontend/backend synchronization by mapping internal technical errors to actionable, user-facing messages.
| name | Global Error Handling |
|---|---|
| description | Implement robust error handling with user-friendly messages, specific exception types, centralized handling, and graceful degradation. Use this skill when adding try-catch blocks, error boundaries, or exception handling. When creating custom error types or exception classes. When deciding where to handle errors (controller vs. service layer). When writing user-facing error messages. When implementing retry logic with exponential backoff. When ensuring resources are cleaned up in finally blocks or equivalent patterns. |
When to use this skill:
- When adding try-catch blocks or error handling code
- When creating custom error or exception classes
- When deciding where to catch and handle errors
- When writing error messages that users will see
- When implementing centralized error handling at API boundaries
- When designing systems to degrade gracefully on failure
- When implementing retry strategies for external service calls
- When using exponential backoff for transient failures
- When ensuring resources (connections, file handles) are cleaned up
- When validating inputs and failing fast with clear messages
- When choosing between specific and generic exception types
- When reviewing code for proper error handling patterns
Global Error Handling
This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle global error handling.
Instructions
For details, refer to the information provided in this file: global error handling