rust-error-handling
Installation
SKILL.md
Rust Error Handling
Skill Resources
- Activation and cross-agent notes: references/activation.md
Rust's error handling requires deliberate design decisions that compound across a codebase. The wrong choice at a module boundary forces changes across every caller. This skill covers the architecture decisions, not just the syntax.
The Core Boundary: thiserror vs anyhow
The single most important decision: are you writing library code or application code?
| Concern | Library (thiserror) |
Application (anyhow) |
|---|---|---|
| Callers programmatically match errors | Yes | No |
| Error types are part of the public API | Yes | No |
| Ergonomics of error propagation | Verbose | Ergonomic (? just works) |
| Error context chain | Manual | context() / with_context() |
| When to use | src/services/*, any reusable module |
src/handlers/*, main.rs, scripts |