agentleFS
PradnyeshpPradnyeshp/Claude-Skills/.claude/skills/error-handling/SKILL.md

error-handling

Skill2 starsChanged 5 months agoMITView on GitHub

Audit and harden error handling in a file or module — swallowed exceptions, unhandled rejections, missing boundaries, bare catches, leaked internals — and fix the gaps. Use when the user says "improve error handling", "audit error handling", "handle errors properly", "fix swallowed exceptions", "add error boundaries", or "make this more robust".

44 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use state-management, load-testing and 8 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.
  • conorluddySkill

    state-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

  • DatabricksSkill

    load-testing

    Load test a Databricks App to find its maximum QPS. Use when: (1) User says 'load test', 'benchmark', 'QPS', 'throughput', or 'performance test', (2) User wants to find how many queries per second their app can handle, (3) User wants to set up load testing scripts for their agent, (4) User wants to view load test results/dashboard, (5) User wants to validate results or observe latency/error rate with MLflow tracing.

    Also in 3 projects that use this

  • JohnJBorenSkill

    ci-cd

    CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies

    Also in 5 projects that use this

  • pproencaSkill

    refactoring

    Code refactoring best practices based on Martin Fowler's catalog and Clean Code principles. This skill should be used when refactoring existing code, improving code structure, reducing complexity, eliminating code smells, or reviewing code for maintainability. Triggers on tasks involving extract method, rename, decompose conditional, reduce coupling, or improve readability.

    Also in 6 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 16 projects that use this

  • benshapyroSkill

    react-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

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 37 edited versions we read keep these.

  • 2

    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
  1. Very specific:

    Read the code and identify concrete issues with file:line, explaining what fails and the consequence (silent data loss, crash, leak, hang).

    line 31
  2. Distinctive:

    Don't invent a logging or error framework: Use what the project already uses (its logger, error types, Result/Either).

    line 33
  3. Distinctive:

    Never make an error path quieter — removing or weakening handling is the opposite of the goal.

    line 37

“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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Error-handling hotspots

!grep -rnE "catch ?\\([^)]*\\) ?\\{ ?\\}|except:|except Exception: ?pass|catch \\{ ?\\}|rescue ?=> ?nil" --include='*.*' . 2>/dev/null | grep -vE 'node_modules|\.git|dist|build|test' | head -20

!grep -rlE "async |await |\\.then\\(|Promise" --include='*.ts' --include='*.js' . 2>/dev/null | grep -vE 'node_modules|\.git|dist|build' | head -10

Instructions

Audit error handling in $ARGUMENTS (or the highest-risk modules — I/O, network, parsing, async boundaries — if none given) and fix the real gaps. Match the project's existing error conventions.

What to look for

  1. Swallowed errors — empty catch/except: pass/rescue nil that hide failures; catches that log nothing and continue in a broken state.
  2. Over-broad catches — catching everything when only a specific error is expected, masking bugs (e.g. catching a TypeError you meant to let crash). Catch narrowly.
  3. Unhandled async — un-awaited promises, missing .catch, fire-and-forget tasks, unhandled rejections, async functions whose throws nobody handles.
  4. Missing boundaries — no top-level handler for a request/job/CLI; UI without an error boundary; resources (files, connections, locks) not released on the error path (use finally/with/defer/RAII).
  5. Lost context — re-throwing that erases the stack or original cause (use error chaining: raise ... from e, { cause }); generic messages that don't say what failed.
  6. Leaked internals — raw exceptions, stack traces, or DB errors surfaced to users/clients instead of a safe message + logged detail.
  7. Control flow via exceptions — using exceptions for normal, expected outcomes where a return/Result type is clearer.

Method

  1. Read the code and identify concrete issues with file:line, explaining what fails and the consequence (silent data loss, crash, leak, hang).
  2. Fix the clear ones preserving behavior on the success path: narrow the catch, handle or propagate intentionally, await/return promises, add finally cleanup, chain the cause, replace a leaked internal with a safe message + log.
  3. Don't invent a logging or error framework. Use what the project already uses (its logger, error types, Result/Either). If there's no convention for something (e.g. no top-level handler exists), propose one and confirm before adding it broadly.

Rules

  1. Never make an error path quieter — removing or weakening handling is the opposite of the goal. Every error should end up handled, propagated deliberately, or logged with context; never silently dropped.
  2. Catch as narrowly as the situation allows; don't blanket-catch to make code "safe" — that hides bugs.
  3. Preserve the original error and its stack/cause when re-throwing or wrapping.
  4. Match the project's existing error types, logger, and patterns rather than introducing new ones unprompted.
  5. Summarize: issues found by severity, what you fixed, and any places that need a human decision (retry policy, user-facing copy, whether a failure should be fatal).

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.