golang-error-handling Skill (samber): Go Error Handling
Makes Claude create, wrap, inspect and log Go errors the idiomatic way, with usable structured logs.
- Installs
- 44.4K
- on skills.sh
- Stars
- 3.7K
- on GitHub
- Files
- 4
- besides SKILL.md
- Updated
- Nov 2026
- last repo commit
golang-error-handling makes Claude treat every Go error as something to handle or pass up with context. It enforces 15 rules, including checking every returned error, wrapping with fmt.Errorf and %w, matching with errors.Is and errors.As, and logging or returning an error but never both.
It has three modes: coding, review of a diff, and audit of a codebase with up to 5 parallel sub-agents. It also covers slog structured logging, HTTP request logging middleware and the samber/oops library for production errors.
Good for
- Go developers who want errors wrapped with context and logged once
- Backend teams cleaning up noisy or duplicate error logs
- Reviewers auditing error handling across a codebase
Install golang-error-handling
Claude Code
- 1
Copy this prompt.
Install the golang-error-handling skill in Claude Code. Run this command: /plugin marketplace add samber/cc /plugin install cc-skills-golang@samber Then check that it loaded and tell me how to use it.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
The README says these skills are built as atomic, cross-referencing units, and that installing only a subset gives a partial and potentially inconsistent view of the guidelines. It recommends installing all the general-purpose skills together, which the plugin does. Its manifest lists no hooks or MCP servers, and the repo holds 46 skills. Use the skills CLI line only if you want just this one. Pick one route, not both.
From the project README. Source.
What's in the skill
When it loads
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.
Sections in SKILL.md
- Best Practices Summary
- Detailed Reference
- Parallelizing Error Handling Audits
- Cross-References
- References
Key facts
- Installs on skills.sh
- 44,439 (Nov 2, 2026)
- GitHub stars
- 3,749 (Nov 2, 2026)
- License
- MIT
- Last commit
- Nov 1, 2026
- Skill version
- 1.3.1
- Triggers on
- Go files (paths: **/*.go). Needs the go tool
- skills.sh checks
- Gen Agent Trust Hub pass, Socket pass, Snyk pass
What it includes
Follow the rules while writing; optionally scan nearby code in the background
A background sub-agent can grep adjacent code for swallowed errors and log-and-return pairs.
Write ·
Coding modeCheck a diff for swallowed errors, missing wrapping and panic misuse
Focuses on the changed lines and runs sequentially.
Read ·
Review modeUp to 5 sub-agents: creation, wrapping, single handling, panic/recover, logging
Each sub-agent takes one category across the codebase and the results are consolidated.
Read ·
Audit modeCheck errors, wrap with %w, lowercase messages, Is/As, Join, log OR return
Also: sentinel errors for expected cases, no panic for expected errors, slog over fmt.Println, translate technical errors for users, keep log grouping low-cardinality.
The 15 rulesSentinel errors, custom types and when to use which
Reference file references/error-creation.md.
Read ·
Error creation guide%w vs %v, errors.Is, errors.As, errors.AsType (Go 1.26+), errors.Join
Reference file references/error-wrapping.md.
Read ·
Wrapping and inspection guideThe single handling rule, panic/recover, samber/oops and slog
Reference file references/error-handling.md.
Read ·
Handling and logging guide
From the official docs
Permissions
Low risk
Claude can edit and write your Go files and run go, golangci-lint and git commands. Review the diff before you commit.
What it can do
- Read your data
- Create and change things
- Delete things
- Read-only mode
Watch out for
It can edit files and run go and git
The header lists Edit, Write and Bash for go, golangci-lint and git. Review changes before committing. github.com
Audit mode starts up to 5 sub-agents
A full-codebase audit uses more of your usage allowance than a single review. github.com
Security advisories
No published security advisories as of Nov 2, 2026.
Technical details
| Turning on read-only | Review mode looks at a diff, but the skill's tool list includes Edit and Write. |
|---|---|
| Scopes |
|
Questions
How do I install golang-error-handling?
Use the install box above. The plugin route installs the whole Go skill set, and the skills CLI route installs only this skill. Pick one so you do not get every skill twice.
What is the single handling rule?
An error is either logged or returned, never both. SKILL.md says this stops duplicate log lines from cluttering log aggregators.
Does it need other skills?
It works on its own, but SKILL.md points to 6 other skills in the same repo: golang-continuous-integration, golang-naming, golang-observability, golang-safety, golang-samber-oops, golang-samber-slog. The README says installing only a subset gives a partial and potentially inconsistent view, so install the set together.
Does it work in the Claude app, Codex or Cursor?
The SKILL.md header says it is designed for Claude Code, Codex or a similar harness, and the README says the set is built for Claude Code, Codex, Gemini, Copilot, Antigravity and Cursor, with an install section for each. The README does not describe a Claude app install.
Does it need an API key?
SKILL.md names no key. It needs the go tool on your PATH. The skill folder holds SKILL.md, reference guides and an evals file, with no scripts.
Is it safe to use?
It bundles no scripts. Its header lets Claude edit and write files and run go, golangci-lint and git commands, so Claude can change your Go files and run those tools in your project. Read the diff before you commit.
golang-error-handling vs golang-samber-oops?
This skill sets the rules and mentions samber/oops for production errors. SKILL.md sends you to golang-samber-oops for the full samber/oops API and to golang-samber-slog for the slog handler ecosystem.
Information
updated Nov 2, 2026
- Repository
- samber/cc-skills-golang
- Folder
skills/golang-error-handling
Sources
Docs, issue trackers and discussions this page is built from.
Show all 9Hide
- cc-skills-golang · github.com
- cc-skills-golang README · github.com
- plugin.json · github.com
- skills CLI commands · github.com
- README.md#-how-to-use · github.com
- golang-error-handling SKILL.md · github.com
- error-creation.md · github.com
- error-wrapping.md · github.com
- error-handling.md · github.com