agentleFS
pvnarppvnarp/agent-skills/skills/bug/SKILL.md

bug

Skill1 starsChanged 9 months agoMITView on GitHub

Investigates and resolves bugs using structured diagnosis. Categorizes by system, traces root cause, proposes minimal fix, and suggests prevention. Use when debugging issues or investigating unexpected behavior.

9 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use feature and init.

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.
  • gh33kSkill

    feature

    Manage feature specifications and implementation plans

    Also in 4 projects that use this

  • MicrosoftSkill

    init

    Generate or update chat customization files for AI coding agents

    Also in 3 projects that use this

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 6 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:

    Don't guess. Trace systematically from symptom to root cause.

    line 8
  2. Distinctive:

    Before touching code, establish the facts.

    line 12
  3. Distinctive:

    Follow the data flow from trigger to symptom:

    line 49
  4. Distinctive:

    Verify the fix doesn't break related behavior (run full test suite)

    line 74
  5. Distinctive:

    If the fix is non-obvious, add a comment explaining WHY (the commit message explains WHAT, the comment explains WHY)

    line 75
  6. Distinctive:

    After fixing, harden against recurrence:

    line 79
  7. Distinctive:

    Check for similar bugs: - if this off-by-one exists here, does it exist in analogous code?

    line 82

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

Bug Investigation

Don't guess. Trace systematically from symptom to root cause.

Step 1: Characterize

Before touching code, establish the facts.

SYMPTOM:      [what's happening vs what should happen]
REPRODUCIBLE: [always / sometimes / once - steps to reproduce]
ENVIRONMENT:  [OS, runtime, build type, deploy target]
FIRST SEEN:   [when - correlate with recent deploys/changes]
IMPACT:       [who's affected, how badly, workaround exists?]

If it's intermittent, suspect: race conditions, resource exhaustion, timing-dependent logic, external service flakiness, or uninitialized state.

Step 2: Categorize

Identify the bug's domain to narrow the search space:

CategorySymptomsWhere to Look
Input/ValidationWrong results from user actions, rejected valid inputEvent handlers, validators, parsers, type coercion
Logic/StateWrong computations, impossible states, inconsistent dataBusiness logic, state machines, conditionals, data flow
DataMissing, corrupt, or stale dataPersistence layer, serialization, migrations, cache
NetworkTimeouts, malformed payloads, intermittent failuresHTTP clients, retry logic, error handling, payload schemas
ConcurrencyIntermittent corruption, deadlocks, lost updatesShared state, locking, async/await, transaction isolation
LifecycleCrashes on start/stop, leaks, state loss across restartsInit/cleanup order, resource management, persistence
IntegrationExternal service misbehavior, version mismatchesAPI contracts, SDK versions, config, auth

Step 3: Isolate

Narrow the search:

  1. Binary search in time: git bisect to find the commit that introduced it.
  2. Binary search in space: Comment out / bypass components until the bug disappears. The last thing you re-enabled is the culprit.
  3. Minimal reproduction: Strip away everything unrelated. Can you trigger it in a test? In a REPL?
  4. Read the error, really read it: Stack traces, error codes, log messages. The answer is often in the output - read it carefully before jumping to hypotheses.

Step 4: Trace Root Cause

Follow the data flow from trigger to symptom:

User action → [handler] → [service] → [data layer] → [external system]
                                           ↑
                                    Bug is HERE (root cause)
                                           ↓
                              Symptom appears downstream

Common root causes:

  • Off-by-one in boundary logic
  • Null/undefined where a value was assumed present
  • Type coercion producing unexpected results
  • Stale closure capturing old state
  • Missing await / uncaught promise rejection
  • Transaction not isolated (dirty read)
  • Initialization order dependency
  • Integer overflow / floating point precision

Step 5: Fix

Fix the root cause, not the symptom.

  • Minimal change - touch only what's necessary
  • Verify the fix doesn't break related behavior (run full test suite)
  • If the fix is non-obvious, add a comment explaining WHY (the commit message explains WHAT, the comment explains WHY)

Step 6: Prevent

After fixing, harden against recurrence:

  1. Add a regression test that fails without the fix and passes with it
  2. Check for similar bugs - if this off-by-one exists here, does it exist in analogous code?
  3. Add a guard - assertion, type constraint, or validation that would catch this class of bug earlier
  4. Improve observability - would better logging or metrics have caught this sooner?

Output

BUG: [concise description]
CATEGORY: [input / logic / data / network / concurrency / lifecycle / integration]
ROOT CAUSE: [what's actually wrong and why it produces the symptom]
FIX: [specific code change - file:line, what to change]
REGRESSION TEST: [test that catches this]
SIMILAR RISKS: [other places in the codebase with the same pattern]
PREVENTION: [guard, validation, or process change to prevent recurrence]

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.