golang-error-handling

Go error handling review. Use when checking error wrapping, context propagation, or error checking patterns. Ensures proper error chains, context usage, and nil checks.

16 stars

Best use case

golang-error-handling is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Go error handling review. Use when checking error wrapping, context propagation, or error checking patterns. Ensures proper error chains, context usage, and nil checks.

Teams using golang-error-handling should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/golang-error-handling/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/development/golang-error-handling/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/golang-error-handling/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How golang-error-handling Compares

Feature / Agentgolang-error-handlingStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Go error handling review. Use when checking error wrapping, context propagation, or error checking patterns. Ensures proper error chains, context usage, and nil checks.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Golang Error Handling

Expert-level error handling review for Go applications. Ensures proper error wrapping, context propagation, and error checking that preserves error chains and enables proper timeout/cancellation handling.

## When to Apply

Use this skill when:
- Reviewing error propagation patterns
- Checking context usage and cancellation
- Auditing error wrapping with %w vs %v
- Investigating timeout or cancellation issues
- Verifying nil checks for interfaces
- Ensuring errors.Is/As usage

## Rule Categories by Priority

| Priority | Count | Focus |
|----------|-------|-------|
| Critical | 3 | Prevents error chain loss, context leaks |
| High | 3 | Correctness and reliability |
| Medium | 1 | Code quality |

## Rules Covered (7 total)

### Critical Issues (3)

- `critical-error-wrapping` - Use %w for error wrapping, not %v
- `critical-error-shadow` - Don't shadow err variable in nested scopes
- `critical-context-leak` - Always defer cancel() after context creation

### High-Impact Patterns (3)

- `high-context-propagation` - Propagate context through call chain
- `high-error-is-as` - Use errors.Is/As instead of ==
- `high-interface-nil` - Check interface nil correctly

### Medium Improvements (1)

- `medium-sentinel-error-usage` - Use sentinel errors for stable categories

## How to Use

### For Error Handling Review

1. Scan code for error handling patterns
2. Check against rules in priority order (Critical first)
3. Verify error wrapping preserves error chains
4. Ensure context propagation for timeouts/cancellation
5. Check for proper nil interface handling

### Common Patterns

**Error chain review**:
```
Check this code for proper error wrapping
```

**Context propagation audit**:
```
Verify context is propagated correctly
```

**Error checking patterns**:
```
Review error handling for wrapped errors
```

## Trigger Phrases

This skill activates when you say:
- "Review error handling"
- "Check error wrapping"
- "Verify context propagation"
- "Check for context leaks"
- "Review error chains"
- "Audit error patterns"

## Output Format

```
## Critical Error Handling Issues: X

### [Rule Name] (Line Y)
**Issue**: Brief description
**Impact**: Lost error chain / Context leak / Wrong error check
**Fix**: Suggested correction
**Example**:
```go
// Corrected code
```

## Related Skills

- [golang-concurrency-safety](../concurrency-safety/SKILL.md) - For goroutine context patterns
- [golang-clean-architecture](../clean-architecture/SKILL.md) - For error handling across layers

## Philosophy

Based on Go best practices:

- **Error chains are valuable** - Use %w to preserve error context
- **Context is essential** - Always propagate for cancellation/timeout
- **Errors are values** - Use errors.Is/As for wrapped error checking
- **Nil interfaces are tricky** - Check correctly to avoid bugs

## Notes

- Focus on error handling correctness
- All examples show proper error wrapping patterns
- Context propagation is critical for production systems
- Related to concurrency but focused on error semantics

Related Skills

implementing-error-handling

16
from diegosouzapw/awesome-omni-skill

Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability.

golang-pro

16
from diegosouzapw/awesome-omni-skill

Master Go 1.21+ with modern patterns, advanced concurrency, performance optimization, and production-ready microservices. Expert in the latest Go ecosystem including generics, workspaces, and cutting-edge frameworks. Use PROACTIVELY for Go development, architecture design, or performance optimization.

golang-best-practices

16
from diegosouzapw/awesome-omni-skill

Comprehensive Go code review meta-skill. Coordinates 5 specialized domain skills. For targeted reviews, use domain-specific skills (concurrency-safety, clean-architecture). For full audits, use this meta-skill.

Golang Backend Development

16
from diegosouzapw/awesome-omni-skill

Architectural standards and coding practices for the Go backend.

Global Error Handling

16
from diegosouzapw/awesome-omni-skill

Your approach to handling global error handling. Use this skill when working on files where global error handling comes into play.

Fundamental Attribution Error

16
from diegosouzapw/awesome-omni-skill

Over-attributing others' behavior to their character while under-weighting situational factors that shape their actions

fp-ts-errors

16
from diegosouzapw/awesome-omni-skill

Handle errors as values using fp-ts Either and TaskEither for cleaner, more predictable TypeScript code. Use when implementing error handling patterns with fp-ts.

fix-validation-errors-with-overlays

16
from diegosouzapw/awesome-omni-skill

Use when you have lint errors but can't modify the source spec, or need to add missing descriptions/tags via overlay

error-tracking

16
from diegosouzapw/awesome-omni-skill

Add error tracking and performance monitoring to your project services. Use this skill when adding error handling, creating new controllers/routes, instrumenting background jobs, or tracking performance. Supports Sentry, Datadog, and other monitoring solutions. ALL ERRORS MUST BE CAPTURED - no exceptions.

error-root-analyzer

16
from diegosouzapw/awesome-omni-skill

Comprehensive error analysis and root cause resolution. Use when programs fail, crash, or produce errors during execution. This skill performs deep debugging by identifying root causes (not just surface-level symptoms), conducting thorough module reviews to uncover related bugs and exceptions, and implementing holistic fixes that address all discovered issues.

error-handling

16
from diegosouzapw/awesome-omni-skill

Comprehensive error handling patterns for Splits Network services and apps

error-handling-patterns

16
from diegosouzapw/awesome-omni-skill

Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability.