GO

go-error-handling

Go-specific error handling strategy. Teaches developers how to wrap, match, and propagate errors across packages properly.

Install

mkdir -p .claude/skills/go-error-handling && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10023" && unzip -o skill.zip -d .claude/skills/go-error-handling && rm skill.zip

Installs to .claude/skills/go-error-handling

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Use when writing Go code that returns, wraps, or handles errors — choosing between sentinel errors, custom types, and fmt.Errorf (%w vs %v), structuring error flow, or deciding whether to log or return. Also use when propagating errors across package boundaries or using errors.Is/As, even if the user doesn't ask about error strategy. Does not cover panic/recover patterns (see go-defensive).
393 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

Key capabilities

  • →Detect error handling anti-patterns using bash scripts
  • →Implement error wrapping with fmt.Errorf and %w
  • →Define sentinel errors and custom error types
  • →Structure error flow with early returns
  • →Propagate errors across package boundaries

How it works

The skill provides scripts to identify anti-patterns like naked returns and string comparisons, while enforcing the use of %w for wrapping and error interface returns.

Inputs & outputs

You give it
Go source code files
You get back
Refactored error handling logic and anti-pattern reports

When to use go-error-handling

  • →Wrapping errors for context
  • →Defining custom error types
  • →Checking for error strategies in Go

About go-error-handling

Outlines best practices for using errors.Is/As and fmt.Errorf %w for wrapping. It provides scripts to detect anti-patterns and rules for consistent error definitions in Go projects.

Use when writing Go code that returns, wraps, or handles errors — choosing between sentinel errors, custom types, and fmt.Errorf (%w vs %v), structuring error flow, or deciding whether to log or return. Also use when propagating errors across package boundaries or using errors.Is/As, even if the use

When not to use it

  • →Handling panic or recover patterns
  • →When Go version is below 1.13

Prerequisites

Go 1.13+Bash

Limitations

  • →Does not cover panic/recover patterns
  • →Requires Go 1.13+ for specific wrapping features

How it compares

Unlike manual error checking, this workflow enforces consistent wrapping strategies and detects anti-patterns through automated script analysis.

Compared to similar skills

go-error-handling side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
go-error-handling (this skill)03moReviewIntermediate
bubbletea429moNo flagsBeginner
golang-performance48moReviewAdvanced
gentleman-trainer28moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry