error-handling-patterns skill (wshobson): error handling guidance for your agent
A reference skill that makes your agent follow error handling rules when it writes or reviews code.
- Installs
- 23.4K
- on skills.sh
- Stars
- 42.1K
- on GitHub
- Files
- 1
- besides SKILL.md
- Updated
- Oct 2026
- last repo commit
error-handling-patterns is a guide, not a tool. When you ask for error handling or a reliability review, the agent loads it and follows its rules on exceptions versus Result types, error categories and logging.
The SKILL.md holds the core concepts, eight best practices and a list of common pitfalls. A second file, references/details.md, holds worked examples in Python, TypeScript/JavaScript, Rust and Go, plus circuit breaker, error aggregation and graceful degradation patterns. The skill bundles no scripts.
Good for
- Developers adding error handling to new features or APIs
- Teams debugging production failures and weak error messages
- Engineers adding retries, circuit breakers or fallbacks
Install error-handling-patterns
Claude Code
- 1
Copy this prompt.
Install the error-handling-patterns skill in Claude Code. Run this command: npx skills add https://github.com/wshobson/agents --skill error-handling-patterns Then check that it loaded and tell me how to use it.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
Requires Node.js.
From its listing on skills.sh. Source.
What's in the skill
When it loads
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.
Sections in SKILL.md
- When to Use This Skill
- Core Concepts
- 1. Error Handling Philosophies
- 2. Error Categories
- Detailed patterns and worked examples
- Best Practices
- Common Pitfalls
Key facts
- Author
- wshobson (agents repo)
- Installs on skills.sh
- 23,362 as of 2026-11-02
- License
- MIT (as detected by GitHub)
- Last commit to the repo
- 2026-10-30
What it includes
When to use exceptions, Result types, error codes or Option types
Says exceptions fit unexpected errors, Result types fit expected errors such as validation failures, and panics fit unrecoverable bugs.
Read ·
Error handling philosophiesRecoverable (timeouts, rate limits) versus unrecoverable errors
Lists recoverable errors such as network timeouts, missing files, invalid input and API rate limits, and unrecoverable ones such as out of memory and programming bugs.
Read ·
Error categoriesFail fast, keep context, clean up, never swallow errors
Fail fast, preserve context, write meaningful messages, log appropriately, handle at the right level, clean up resources, do not swallow errors, use typed errors.
Read ·
Eight best practicesA process_order function with wrapped payment errors
A worked Python example that validates input, wraps an external payment error with its cause, and re-raises known application errors.
Read ·
Python order exampleCatching too broadly, empty catch blocks, duplicate logs
Also: not cleaning up, vague messages, returning error codes, and ignoring async errors such as unhandled promise rejections.
Read ·
Common pitfallsException hierarchy, context managers, retry with backoff
An ApplicationError base class with ValidationError, NotFoundError and ExternalServiceError subclasses, a database transaction context manager that commits or rolls back, and a retry decorator with exponential backoff.
Try: “Add retry with exponential backoff to this network fetch.”
Read ·
details.md: PythonError classes, a Result type, async errors
Custom error classes, a Result<T, E> type with Ok and Err helpers, parseJSON and chain examples, and handling errors in async fetch code.
Read ·
details.md: TypeScript/JavaScriptResult, a custom error enum, Option
read_file returning Result with io::Error, a custom AppError enum, and Option for lookups that may find nothing.
Read ·
details.md: RustError wrapping, errors.Is and errors.As
Wrapping with fmt.Errorf and %w, a sentinel not-found error, a custom ValidationError struct, and checking with errors.Is and errors.As.
Read ·
details.md: GoA CircuitState enum and CircuitBreaker class
A Python circuit breaker with closed, open and half-open states, used to wrap a fetch call.
Try: “Add retries with a circuit breaker around the payment client.”
Read ·
details.md: circuit breakerAn ErrorCollector class
Collects several validation errors and reports them together instead of failing on the first, with a validateUser example.
Read ·
details.md: error aggregationFallbacks and multiple fallbacks
A with_fallback helper, a user profile example and an exchange rate lookup that tries several fallbacks in order.
Read ·
details.md: graceful degradation
From the official docs
Questions
What does error-handling-patterns do?
It gives your agent a set of error handling rules to follow. These cover exceptions versus Result types, recoverable versus unrecoverable errors, logging, cleanup and retry or circuit breaker patterns. It is guidance text, not a tool that runs code.
Which languages does it cover?
The worked examples in references/details.md cover Python, TypeScript/JavaScript, Rust and Go. The SKILL.md's own example is Python.
How do I install it in Claude Code, the Claude app or Codex?
Use the install box at the top of this page. The SKILL.md does not name which clients it works in, and the repo is a collection of plugins, so check the repo README for its own install routes.
Does it need an API key or any tools?
No key is mentioned in the SKILL.md or its reference file. The skill folder holds two markdown files and no scripts.
Is it safe to install?
It is two markdown files that change how your agent writes code, and it bundles no scripts. The risk is the code the agent then writes, so review changes as usual, especially retry and fallback logic that can hide real failures.
Does it replace my own error conventions?
No, but the two can conflict. The skill pushes specific rules, such as typed errors and fail-fast validation. If your project uses a different convention, say so in your prompt or in your project instructions.
Information
updated Nov 2, 2026
- Repository
- wshobson/agents
- Folder
plugins/developer-essentials/skills/error-handling-patterns
Sources
Docs, issue trackers and discussions this page is built from.
Show all 2Hide
- error-handling-patterns SKILL.md · github.com
- error-handling-patterns details.md · github.com