Skip to content

Error Handling Patterns

Guides the agent to design exceptions, Result types, retries and graceful fallbacks in code

Repository
wshobson/agents
Stars
42,095
Licence
MIT
Files
2 files

What it does

When installed, this skill gives the agent a set of guidelines for handling failures in software: when to use exceptions versus explicit success/failure result types, how to separate recoverable errors (like network timeouts or rate limits) from unrecoverable ones (like out-of-memory or programming bugs), and common pitfalls such as empty catch blocks, catching overly broad exceptions, and duplicate logging. It also points the agent to a reference document with deeper pattern examples, so it can write or review error handling code with these practices in mind.

Great for

  • Developers writing new features who want consistent, resilient error handling
  • Engineers reviewing code for swallowed errors, broad catch blocks or poor error messages
  • Teams designing APIs that need clear failure behaviour, retries or circuit breakers

Skip it if

  • Non-programmers or people who only need a one-off fix: the guidance is conceptual and assumes coding knowledge
  • Projects where the agent's generic suggestions would override established team conventions or framework-specific error handling without review

Try asking

  • “Review this service module and point out where errors are being swallowed or caught too broadly”
  • “Add retry with backoff and graceful fallback to this API client call”
  • “Design an error type hierarchy for our order-processing code”
  • “Improve the error messages in this validation layer so users know how to fix their input”
Step-by-step guide: how to use Error Handling PatternsInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 2 original files, the MIT licence and an attribution note.

    error-handling-patterns.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip error-handling-patterns.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip error-handling-patterns.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Name the language and framework you use, since the examples are Python-style and the agent should match your idioms
  • Ask for the agent's changes to be reviewed against your existing logging and monitoring setup, as the skill's advice on logging is general
  • Treat the generated retry and circuit-breaker code as a starting point and test failure paths before relying on it in production

What's inside

  • references/details.md
  • SKILL.md

Redistributed unmodified from wshobson/agents under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.