golang-error-handling
This skill provides a framework for idiomatic Go error handling, including creation, wrapping, inspection, and structured logging. It defines best practices for maintaining debuggable, production-ready code and includes instructions for auditing codebases using parallel sub-agents.
Is golang-error-handling safe to install?
Review the source first: our audit of golang-error-handling's source files found 3 shell commands, 0 external URLs, file reads and writes (high risk). Every command and URL listed appears verbatim in the skill's source. The skill requires the 'go' binary and allows the agent to execute shell commands via Bash, including golangci-lint and git, which enables modification of the local codebase.
How we audit skills: our security review methodology.
Who is this skill for?
Go developers and reliability engineers using Claude Code or similar AI coding agents.
What can you do with it?
- Writing new error handling code following Go best practices.
- Reviewing pull requests for swallowed errors, missing context, or panic misuse.
- Auditing existing codebases for error handling violations using parallel sub-agents.
- Implementing structured logging with slog and samber/oops.
How good is this skill?
Quality score: 5/10. The skill provides clear, actionable, and idiomatic Go guidelines. It includes specific instructions for agent orchestration and audit modes.
What does the skill file contain?
**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:** Use `ultracode` for auditing error handling across a large codebase — orchestrate the five category sub-agents described in the "Parallelizing Error Handling Audits" section (creation, wrapping, single-handling rule, panic/recover, structured logging) and consolidate their findings. **Modes:** - **Coding mode** — writing new error handling code. Follow the best practices...
Frequently asked questions
What is the single handling rule?
Errors must be either logged or returned, but never both, to prevent duplicate logs in aggregators.
How should I wrap errors?
Use fmt.Errorf with the %w verb to add context while preserving the error chain.
When should I use panic?
Never use panic for expected error conditions. Reserve it for truly unrecoverable states.
How do I audit a large codebase for error handling?
Use the audit mode to orchestrate up to five parallel sub-agents, each targeting a specific category: error creation, wrapping, the single handling rule, panic/recover, and structured logging.
Related skills
golang-code-style
33.3KGo developers and AI coding agents performing code reviews or writing new Go code
This skill provides a comprehensive set of Go code style conventions focused on clarity, maintainability, and idiomatic patterns. It covers variable declarations, control flow, function design, file organization, and string handling, serving as a guide for human-judgment-based code reviews that complement automated linters.
golang-pro
15.6KSoftware developers building Go applications requiring concurrency, microservices, or high-performance systems
Golang Pro provides architectural guidance and implementation patterns for Go 1.21+ applications. It focuses on concurrent programming, microservices, performance optimization, and idiomatic code standards.
golang-patterns
9.8KGo developers seeking to write maintainable, efficient, and idiomatic code
This skill provides a reference guide for idiomatic Go programming, covering best practices for error handling, concurrency, interface design, project structure, and performance optimization.