error-handling
Skill4 starsChanged 4 months agoMITView on GitHub
Designs what a system does when things go wrong, which errors to catch, what to retry, what to surface, and what to let crash. Use this whenever the user is writing try/except or error branches, adding retries or timeouts, asking how to handle a failure case, or dealing with code that swallows errors silently. Also use when a system fails in confusing ways or logs are useless during an incident. For finding the cause of a specific failure, use debugging.
44 other projects use a version of this.
Adopted by
Most recently taken up by
- SkillMedev/ai-engineer-toolkittheir own version, first seen Oct 5, 2026
- LuisUrrutia/skillstheir own version, first seen Oct 4, 2026
- JameMy0001/antigravity-skills-hubtheir own version, first seen Oct 2, 2026
- aprameyak/coding-skillstheir own version, first seen Oct 2, 2026
- komluk/scaffoldingtheir own version, first seen Sep 28, 2026
- alfredobs97/flutter_agentic_templatetheir own version, first seen Sep 24, 2026
Used with
Projects with it also use logging, state-management and 6 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
diego-tobalinaSkilllogging
Logging best practices for Java (SLF4J/Logback) and Node.js (Winston/Pino). Use for structured logging, log levels, and avoiding sensitive data exposure.
Also in 5 projects that use this
conorluddySkillstate-management
Cache management, configuration best practices, and progressive disclosure patterns for efficient context window usage. Use when working with large responses, optimizing token costs, or managing plugin state across operations.
Also in 5 projects that use this
JohnJBorenSkillci-cd
CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies
Also in 5 projects that use this
ffsshhttiikkSkilli18n
Internationalization and localization
Also in 5 projects that use this
benshapyroSkillreact-patterns
Modern React patterns for TypeScript applications including hooks, state management, and component composition. Use when building React components, managing state, or implementing React best practices.
Also in 4 projects that use this
OpenAISkillobservability
Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.
Also in 5 projects that use this
Other versions44 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 44
- microsoft/data-formulator★ 18ksame name
- CloudAI-X/claude-workflow-v2★ 1.4ksame name
- codewithmukesh/dotnet-claude-kit★ 750same name
- templetongroup/radiant★ 113same name
- DevelopersGlobal/ai-agent-skills★ 69same name
- metarhia/metaskills★ 57same name
- suhailkakar/the-skills★ 26same name
- komluk/scaffolding★ 15same name
- zircote-plugins/claude-team-orchestration★ 15same name
- wpank/ai★ 11same name
34 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository61 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-deploymentSkill
- agent-designSkill
- agent-evaluationSkill
- agent-hardeningSkill
- agent-implementationSkill
- agent-observabilitySkill
- agent-scopingSkill
- api-designSkill
- code-templatingSkill
- dependency-upgradeSkill
- feature-implementationSkill
- project-scaffoldingSkill
- refactoringSkill
- data-analysisSkill
- data-migrationSkill
- data-modelingSkill
- sql-queriesSkill
- ci-pipelinesSkill
- containerizationSkill
- deployment-strategiesSkill
- infrastructure-as-codeSkill
- debuggingSkill
- issue-investigationSkill
- issue-triageSkill
- log-analysisSkill
- network-troubleshootingSkill
- performance-profilingSkill
- api-documentationSkill
- commit-messagesSkill
- diagrammingSkill
- markdown-docsSkill
- plain-languageSkill
- pr-descriptionsSkill
- release-notesSkill
- browser-testingSkill
- integration-testingSkill
- load-testingSkill
- test-dataSkill
- test-driven-developmentSkill
- unit-testingSkill
- deep-researchSkill
- feed-digestSkill
- summarizationSkill
- accessibility-reviewSkill
- code-analysisSkill
- code-lintingSkill
- code-reviewSkill
- auth-designSkill
- dependency-auditSkill
- secrets-managementSkill
- security-analysisSkill
- threat-modelingSkill
- capacity-planningSkill
- disaster-recoverySkill
- incident-responseSkill
- monitoring-setupSkill
- root-cause-analysisSkill
- runbooksSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 37 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 13
If you cannot, do not catch it.
- Distinctive: line 29
Done when: every failure path in the code maps to one of these four.
- Distinctive: line 44
Done when: every catch block does something other than logging.
- Very specific: line 48
When you wrap an error, keep the original attached — raise ...
- Distinctive: line 51
Add context on the way up: what you were doing, with which identifiers.
- Distinctive: line 89
Decide what partial success means: If three of five items processed, is that success, failure, or a reported partial?
“Common” is measured: kept by at least 6 in 10 of the 37 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Error handling
Most error handling is written reflexively — wrap it, log it, move on, and that reflex produces systems that fail silently and are impossible to debug. The decision to make for each failure is not how to handle it but whether you can do anything useful about it.
If you cannot, do not catch it. A caught-and-logged exception that leaves the program in a wrong state is worse than a crash, because the crash would have told you immediately.
1. Sort every failure into one of four kinds
| Kind | Example | Response |
| Expected | Not found, validation failed, duplicate | Return it as a value. Not an exception — this is normal operation |
| Transient | Timeout, 503, connection reset, lock contention | Retry with backoff, then give up and report |
| Programmer error | Null where it cannot be null, broken invariant | Crash. Loudly. Do not handle |
| Environmental | Config missing, disk full, credentials invalid | Fail at startup if possible, not on first request |
The two most common mistakes are treating expected outcomes as exceptions, which makes normal control flow expensive and noisy, and catching programmer errors, which hides the bug and lets corrupted state spread.
Done when: every failure path in the code maps to one of these four.
2. Catch only what you can act on
Catch a specific error type, at the level that knows what to do about it. That level is often much higher than where the error occurs.
- Never catch broadly: a bare
except,catch (Exception), orcatch {}also swallows programmer errors, cancellations, and out-of-memory. - Never catch and continue with a default unless the default is genuinely correct. Returning an empty list on a database timeout tells the caller "no results", which is a lie that propagates.
- Never log and rethrow at every level. You get the same error six times in the log with no extra information.
Done when: every catch block does something other than logging.
3. Preserve the cause
When you wrap an error, keep the original attached — raise ... from e, %w, cause:. An
error chain that loses its root is the reason incidents take hours instead of minutes.
Add context on the way up: what you were doing, with which identifiers. "Failed to sync order 88213 for tenant acme" is actionable; "sync failed" is not. Add the values you had, never the secrets.
Done when: one log line at the boundary tells you what failed, for which entity, and why.
4. Retry only what is safe and transient
Retries convert a small outage into a large one when applied carelessly.
- Only retry idempotent operations, or ones with an idempotency key. Retrying a payment because the response timed out can charge twice, the request may well have succeeded.
- Only retry transient errors. A 400 retried five times is five identical failures.
- Exponential backoff with jitter. Fixed-interval retries from many clients synchronise and hammer a recovering service — the retry storm is often worse than the original fault.
- Cap total attempts and total time, and make both visible to the caller.
- Fail fast when the dependency is down. A circuit breaker beats a queue of doomed retries.
Done when: each retry has a stated reason it is safe.
5. Design what the user sees
Three different audiences need three different things from the same failure:
- End user: what happened in their terms, and what to do next. No stack trace, no error code alone.
- Calling system: a stable machine-readable code and whether to retry. See
api-design. - You, at 3am: the full chain, the identifiers, the request ID that ties it to a trace.
The request ID is the piece that gets forgotten and matters most: it is what lets a user report and a log line meet.
Done when: a user report can be traced to the exact failure without guessing.
6. Fail in a safe state
- Clean up on the error path too: connections, locks, temp files, partial writes. Use the language's scope-based mechanism rather than manual cleanup in a catch.
- Decide what partial success means. If three of five items processed, is that success, failure, or a reported partial? Decide deliberately, the default is usually wrong.
- Never leave a half-applied change. Transaction, compensating action, or an idempotent design that tolerates re-running.
Done when: an error mid-operation leaves nothing inconsistent.
Report
State which failures you handle and which you deliberately let propagate, what is retried and why that is safe, and what a user sees for each. The failures you chose not to handle are the part reviewers most need to see, because silence there reads as an oversight.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

