anyhow-best-practices
Installation
SKILL.md
anyhow best practices
Use when handling application-level Rust errors with anyhow.
Mental model
anyhowis for ergonomic error propagation and context in binaries, services, tools, and top-level application code.- Prefer
anyhowwhere callers do not need a rich typed error API and where operator-facing context matters more than variant matching. - Treat
anyhowas an application-boundary tool, not as a substitute for well-designed library error types.
Where to use it
- Use
anyhow::Resultin binaries, command handlers, integration layers, and glue code. - Add context at boundaries where a lower-level error alone would be ambiguous.
- Prefer typed errors in reusable libraries or domain layers, then convert into
anyhowat the application edge if needed.