agentleFS
CsHengCsHeng/agent-skills/skills/error-patterns/SKILL.md

error-patterns

Skill3 starsChanged 8 days agoMITView on GitHub

Use for resilience and recovery decisions: failure classification, bounded retries, circuit breaking, cleanup, degraded behavior, health evidence, and resource recovery. Do not use as the lifecycle owner or for general incident triage.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill for:

    line 12
  2. Very specific:

    test-layer and CI design: testing-strategy

    line 24
  3. Distinctive:

    Verify the failure and recovery paths with the smallest realistic executable oracle: exercise the transient, permanent, timeout, …

    line 34
  4. Very specific:

    When a reproducible code or performance failure needs a tighter evidence loop, read references/debugging-tight-loop.md.

    line 36
  5. Distinctive:

    Use typed or structured errors when callers need stable branching.

    line 50
  6. Distinctive:

    Use fallback when stale, partial, cached, or read-only behavior is valid for the caller contract.

    line 60
  7. Very specific:

    When the boundary calls a remote dependency or declares health or readiness endpoints, read references/patterns.md.

    line 68

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Resilience And Recovery

Choose failure behavior that preserves correctness, bounds amplification, and makes recovery observable for a known application or dependency boundary.

Scope

Use this skill for:

  • classifying failures by cause, permanence, caller action, and recovery path
  • deciding whether retries, circuit breaking, fallback, degradation, or immediate rejection fit a boundary
  • defining cleanup, cancellation, timeout, idempotency, and resource recovery
  • defining health, readiness, and recovery evidence

Hand off to the matching owner:

  • cross-component operational diagnosis before the failing state owner and data path are known: runtime-diagnosis
  • application, security, or audit log design: logging-standards
  • input validation and exploit prevention: security-guardrails
  • test-layer and CI design: testing-strategy
  • rollback authorization and completion judgment: the primary workflow (implement-change, Recovery)

Decision Workflow

  1. Name the protected operation, caller contract, owned state, failure boundary, deadline, and irreversible effects.
  2. Classify the failure using evidence rather than message text alone.
  3. Decide which actor can safely recover and which state must be preserved or cleaned up.
  4. Select the smallest behavior that prevents invalid state and avoids failure amplification.
  5. Define observable success, exhaustion, degraded state, and recovery evidence.
  6. Verify the failure and recovery paths with the smallest realistic executable oracle: exercise the transient, permanent, timeout, cancellation, partial, and cleanup paths the boundary declares, and prove retry budgets, idempotency, resource release, degraded markers, and health-state transitions where they apply.

When a reproducible code or performance failure needs a tighter evidence loop, read references/debugging-tight-loop.md.

Failure Classification

Classify enough to drive caller behavior. Useful distinctions include:

  • invalid input or violated precondition: reject without retry
  • authentication or authorization failure: fail closed and expose only safe reason information
  • conflict or stale state: return the concurrency or reconciliation action the caller can take
  • transient dependency or transport failure: retry per Bounded Retry
  • permanent dependency or configuration failure: stop amplification and route actionable evidence to the owner
  • cancellation or timeout: preserve caller intent and report it as cancellation or timeout
  • resource exhaustion or corruption risk: contain work, protect state, and make recovery ownership explicit

Use typed or structured errors when callers need stable branching. Preserve the original cause while adding boundary context, and keep secrets and internal details out of user-facing errors.

Pattern Selection

Bounded Retry

Retry a classified transient operation that is idempotent or protected by an idempotency mechanism, inside the remaining deadline. Bound attempts by deadline and budget, apply backoff and jitter where concurrency could synchronize, and surface final exhaustion. Retry at one owning layer per call chain.

Fallback And Degraded Behavior

Use fallback when stale, partial, cached, or read-only behavior is valid for the caller contract. Mark degraded results and define freshness, consistency, and exit conditions. Return a required failure to the caller as a failure.

Cleanup And Resource Recovery

Acquire and release files, locks, connections, transactions, processes, and temporary state under one visible ownership boundary. Cleanup runs on error, cancellation, and timeout while keeping the evidence and state required for safe recovery, and it is idempotent when it can be retried.

Circuit Breaking, Load Shedding, And Health

When the boundary calls a remote dependency or declares health or readiness endpoints, read references/patterns.md.

Handoff

Reuse of recovery evidence follows references/oracle-selection.md in skills-routing. Return recovery evidence and unresolved risk to the owning workflow, which decides rollback, scope, and completion.

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.