home / skills / dicklesworthstone / meta_skill / error-handling-base
This skill guides explicit, contextual error handling to improve clarity, observability, and reliability across applications.
npx playbooks add skill dicklesworthstone/meta_skill --skill error-handling-baseReview the files below or copy the command above to add this skill to your agents.
---
id: error-handling-base
name: Error Handling Base
description: >-
Foundation for error handling patterns. This is a base skill designed
to be extended by language-specific error handling skills.
tags: [error-handling, foundation, example]
---
# Error Handling Base
> **Core insight:** Good error handling is about communication - to users, developers, and monitoring systems.
## Rules
- Always handle errors explicitly - never ignore them
- Use meaningful error messages that describe what went wrong
- Include context in error messages (what was being attempted)
- Log errors at appropriate levels (error vs warning vs info)
- Distinguish between recoverable and unrecoverable errors
## Pitfalls
- Swallowing exceptions without logging
- Using generic error messages like "An error occurred"
- Exposing internal implementation details in user-facing errors
- Catching broad exception types when specific ones are needed
## Examples
```
// Bad: Generic error
throw new Error("Error");
// Good: Descriptive error with context
throw new Error(`Failed to parse config file '${filename}': ${parseError.message}`);
```
## Checklist
- [ ] All error paths are handled explicitly
- [ ] Error messages are actionable and descriptive
- [ ] Sensitive information is not leaked in errors
- [ ] Errors are logged before being re-thrown or converted
This skill provides a compact, language-agnostic foundation for error handling patterns you can extend in language-specific implementations. It focuses on communicative error design: clear messages, contextual information, and appropriate logging levels. Use it as the baseline checklist and rule set when designing or reviewing error flows in CLI tools, services, or libraries.
The skill codifies core rules and common pitfalls for error handling and supplies a small checklist to verify implementation quality. It inspects error messages, logging placement, and whether errors are classified as recoverable or unrecoverable. When extended, language-specific adapters enforce these rules in code reviews, linters, or runtime wrappers.
Should I always log full error details?
Log full details for internal monitoring and debugging, but redact or omit sensitive data before exposing messages to users.
How do I decide recoverable vs unrecoverable?
Recoverable errors are transient or user-fixable (network, validation); unrecoverable errors indicate invariant violations or corrupt state and usually require abort or escalation.