What problem does it solve?
Go's explicit error values require consistent patterns to make errors actionable, debuggable, and safe to handle across package boundaries. This skill codifies idiomatic practices for creating, wrapping, and inspecting errors so callers can reliably detect conditions and operators can diagnose issues.
Core Features & Use Cases
- Error decision flow: when to use simple errors, wrapping with context, sentinel vars, or custom types.
- Wrapping and chain preservation: guidance to always add context with %w when propagating errors unless intentionally hiding implementation details.
- Sentinel and typed errors: patterns for detectable sentinel vars and custom error types consumed via errors.Is and errors.As.
- Review and verification checklist: common anti-patterns to avoid such as log-and-return, == comparisons, and broken error chains.
- Use Case: review a PR or implement a library function to ensure errors are wrapped, named, and typed so higher layers can make control decisions and observability remains useful.
Quick Start
Use the go-error-handling skill to review a Go function and rewrite its error returns to add contextual wrapping with %w, replace direct comparisons with errors.Is/errors.As, and introduce sentinel or custom error types where callers need to detect specific conditions.