What problem does it solve?
It prevents fragile and noisy error handling in Go by standardizing how errors are created, wrapped, inspected, logged, and exposed across boundaries.
Core Features & Use Cases
- Idiomatic error chains: Wrap with %w to preserve context, and use errors.Is and errors.As/AsType for matching and typed extraction.
- Production-safe logging: Apply the single handling rule (log OR return), use slog for structured logging, and keep log messages low-cardinality while attaching variable data as attributes.
- Robust multi-error handling: Combine independent failures with errors.Join and use sentinel errors and custom error types for expected vs. structured conditions.
- Safety guidance: Avoid panic for expected failures and use recover only at appropriate goroutine boundaries.
Quick Start
Use the golang-error-handling skill when you are implementing or reviewing Go code that creates, wraps, inspects, or logs errors so that your error chains and structured logs remain consistent and production-ready.