agentleFS
DonemebDonemeb/Donemeb-Skills/skills/software-engineering/error-handling/SKILL.md

error-handling

Skill0 starsChanged 3 months agoMITView on GitHub

Structured bug-handling flow: locate → fix → audit → prevent. Prevention is chosen by error type (syntax/API misuse → code review; state/edge cases → unit tests; architecture flaws → design docs). Use when the user says 'there's a bug', 'it crashes', 'help me fix this', 'why does this fail'. Don't use for cross-system comm links (use comm-link-debugging).

80 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use convention-learner, caching and 10 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.
  • codewithmukeshSkill

    convention-learner

    Detects and enforces project-specific coding conventions by analyzing existing codebase patterns. Learns naming conventions, folder structure, test organization, and coding style from the existing code. Load when: "conventions", "coding standards", "project patterns", "enforce style", "detect patterns", "learn conventions", "code consistency".

    Also in 3 projects that use this

  • wpankSkill

    caching

    Caching strategies, invalidation, eviction policies, HTTP caching, distributed caching, and anti-patterns. Use when designing cache layers, choosing eviction policies, debugging stale data, or optimizing read-heavy workloads.

    Also in 6 projects that use this

  • 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 12 projects that use this

  • codewithmukeshSkill

    opentelemetry

    OpenTelemetry observability for .NET 10 applications. Covers traces, metrics, and logs using the OpenTelemetry SDK with OTLP export. Includes custom ActivitySource, IMeterFactory metrics, resource configuration, and Aspire Dashboard integration. Load this skill when setting up distributed tracing, custom metrics, OTLP export, or when the user mentions "OpenTelemetry", "OTLP", "traces", "spans", "Activity", "ActivitySource", "metrics", "IMeterFactory", "Meter", "Counter", "Histogram", "Gauge", "telemetry", "observability", "distributed tracing", "OTEL", or "Aspire Dashboard".

    Also in 3 projects that use this

  • MovGP0Skill

    modern-csharp

    Modern C# style guidance for Bendex and MicroSea code changes, including primary constructors, expression-bodied members, var usage, target-typed new, lambdas, and pattern matching.

    Also in 3 projects that use this

  • MicrosoftSkill

    resilience

    Apply resilience patterns (retry, backoff, circuit breaking) when writing or reviewing code that makes outbound HTTP/REST calls, database operations, or any I/O that can experience transient failures. Use this skill when: (1) writing new code that calls external services or APIs, (2) reviewing code that uses fetch, HTTP clients, or service-to-service calls, (3) adding queue consumers or workers that interact with remote systems, (4) debugging intermittent failures in production.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 6 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 64 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After receiving the user's bug report, walk through the following stages in order.

    line 23
  2. Distinctive:

    If the information is insufficient to locate the cause, tell the user clearly what is needed (runtime logs, crash / exception stack, …

    line 32
  3. Distinctive:

    Search the codebase for the same error pattern:

    line 57
  4. Distinctive:

    Search for related API calls or code patterns.

    line 58
  5. Distinctive:

    After completion, summarize the full set of changes from this error-handling session and present to the user.

    line 90
  6. Distinctive:

    All stages complete and confirmed by the user.

    line 94

“Common” is measured: kept by at least 6 in 10 of the 64 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

When to use

  • The user reports a bug, error, crash, or unexpected behavior.
  • "Why does this fail?", "It crashes when...", "Help me fix this".

When NOT to use

  • Cross-system communication-link integration issues — use comm-link-debugging (it has specialized methodology for black-box peers).
  • Performance optimization that is not a bug.
  • General code review of staged changes — use code-review.

Process

After receiving the user's bug report, walk through the following stages in order. Each stage must present its conclusion or proposal to the user and wait for explicit confirmation before proceeding to the next. Silent advancement breaks the user's ability to course-correct.

Stage 1: Locate the cause

Investigate the code based on the user's information and identify the root cause.

The user may have described only the abnormal behavior (e.g., "it crashes when I tap this") without a full error log. In that case:

  1. Trace possible causes in the relevant code based on the behavior description.
  2. If the information is insufficient to locate the cause, tell the user clearly what is needed (runtime logs, crash / exception stack, reproduction steps, environment info) and how to obtain it.
  3. Once the information arrives, continue the investigation.

Output format:

  • Root-cause description (one sentence)
  • Files and lines involved
  • Why it happens

Present to the user and wait for confirmation.

Stage 2: Fix proposal

Propose a minimum-scope fix.

The fix should stay strictly within the problem itself; avoid scope creep. The reason is that scope expansion can introduce unpredictable knock-on effects — the user approved a fix for one issue, not a refactor. Change only what must change; do not change "what could be improved along the way".

Include:

  • Files and code to modify (precise to the line)
  • Description of the modification
  • What is not being changed, and why

Present to the user; only apply the modification after confirmation.

Stage 3: Audit for the same pattern elsewhere

Search the codebase for the same error pattern:

  • Search for related API calls or code patterns.
  • List findings one by one, marking whether each needs fixing.

Present to the user and wait for confirmation.

Stage 4: Prevention plan

Discuss how to prevent the same kind of issue from recurring.

First, classify the error by nature — different types suit different prevention means:

Error typeHallmarkPreferred prevention
Syntax / type / API misuseCompiler or linter can catch itCode review
Incomplete state coverageSyntactically and type-correct, but wrong behavior under specific state sequencesUnit tests
Missing boundary conditionsHappy path correct, fails on extreme input / timingUnit tests
Architecture / design flawProblem crosses multiple layers, needs structural adjustmentDesign doc + code review

Based on the classification:

  • Code review: propose specific review items to add to the project's review checklist doc (any name — docs/code-review.md / CODE_REVIEW.md / review-checklist.md etc. If the project has no such doc, prompt the user to create one, or temporarily record in CONTRIBUTING.md / progress-tracking doc for later cleanup).
  • Unit tests: propose a test plan (which state paths to cover), add cases in the corresponding test file.
  • Both: explain which range each one intercepts.

Explain the scope and limitations of the plan.

Present to the user; only implement after discussion and confirmation.

Stage 5: Implement prevention

Apply the modifications per the user's confirmed prevention plan.

After completion, summarize the full set of changes from this error-handling session and present to the user.

End conditions

  • All stages complete and confirmed by the user.
  • The user explicitly says to stop.
  • At any stage, the user says "that's far enough".

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.