golang-error-handling

golang error handling

samber ↓ 35k
Claude Code
View source ↗

What it does

  • Sub-agent 1: Error creation — validate errors.New/fmt.Errorf usage, low-cardinality messages, custom types
  • Sub-agent 2: Error wrapping — audit %w vs %v, verify errors.Is/errors.As patterns
  • Sub-agent 3: Single handling rule — find log-and-return violations, swallowed errors, discarded errors ()
  • Sub-agent 4: Panic/recover — audit panic usage, verify recovery at goroutine boundaries
  • Sub-agent 5: Structured logging — verify slog usage at error sites, check for PII in error messages
  • → See samber/cc-skills-golang@golang-samber-oops for full samber/oops API, builder patterns, and logger integration
  • → See samber/cc-skills-golang@golang-observability for structured logging setup, log levels, and request logging middleware

Derived from the skill's own SKILL.md documentation · extracted 2026-07-23

golang error handling

Source

Repository: https://github.com/samber/cc-skills-golang

golang-error-handling FAQ

What does the golang-error-handling skill do?

Idiomatic Golang error handling — creation, wrapping with %w, errors.Is/As, errors.Join, custom error types, sentinel errors, panic/recover, the single handling rule, structured logging with slog, HTTP request logging middleware, and samber/oops for production errors. Built to make logs usable at scale with log aggregation 3rd-party tools. Apply when creating, wrapping, inspecting, or logging errors in Go code. For samber/oops specifics → See `samber/cc-skills-golang@golang-samber-oops` skill; for slog handler ecosystem → See `samber/cc-skills-golang@golang-samber-slog` skill. Sub-agent 1: Error creation — validate errors.New/fmt.Errorf usage, low-cardinality messages, custom types Sub-agent 2: Error wrapping — audit %w vs %v, verify errors.Is/errors.As patterns

How do I install golang-error-handling?

Run: npx -y skills add https://github.com/samber/cc-skills-golang --skill golang-error-handling --agent claude-code — the source lives at github.com/samber/cc-skills-golang.

Maintain golang-error-handling?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

golang-error-handling on getagentictools
[![golang-error-handling on getagentictools](https://getagentictools.com/badge/skills/samber-cc-skills-golang-golang-error-handling.svg)](https://getagentictools.com/skills/samber-cc-skills-golang-golang-error-handling?ref=badge)
npx agentictools info skills/samber-cc-skills-golang-golang-error-handling

The second line is the CLI lookup for this page — handy in READMEs and docs.