error-handling-patterns
by wshobsonerror-handling-patterns helps teams choose exceptions vs Result types, classify failures, propagate context, and design graceful degradation for more reliable APIs and services.
This skill scores 78/100, which means it is a solid directory listing candidate: users get substantial, reusable guidance on choosing and applying error-handling approaches, but should expect a documentation-heavy reference rather than an executable workflow with tooling support.
- Strong triggerability from a specific description and explicit 'When to Use This Skill' scenarios covering API design, debugging, retries, async errors, and distributed systems.
- Substantive content depth: a long SKILL.md with many sections, code fences, and coverage of exceptions, Result types, error propagation, graceful degradation, and language-specific patterns.
- Useful install-decision value for developers who want conceptual and implementation guidance on resilience patterns without placeholder content or obvious repo-quality red flags.
- No support files, references, rules, or scripts, so execution depends on the agent interpreting prose correctly rather than following concrete artifacts.
- The evidence shows broad conceptual coverage, but limited explicit workflow/decision scaffolding, which may leave some implementation choices to generic model judgment.
Overview of error-handling-patterns skill
What the error-handling-patterns skill does
The error-handling-patterns skill helps an agent design better failure behavior, not just patch try/catch blocks. It focuses on practical choices such as when to use exceptions versus Result-style returns, how to classify recoverable versus unrecoverable failures, how to propagate context, and how to degrade gracefully under partial outages.
Who should use this skill
This skill is best for developers, tech leads, and reliability-focused teams working on APIs, services, async workflows, integrations, or distributed systems. It is especially useful when you need consistent error semantics across a codebase rather than one-off fixes.
Job to be done
Most users do not need a theory lesson on errors. They need help answering questions like: What should fail fast? What should be retried? What should return structured errors to callers? What should be logged, surfaced, wrapped, or suppressed? The error-handling-patterns skill is valuable when those decisions affect maintainability, debugging speed, or uptime.
What makes it different from a generic prompt
A generic prompt often produces shallow advice like "add retries" or "use try/catch." This skill is more decision-oriented. It organizes error handling around philosophy, error categories, and language-specific patterns, which makes it better for architecture and implementation guidance that supports Reliability.
What to know before installing
This is a documentation-driven skill with a single SKILL.md file and no helper scripts, references, or example assets. That keeps adoption simple, but it also means output quality depends heavily on the specificity of your prompt and the code context you provide.
How to Use error-handling-patterns skill
error-handling-patterns install options
Install from the repository with:
npx skills add https://github.com/wshobson/agents --skill error-handling-patterns
If your environment already syncs skills from that repo, you may only need to enable or invoke error-handling-patterns by name in your agent workflow.
What to read first after install
Start with:
plugins/developer-essentials/skills/error-handling-patterns/SKILL.md
Because this skill ships as one main document, there is no long onboarding path. Read the "When to Use This Skill" and "Core Concepts" sections first, then jump to the language-specific parts relevant to your stack.
What input the skill needs to work well
The error-handling-patterns skill performs best when you provide:
- Language and framework
- Runtime type: CLI, API, worker, UI, service, library
- Failure modes you care about
- Whether the caller is user-facing, internal, or machine-to-machine
- Existing constraints such as backward compatibility, latency budgets, or logging standards
Weak input: "Improve error handling in this service."
Strong input: "Review this Go HTTP service. Separate validation errors from dependency failures, recommend retry boundaries, define what should be returned to clients vs logged internally, and suggest error wrapping patterns that preserve root cause."
Turn a rough goal into a strong prompt
Use a prompt structure like this:
- State the system and language.
- Name the failure scenarios.
- Describe the desired behavior for callers and operators.
- Ask for concrete patterns, not generic principles.
- Request code-level recommendations if you have source to share.
Example:
Use the error-handling-patterns skill for a Python background worker that calls a rate-limited API and writes to Postgres. I need recommendations for transient vs permanent error handling, retry policy boundaries, idempotency concerns, logging fields, and what errors should stop the job versus be skipped and reported.
Best workflows for practical usage
Use this skill in one of three modes:
- Design mode: before implementation, to define error contracts and recovery behavior
- Refactor mode: when a codebase has inconsistent exceptions, return values, or logging
- Incident mode: after production failures, to redesign handling around actual failure classes
For most teams, the highest-value workflow is: classify errors -> choose propagation model -> define caller-facing behavior -> add observability -> test failure paths.
Where this skill is strongest
The skill is strongest when you need guidance on:
- Exceptions vs Result types
- Recoverable vs unrecoverable errors
- Retry and circuit breaker thinking
- Async and concurrent failure handling
- Better debugging and operator context
- Graceful degradation in reliability-sensitive systems
It is more useful for policy and pattern decisions than for generating framework-specific boilerplate.
Repository-reading path for faster evaluation
If you are deciding whether to adopt the error-handling-patterns skill, skim the repository in this order:
SKILL.mdheading list- "When to Use This Skill"
- "Core Concepts"
- Sections on language-specific patterns
- Any examples showing retries, propagation, and graceful failure
This tells you quickly whether it matches your stack and whether it gives enough structure beyond ordinary prompting.
Practical tips that improve output quality
Ask the skill to make tradeoffs explicit. Good prompts include questions like:
- Which failures are expected business outcomes versus true exceptions?
- Where should retries live to avoid duplicate work?
- What context should be attached before rethrowing or returning?
- Which errors should be user-visible, sanitized, or internal-only?
- When should the system degrade instead of aborting?
These details usually matter more than asking for "best practices."
Constraints and misfit cases
Do not expect this skill to replace deep framework docs, SRE playbooks, or language runtime references. It does not ship executable tooling or lint rules. If you only need syntax help for one language construct, a targeted prompt may be faster. The error-handling-patterns usage story is strongest when your real problem is design consistency and Reliability under failure.
error-handling-patterns skill FAQ
Is error-handling-patterns good for beginners?
Yes, if you already understand basic control flow and want a structured guide to failure handling. It is less suitable as a first-ever introduction to programming errors because it focuses on design choices, not just syntax.
When should I use this instead of a normal coding prompt?
Use error-handling-patterns when failure behavior is the core problem. If you care about API contracts, retries, degraded modes, or observability under failure, this skill gives better framing than a generic "add error handling" request.
Does the skill support multiple languages?
Yes. The source explicitly covers cross-language philosophies such as exceptions, Result types, and error categories, then moves into language-specific patterns. That makes it useful for mixed-stack teams, though you still need to specify your language in the prompt.
Is error-handling-patterns for Reliability teams?
Yes. The error-handling-patterns for Reliability fit is strong because it helps define how systems behave during dependency failures, partial outages, and asynchronous faults. It is especially relevant for service owners who need consistent operator-facing and caller-facing behavior.
What are the boundaries of the skill?
This skill helps with decision-making and implementation patterns around failures. It does not provide test harnesses, production dashboards, or repository-specific automation. You still need to validate recommendations against your architecture and incident history.
When is this skill a poor fit?
Skip it if your need is purely mechanical, such as fixing one compiler error or learning the exact syntax of one framework exception type. It is also a weaker fit when the real issue is missing domain rules rather than poor error handling structure.
How to Improve error-handling-patterns skill
Give the skill a failure map, not just code
Better results come from naming the failure landscape:
- validation errors
- dependency timeouts
- rate limits
- partial writes
- duplicate requests
- deserialization failures
- programmer bugs
This lets the skill recommend different handling paths instead of forcing one pattern onto every error.
Separate caller experience from operator experience
One common failure mode is asking for "better errors" without saying for whom. Tell the skill what end users should see, what API clients should receive, and what operators need in logs or traces. That yields more useful recommendations on sanitization, wrapping, and context propagation.
Ask for explicit error taxonomy
If the first answer feels generic, ask the error-handling-patterns skill to produce:
- error classes or categories
- recoverable vs unrecoverable boundaries
- retryable vs non-retryable rules
- mapping from internal errors to external responses
This usually turns vague advice into implementation-ready guidance.
Provide real constraints that change the pattern choice
Patterns differ when you have strict latency SLOs, expensive retries, idempotency risks, or backward-compatible API contracts. Mention those constraints directly. They often determine whether you should return a Result, raise an exception, short-circuit, queue for later, or degrade gracefully.
Request iteration after the first draft
A strong second pass often looks like:
Revise the recommendation for a high-throughput service. Minimize allocation-heavy exception paths, preserve root cause for debugging, and propose a small set of standard error types the whole team can adopt.
Iteration matters because the best pattern depends on scale, audience, and operational consequences.
Common weak prompts to avoid
Avoid prompts like:
- "Handle errors better"
- "Add retries everywhere"
- "Make it production ready"
These hide the decision criteria. The skill is much more effective when asked to choose among tradeoffs, not just decorate code with defensive constructs.
How to validate the output
After using the error-handling-patterns guide, check whether the recommendation:
- distinguishes expected failures from bugs
- avoids retry storms
- preserves enough context to debug
- exposes safe, stable errors to callers
- supports graceful degradation where appropriate
If not, refine the prompt with concrete failure cases and desired outcomes rather than asking for more detail in the abstract.
