samber avatar

Golang Error Handling

Idiomatic Go error handling covering wrapping, inspection, the single handling rule, and production-grade slog and samber/oops logging.

skills.sh installs
45.9K
GitHub stars
3.9K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers error creation, %w wrapping, errors.Is/As/AsType/Join, custom and sentinel errors, and panic/recover design
  • Includes a single-handling rule that forbids logging and returning the same error, plus HTTP request logging middleware with slog
  • Enforces lowercase, punctuation-free error messages and low-cardinality log message templates for grouping in aggregation tools
  • Designed for Go services that need searchable production logs, with cross-references to dedicated samber/oops and slog handler skills

Install

$ npx -y skills add samber/cc-skills-golang --skill golang-error-handling -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

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.

Orchestration mode: Fan out the five category sub-agents described in the "Parallelizing Error Handling Audits" section (creation, wrapping, single-handling rule, panic/recover, structured logging) for auditing error handling across a large codebase, and consolidate their findings. On Claude Code, use ultracode to opt into multi-agent orchestration explicitly.

Modes:

Details

Repository
github.com/samber/cc-skills-golang
Categories
Go, Debugging
First seen
Apr 16, 2026

More from samber/cc-skills-golang

All 47

Similar to Golang Error Handling

More Go