agentleFS
LuisUrrutiaLuisUrrutia/skills/error-handling/SKILL.md

error-handling

Skill2 starsChanged 57 days agoMITView on GitHub

Design, implement, or review error contracts and recovery behavior across software boundaries.

44 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use logging, state-management and 9 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-tobalinaSkill

    logging

    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

  • 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

  • ffsshhttiikkSkill

    i18n

    Internationalization and localization

    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

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 9 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 37 edited versions we read keep these.

  • 9

    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. Distinctive:

    Keep the requested boundary: a review or design request produces findings or a proposal.

    line 10
  2. Distinctive:

    Read the affected operation, callers, existing error types, adapters and tests.

    line 15
  3. Distinctive:

    Place validation and translation at the boundary that owns them.

    line 35
  4. Distinctive:

    Use runtime-supported cleanup and ownership mechanisms on success, failure and cancellation.

    line 47
  5. Distinctive:

    Before adding retries, fallback, restart, rollback, compensation or a circuit breaker, read references/recovery.md.

    line 56
  6. Distinctive:

    Prefer existing retry and recovery mechanisms over another nested loop.

    line 60
  7. Distinctive:

    If the intended result cannot be established, return the supported failure or uncertainty rather than manufacture success.

    line 62
  8. Distinctive:

    Use controllable dependencies and time where needed to exercise partial progress, exhaustion, cancellation and cleanup.

    line 83
  9. Distinctive:

    Do not replace the behavior under test with a mock or use elapsed waiting as proof.

    line 86
  10. Very specific:

    Run the project's applicable checks after implementation.

    line 88

“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

Make failures explicit to their callers and recover only when the operation's contract supports it. Apply the language, runtime and framework already in use. Keep the requested boundary: a review or design request produces findings or a proposal; implementation requires the active task's authority.

Establish the contract

Read the affected operation, callers, existing error types, adapters and tests. Find the requirement or established contract for each material failure: what the caller can observe, which effects may already have happened, and who can decide the next action. Current behavior alone does not settle an unclear product policy.

Distinguish expected domain outcomes, invalid input or denied access, dependency failures, broken internal invariants, and cancellation or deadline expiry when they require different handling. Classify by the actual operation and runtime semantics, not message matching or a blanket rule for an entire status range. Separate known failure from an unknown outcome after a lost response.

Preserve public codes, response shapes, exit status, queue acknowledgement, exception identity and other caller-visible behavior unless the requested change revises that contract. Reuse the project's representation; do not introduce a universal error superclass, result type, transport envelope or dependency merely to follow this skill. Resolve an undecided fallback, data-loss or retry policy before implementing the affected behavior; continue independent work.

Propagate to an owner that can act

Place validation and translation at the boundary that owns them. Keep domain behavior independent of transport details where the existing structure permits. Rely on an established invariant only while its evidence holds: persisted data, concurrent changes and lifecycle transitions can invalidate a prior check.

Handle a failure where code can recover, add useful context, translate its representation, or perform required cleanup. Otherwise preserve propagation. Retain the cause and useful classification when wrapping; keep diagnostic detail separate from the public response. A catch that only logs does not establish recovery. An empty value, default result or successful exit must not conceal an unfulfilled operation.

Use runtime-supported cleanup and ownership mechanisms on success, failure and cancellation. Keep the primary failure identifiable if cleanup also fails; expose the secondary failure through the project's supported reporting mechanism. Treat cancellation as control flow when the runtime does; do not turn it into success or an automatic retry. Ensure asynchronous work has an owner that observes its completion and failures, including work outside a request or UI render boundary.

Choose recovery from the operation's semantics

Before adding retries, fallback, restart, rollback, compensation or a circuit breaker, read references/recovery.md. That reference owns replay safety, partial effects, limits and recovery transitions.

Prefer existing retry and recovery mechanisms over another nested loop. A fallback must satisfy an approved reduced contract and make partial or stale results clear. If the intended result cannot be established, return the supported failure or uncertainty rather than manufacture success. Do not add resilience infrastructure without a concrete failure mode that needs it.

Make failures understandable and testable

Give the user or caller an accurate outcome and a next action that is actually available. Preserve localization and accessibility conventions. Do not advise resubmitting a mutation whose outcome is unknown unless replay is safe. Keep technical causes out of public messages while retaining appropriate internal evidence for investigation.

Choose the reporting owner so one failure remains traceable without duplicate alerts at every layer. Record useful operation, correlation, classification and attempt context using the project's logging or telemetry conventions. Filter secrets, payloads and personal data before recording them; raw exception text and cause chains can contain sensitive values too. A public generic message does not justify logging unrestricted internal data.

Exercise the real error boundary through observable behavior. Cover the relevant failure, successful or permitted recovery path, and effects that must not repeat. Use controllable dependencies and time where needed to exercise partial progress, exhaustion, cancellation and cleanup. Verify result/state as well as reporting; absence of a side effect is meaningful when tied to the observed failure contract. Do not replace the behavior under test with a mock or use elapsed waiting as proof.

Run the project's applicable checks after implementation. Use available verify for application-level evidence when the change needs it; existing direct checks remain useful if that skill is unavailable. debug owns a wider investigation of an observed symptom; error-handling supplies the failure-contract decisions.

Return the result

Report the boundary and contract, changes or findings, observed outcomes and remaining uncertainty. For recovery work, include what was retried or reconciled, its stopping condition and the evidence that effects were not duplicated. Keep proposed behavior and tested behavior distinct. The active caller owns further delivery; this skill does not start publication or PR monitoring.

For a requested check or update of this skill's sources, read references/upstream-updates.md.

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.