agentleFS
kazemcodeskazemcodes/skill-tree/skills/root-cause-tracing/SKILL.md

root-cause-tracing

Skill1 starsChanged 5 months agoMITView on GitHub

Trace errors deep in execution back to their original trigger — find the root cause, not just the symptom

15 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use condition-based-waiting, defense-in-depth and 7 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.
  • kntismSkill

    condition-based-waiting

    Use when tests have race conditions, timing dependencies, or inconsistent pass/fail behavior - replaces arbitrary timeouts with condition polling to wait for actual state changes, eliminating flaky tests from timing guesses

    Also in 3 projects that use this

  • frankxaiSkill

    defense-in-depth

    Use when invalid data causes failures deep in execution, requiring validation at multiple system layers - validates at every layer data passes through to make bugs structurally impossible

    Also in 3 projects that use this

  • OpenAISkill

    verification-before-completion

    Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always

    Also in 6 projects that use this

  • OpenAISkill

    dispatching-parallel-agents

    Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies

    Also in 4 projects that use this

  • +5 more from openai

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 14 edited versions we read keep these.

  • 10

    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:

    When errors occur deep in execution, trace back to find the original trigger.

    line 8
  2. Distinctive:

    Follow the error upstream:

    line 31
  3. Distinctive:

    Data flow: Follow the data from input to error point

    line 43
  4. Distinctive:

    Timing: Add logging at each layer, narrow the window

    line 44
  5. Distinctive:

    Add test that catches this specific failure

    line 67
  6. Distinctive:

    Consider if similar patterns exist elsewhere

    line 68
  7. Distinctive:

    Read error message completely

    line 124
  8. Distinctive:

    Follow stack trace to origin

    line 125
  9. Distinctive:

    Check what changed recently

    line 126
  10. Distinctive:

    Verify fix resolves the actual root cause

    line 127

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

Root Cause Tracing

When errors occur deep in execution, trace back to find the original trigger.

When to Use

  • Error message is far from actual cause
  • Intermittent failures with no obvious trigger
  • Stack trace leads through framework code
  • Multiple related failures cascading
  • "Something broke" but unclear what

Process

1. Capture the Error State

What is the error message?
What is the stack trace?
When does it occur (always, sometimes, under load)?
What changed recently?

2. Trace Backwards

Follow the error upstream:

Error at Layer A
  ← caused by bad input from Layer B
    ← caused by unexpected state from Layer C
      ← caused by missing initialization in Layer D (ROOT CAUSE)

Techniques:

  • Binary search: Comment out half the code path, does error still occur?
  • Last known good: Find when it last worked, diff that commit
  • Data flow: Follow the data from input to error point
  • Timing: Add logging at each layer, narrow the window

3. Identify Root Cause Categories

CategorySigns
StateRace condition, stale data, missing initialization
InputUnexpected null, wrong type, boundary value
ConfigurationWrong env var, missing dependency, version mismatch
LogicOff-by-one, wrong condition, missing case
IntegrationAPI changed, timeout, permission denied

4. Verify Root Cause

Can you reproduce with this root cause?
If you fix ONLY this, does everything work?
Are there other paths that trigger the same root cause?

5. Fix and Prevent

  • Fix root cause, not symptom
  • Add test that catches this specific failure
  • Consider if similar patterns exist elsewhere

Techniques

Binary Search Bisection

# Find the commit that introduced the bug
git bisect start
git bisect bad          # current commit
git bisect good <hash>  # last known working

# For each commit, test if bug exists
git bisect run npm test

Strategic Logging

# Add trace points
def process(data):
    logger.debug(f"process input: {data}")
    result = validate(data)
    logger.debug(f"validate result: {result}")
    return transform(result)

State Snapshots

# Capture state at boundaries
state_before = snapshot(system)
result = operation()
state_after = snapshot(system)
diff = compare(state_before, state_after)

Common Root Causes

SymptomLikely Root Cause
"Cannot read property of undefined"Missing initialization or wrong order
Intermittent 500 errorsRace condition or resource exhaustion
Works in dev, fails in prodEnvironment difference
Slow then crashesMemory leak or connection pool exhaustion
Works for small data, fails for largeMissing pagination or timeout

Red Flags

Don't:

  • Fix symptoms without finding cause
  • Assume first error is the root cause
  • Skip reading the full stack trace
  • Ignore "works on my machine" — investigate why

Do:

  • Read error message completely
  • Follow stack trace to origin
  • Check what changed recently
  • Verify fix resolves the actual root cause

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.