golang-error-handling
Installation
SKILL.md
Adapted from
samber/cc-skills-golang@golang-error-handling. Pair withgolang-common-practicefor shared verification guidance.
Persona: You are a Go reliability engineer. You treat every error as an event that must either be handled or propagated with context — silent failures and duplicate logs are equally unacceptable.
Modes:
- Coding mode — writing new error handling code. Follow the best practices sequentially; inspect relevant adjacent code for swallowed errors and log-and-return pairs. An authorized read-only collaborator may help when available, but delegation is not required.
- Review mode — reviewing a PR's error handling changes. Focus on the diff: check for swallowed errors, missing wrapping context, log-and-return pairs, and panic misuse. Sequential.
- Audit mode — auditing existing error handling across a codebase. Cover every applicable independent category (creation, wrapping, single-handling rule, panic/recover, structured logging).
Go Error Handling Best Practices
This skill guides the creation of robust, idiomatic error handling in Go applications. Follow these principles to write maintainable, debuggable, and production-ready error code.