agentleFS
arjunprabhulalarjunprabhulal/agent-skills/skills/diagnose/debugging/SKILL.md

debugging

Skill4 starsChanged 4 months agoMITView on GitHub

Finds the cause of a specific failing behaviour, a crash, a wrong value, a test that fails. Use this whenever something is broken and the cause is not yet known — the user says it "doesn't work", pastes a stack trace or error message, reports a failing test, or describes a bug, even if they just ask you to "fix" it without asking you to investigate. Jumping to a fix without this skill is the failure it prevents. For a failure whose cause is already known and needs a written post-mortem, use root-cause-analysis. For deciding which of many reported problems to work on first, use issue-triage.

81 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use media-processing, databases 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.
  • mrgoonieSkill

    media-processing

    Process multimedia files with FFmpeg (video/audio encoding, conversion, streaming, filtering, hardware acceleration) and ImageMagick (image manipulation, format conversion, batch processing, effects, composition). Use when converting media formats, encoding videos with specific codecs (H.264, H.265, VP9), resizing/cropping images, extracting audio from video, applying filters and effects, optimizing file sizes, creating streaming manifests (HLS/DASH), generating thumbnails, batch processing images, creating composite images, or implementing media processing pipelines. Supports 100+ formats, hardware acceleration (NVENC, QSV), and complex filtergraphs.

    Also in 4 projects that use this

  • mrgoonieSkill

    databases

    Work with MongoDB (document database, BSON documents, aggregation pipelines, Atlas cloud) and PostgreSQL (relational database, SQL queries, psql CLI, pgAdmin). Use when designing database schemas, writing queries and aggregations, optimizing indexes for performance, performing database migrations, configuring replication and sharding, implementing backup and restore strategies, managing database users and permissions, analyzing query performance, or administering production databases.

    Also in 5 projects that use this

  • ShopifySkill

    profiling

    Profile Rubydex indexer performance — CPU flamegraphs, memory usage, phase-level timing. Use this skill whenever the user mentions profiling, performance, flamegraphs, benchmarking, "why is X slow", bottlenecks, hot paths, memory usage, or wants to understand where time is spent during indexing/resolution. Also trigger when comparing performance before/after a change.

    Also in 3 projects that use this

  • sarveshtaleleSkill

    test-generation

    Generate a test strategy and starter test stubs for given modules across unit, integration, and e2e layers (pytest/jest/playwright). Trigger on: generate tests, test plan, test strategy, coverage plan, test scaffolding.

    Also in 3 projects that use this

  • MicrosoftSkill

    using-skills

    Describes how to use abilities. Read before any conversation.

    Also in 3 projects that use this

  • NVIDIASkill

    deployment

    Serve a quantized or unquantized LLM checkpoint as an OpenAI-compatible API endpoint using vLLM, SGLang, or TRT-LLM. Use when user says "deploy model", "serve model", "start vLLM server", "launch SGLang", "TRT-LLM deploy", "AutoDeploy", "benchmark throughput", "serve checkpoint", or needs an inference endpoint from a HuggingFace or ModelOpt-quantized checkpoint. Do NOT use for quantizing models (use ptq) or evaluating accuracy (use evaluation).

    Also in 5 projects that use this

  • +5 more from mrgoonie

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 73 edited versions we read keep these.

  • 7

    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:

    If it is intermittent, find what varies between runs — ordering, time, concurrency, a leftover file, a network call, and pin it.

    line 21
  2. Distinctive:

    Write one sentence: what you expect to happen, and where.

    line 29
  3. Distinctive:

    If part of the symptom is unexplained, you have found *a* bug, not necessarily *the* bug.

    line 58
  4. Distinctive:

    Keep going or note the second one explicitly.

    line 59
  5. Distinctive:

    Done when: every observed symptom traces to the cause, or the leftovers are written down as separate findings.

    line 61
  6. Distinctive:

    Re-read the error: All of it, including the parts you skimmed as boilerplate.

    line 86
  7. Distinctive:

    Reduce: Delete everything not needed to reproduce.

    line 91

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

Debug

A bug is a gap between what you believe the system does and what it does. Debugging closes the gap by finding the smallest place where belief and behaviour diverge. You are not looking for a fix yet — you are looking for the divergence point.

The failure mode this skill exists to prevent: changing code before locating the divergence point. A fix applied to a guessed cause either does nothing or hides the symptom, and both outcomes cost more than the time you saved.

1. Make it happen on demand

Get a command that fails every time you run it. Write it down verbatim.

If it is intermittent, find what varies between runs — ordering, time, concurrency, a leftover file, a network call, and pin it. An intermittent bug is a bug with a hidden input.

Done when: you can produce the failure at will, or you have written down exactly why you cannot and what you are working from instead (a single log, one user report).

2. State the belief

Write one sentence: what you expect to happen, and where. Be specific enough to be wrong — "the handler receives a list of two items" is testable, "auth works" is not.

Done when: the sentence names a place in the code and a value or behaviour you could observe there.

3. Bisect to the divergence point

Find one observation point between a place where the system is definitely correct and a place where it is definitely wrong. Check it. That halves the search space. Repeat.

Observe, don't infer. Read the value, print it, break on it, log it. Do not reason about what it must be — the whole reason you have a bug is that your reasoning about this code is wrong somewhere.

Useful halving points, roughly in order of how much they narrow:

  • The boundary between your code and a library or service
  • The point where data changes shape (parsed, serialized, cast, normalized)
  • The point where a value crosses a thread, process, or await
  • The last commit where it worked (git bisect if the range is wide)

Done when: you have two adjacent points where the value is right at one and wrong at the other.

4. Explain the whole symptom

Say out loud how the cause produces everything you observed, not just the headline error. The stray warning, the wrong count, the second failure downstream.

If part of the symptom is unexplained, you have found a bug, not necessarily the bug. Keep going or note the second one explicitly.

Done when: every observed symptom traces to the cause, or the leftovers are written down as separate findings.

5. Fix at the cause

Fix where the divergence is, not where the symptom surfaced. A null check at the crash site when the real problem is the value never being set is a symptom fix — it converts a crash into silently wrong data, which is worse.

Then prove it: run the step 1 command. It must now pass, and it must fail again if you revert the fix. If you cannot make it fail again, you have not proven the fix caused the pass.

Done when: the reproduction passes with the fix and fails without it.

6. Leave a test behind

A bug that reached you once will reach you again. Write the test that would have caught it, at the divergence point, and confirm it fails against the unfixed code.

Done when: a committed test fails on the old code and passes on the new.

When you are stuck

Stuck usually means a false belief you have not questioned. Try, in order:

  • Re-read the error. All of it, including the parts you skimmed as boilerplate.
  • Check your assumption that the code you are editing is the code that runs. Stale build, wrong environment, cached module, shadowed import, container not rebuilt.
  • Question the layer you trust. You almost certainly trust something without evidence. Name it, then verify it.
  • Reduce. Delete everything not needed to reproduce. The bug either survives, and is now much smaller — or it disappears, and the thing you deleted last is implicated.

Report the divergence point and the evidence, not just the fix. The user needs to know why it broke to judge whether the fix is right.

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.