Error Handling Patterns

Strategies for handling errors: exceptions, error types, recovery strategies, and error propagation.

48 stars 10 forksOther Plugin marketplace

Install

Claude Code plugin
/plugin marketplace add sethdford/claude-skills

The repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add sethdford/claude-skills --skill error-handling-patterns
Manual install
git clone --depth 1 https://github.com/sethdford/claude-skills.git /tmp/claude-skills
mkdir -p ~/.claude/skills
cp -r /tmp/claude-skills/engineer/code-quality/skills/error-handling-patterns ~/.claude/skills/error-handling-patterns

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Error Handling Patterns

Systematic approaches to error management that preserve debuggability and recovery.

## Context

You are helping the engineer design error handling. If code is provided, assess whether errors are explicit, catchable, and recoverable. Poor error handling is a hidden time bomb in production.

## Domain Context

- **Fail Fast, Fail Loud**: Don't swallow exceptions; propagate or handle explicitly
- **Specific Exceptions**: Throw specific exception types; generic Exception hides intent
- **Recovery Strategy**: Can the caller recover? If not, don't catch; let it propagate
- **Error Context**: Include relevant data in exceptions (user ID, operation, state)
- **Logging**: Log _why_ an error occurred, not just that it occurred

## Instructions

1. **Identify Error Boundaries**: Where can things fail? Network, parsing, database, arithmetic?
2. **Choose Exception Type**: Specific > generic; InvalidUserException > Exception
3. **Include Context**: Add user ID, operation, state to exception messages
4. **Plan Recovery**: If you catch an error, can you recover? If not, don't catch it
5. **Document Throws**: Declare checked exceptions or document unchecked ones
6. **Test Error Paths**: Write tests for error cases; normal cases hide error bugs
7. **Avoid Silent Failures**: Never catch and ignore; at minimum log
8. **Use Error Enums**: For recoverable errors, use Result<T, Error> or Either types

## Anti-Patterns
Read the full skill on GitHub

Details

Skill name
error-handling-patterns
Path
engineer/code-quality/skills/error-handling-patterns/SKILL.md
License
MIT
Repo updated
11 March 2026

FAQ

What does the Error Handling Patterns skill do?

Strategies for handling errors: exceptions, error types, recovery strategies, and error propagation.

How do I install the Error Handling Patterns skill?

Claude Code plugin: /plugin marketplace add sethdford/claude-skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Error Handling Patterns popular?

It lives in sethdford/claude-skills, which has 48 GitHub stars and 10 forks.

Related skills

Browse the most popular Claude skills, all other skills, or write your own with the skills generator.