Agent skill
go-errors
Go error handling patterns. Routes to specific patterns.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/testing/go-errors-jamesprial-claudefiles
SKILL.md
Go Error Handling
Route by Need
- Wrapping errors with context → see wrapping/
- Defining sentinel errors → see sentinel/
- Checking error types → see checking/
Quick Check
- Never ignore errors (_ = fn())
- Wrap with context at boundaries
- Use errors.Is/As, not ==
Common Pattern
func ProcessFile(path string) error {
f, err := os.Open(path)
if err != nil {
return fmt.Errorf("open %s: %w", path, err)
}
defer f.Close()
if err := parse(f); err != nil {
return fmt.Errorf("parse %s: %w", path, err)
}
return nil
}
Resources
- wrapping/ - Add context with fmt.Errorf %w
- sentinel/ - Define package-level errors
- checking/ - Type-safe error inspection
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?