home / skills / tlabs-xyz / tbtc-v2-performance / global-error-handling
/.claude/skills/global-error-handling
This skill guides you to implement robust error handling across code, API boundaries, and user-facing messages with fail-fast and graceful degradation.
npx playbooks add skill tlabs-xyz/tbtc-v2-performance --skill global-error-handlingReview the files below or copy the command above to add this skill to your agents.
---
name: Global Error Handling
description: Implement robust error handling with user-friendly messages, specific exception types, fail-fast validation, centralized error boundaries, and graceful degradation. Use this skill when implementing try-catch blocks, throwing or catching exceptions, creating custom error classes or types, implementing error boundaries or middleware, validating input and checking preconditions, implementing retry logic with exponential backoff, handling external service failures, cleaning up resources in finally blocks, creating user-facing error messages, implementing centralized error handling at API boundaries, or designing systems for graceful degradation. Use across all programming languages when implementing error handling logic in any code file.
---
## When to use this skill
- When implementing try-catch blocks or error handling logic
- When throwing or catching exceptions or errors
- When creating custom error classes, types, or error hierarchies
- When implementing error boundaries, middleware, or centralized error handlers
- When validating input and checking preconditions (fail-fast approach)
- When implementing retry logic with exponential backoff for external services
- When handling failures from external APIs, databases, or third-party services
- When cleaning up resources (file handles, connections, locks) in finally blocks or equivalent
- When creating user-facing error messages that are clear and actionable
- When implementing error handling at API boundaries or controller layers
- When designing systems for graceful degradation when non-critical services fail
- When preventing exposure of technical details or security information in errors
- When working with error handling in any programming language or framework
# 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](../../../agent-os/standards/global/error-handling.md)
This skill teaches how to implement robust, centralized error handling across services and codebases. It focuses on user-friendly messages, specific exception types, fail-fast validation, centralized boundaries, and graceful degradation to keep systems reliable and secure. Use it to standardize try/catch patterns, custom errors, and recovery strategies across languages and frameworks.
The skill inspects places where errors can originate (input validation, external calls, resource management) and recommends concrete patterns: fail-fast checks, meaningful custom error classes, centralized handlers or middleware, and finally/finalizers for cleanup. It favors clear, actionable messages for users while preventing leakage of technical or sensitive details. It also prescribes retry strategies (with exponential backoff) and escalation when failures persist.
How should I balance logging and user privacy?
Log detailed diagnostics (stack traces, timestamps, correlated IDs) to secure systems, but return only concise, non-sensitive messages to users.
When should I retry a failed external call?
Retry for transient errors (network timeouts, rate limits) with exponential backoff and jitter; avoid retrying for permanent failures (authentication, bad requests).