samber avatar

Golang Error Handling

A comprehensive guide to production-grade error handling in Go that enforces the "handle once" rule: log or return, never both. It covers the full stack from sentinel errors and custom types to wrapping with %w, inspection with errors.Is/As, and structured logging with slog. The standout bit is the emphasis on low-cardinality error messages,keeping variable data out of error strings and into structured attributes so your APM tools can actually group errors instead of exploding into thousands of unique entries. Includes samber/oops for rich production errors with stack traces and context, plus parallel audit modes for reviewing large codebases. If you've ever debugged a mess of duplicate logs or ungroupable Sentry errors, this will resonate.

install copies · 90 days. Times the install command was copied on this site in the last 90 days, bots filtered.
7
skills.sh installs
45.3K
GitHub stars
3.8K
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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:

Sponsors

Details

Repository
github.com/samber/cc-skills-golang
Categories
Backend & APIs, DevOps & CI/CD, Debugging, Go
First seen
Apr 16, 2026

More from samber/cc-skills-golang

All 47
1vuejs-ai avatarvue-best-practicesvuejs-ai/skillsMUST be used for Vue.js tasks. Strongly recommends Composition API with `<script setup>` and TypeScript as the standard approach. Covers Vue 3, SSR, Volar, vue-45Kskills.sh installs
2samber avatargolang-securitysamber/cc-skills-golangSecurity best practices and vulnerability prevention for Golang. Covers injection (SQL, command, XSS), cryptography, filesystem safety, network security, cookie44.2Kskills.sh installs
3samber avatargolang-concurrencysamber/cc-skills-golangGolang concurrency patterns. Use when writing or reviewing concurrent Go code involving goroutines, channels, select, locks, sync primitives, errgroup, singlefl43.6Kskills.sh installs
4samber avatargolang-documentationsamber/cc-skills-golangComprehensive documentation guide for Golang projects, covering godoc comments, README, CONTRIBUTING, CHANGELOG, Go Playground, Example tests, API docs, and llm42Kskills.sh installs
5samber avatargolang-observabilitysamber/cc-skills-golangGolang everyday observability — the always-on signals in production. Covers structured logging with slog, Prometheus metrics, OpenTelemetry distributed tracing,41.5Kskills.sh installs
6convex avatarconvex-authzconvex/agent-skillsAudit and harden a Convex app's authorization: identity-from-arg impersonation, missing per-document ownership checks, public queries leaking data by a client-s41.3Kskills.sh installs