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/JamesPrial/claudefiles/tree/main/skills/golang/errors
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.
plugin-packager
Package claudefiles components into a valid Claude Code plugin
plugin-packager-validation
Plugin validation errors and fixes
plugin-packager-subset
Package language-specific subsets of claudefiles
plugin-packager-hooks
Handle hook scripts and paths for plugin packaging
go-concurrency
Go concurrency patterns. Routes to specific patterns.
go-sync-primitives
sync.WaitGroup and sync.Mutex patterns
Didn't find tool you were looking for?