agentsclimarketplace

Debugging

Skill AvinashP/AgentsAtlas/skills/debugging

Minimal workflow for building production-ready projects with Claude Code & Codex. 8 commands, fresh context, quality execution.

Install
npx -y skills add AvinashP/AgentsAtlas --skill debugging

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 7 stars7 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when encountering any bug, test failure, error, or unexpected behavior - before proposing fixes. Requires root cause investigation first.

SKILL.md

6.2 KB, as published. Nobody here has run it

Systematic Debugging

Diagnose and fix errors using scientific method with disciplined root cause analysis.

The Iron Law

NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST

If you haven't completed Phase 1, you cannot propose fixes. Symptom fixes are failure.

When to Use

Use for ANY technical issue:

  • Test failures
  • Bugs in production
  • Unexpected behavior
  • "It doesn't work" problems
  • Build/compilation failures
  • Performance problems

Use ESPECIALLY when:

  • Under time pressure (emergencies make guessing tempting)
  • "Just one quick fix" seems obvious
  • You've already tried multiple fixes
  • Previous fix didn't work

Don't skip when:

  • Issue seems simple (simple bugs have root causes too)
  • You're in a hurry (systematic is faster than thrashing)

The Four Phases

Complete each phase before proceeding to the next.

Phase 1: Root Cause Investigation

BEFORE attempting ANY fix:

1. Read Error Messages Carefully

  • Don't skip past errors or warnings
  • They often contain the exact solution
  • Read stack traces completely
  • Note line numbers, file paths, error codes

2. Reproduce Consistently

  • Can you trigger it reliably?
  • What are the exact steps?
  • Does it happen every time?
  • If not reproducible → gather more data, don't guess

3. Check Recent Changes

  • What changed that could cause this?
  • git diff, recent commits
  • New dependencies, config changes
  • Environmental differences

4. Trace Data Flow

When error is deep in call stack:

  • Where does the bad value originate?
  • What called this with the bad value?
  • Keep tracing up until you find the source
  • Fix at source, not at symptom

See root-cause-tracing.md for the complete backward tracing technique.

5. Gather Evidence in Multi-Component Systems

When system has multiple components (API → service → database):

For EACH component boundary:
  - Log what data enters component
  - Log what data exits component
  - Verify environment/config propagation

Run once to gather evidence showing WHERE it breaks
THEN analyze evidence to identify failing component
THEN investigate that specific component

Phase 2: Pattern Analysis

Find the pattern before fixing:

  1. Find Working Examples - Locate similar working code in same codebase
  2. Compare Against References - Read reference implementation COMPLETELY, don't skim
  3. Identify Differences - List every difference between working and broken
  4. Understand Dependencies - What settings, config, environment does it need?

Phase 3: Hypothesis and Testing

Scientific method:

  1. Form Single Hypothesis - State clearly: "I think X is the root cause because Y"
  2. Test Minimally - Make the SMALLEST possible change to test hypothesis
  3. One Variable at a Time - Don't fix multiple things at once
  4. Verify Before Continuing
    • Did it work? → Phase 4
    • Didn't work? → Form NEW hypothesis, don't add more fixes

Phase 4: Implementation

Fix the root cause, not the symptom:

  1. Create Failing Test Case - Simplest possible reproduction, automated if possible
  2. Implement Single Fix - ONE change at a time, no "while I'm here" improvements
  3. Verify Fix - Test passes? No other tests broken? Issue actually resolved?
  4. If Fix Doesn't Work - STOP. If ≥3 fixes failed, question the architecture

Red Flags - STOP and Return to Phase 1

If you catch yourself thinking:

  • "Quick fix for now, investigate later"
  • "Just try changing X and see if it works"
  • "Add multiple changes, run tests"
  • "It's probably X, let me fix that"
  • "I don't fully understand but this might work"
  • Proposing solutions before tracing data flow
  • "One more fix attempt" (when already tried 2+)

ALL of these mean: STOP. Return to Phase 1.

Common Rationalizations

ExcuseReality
"Issue is simple, don't need process"Simple issues have root causes too. Process is fast for simple bugs.
"Emergency, no time for process"Systematic debugging is FASTER than guess-and-check thrashing.
"Just try this first, then investigate"First fix sets the pattern. Do it right from the start.
"Multiple fixes at once saves time"Can't isolate what worked. Causes new bugs.
"I see the problem, let me fix it"Seeing symptoms ≠ understanding root cause.

Quick Reference

PhaseKey ActivitiesSuccess Criteria
1. Root CauseRead errors, reproduce, check changes, trace dataUnderstand WHAT and WHY
2. PatternFind working examples, compareIdentify differences
3. HypothesisForm theory, test minimallyConfirmed or new hypothesis
4. ImplementationCreate test, fix, verifyBug resolved, tests pass

Debugging Commands

# Git bisect for regressions
git bisect start
git bisect bad HEAD
git bisect good <last-known-good-commit>

# Find recent changes to a file
git log --oneline -10 path/to/file

# Search for error message
grep -r "error message" --include="*.ts"

Common Fixes by Error Type

Error PatternLikely Root CauseInvestigation
Cannot read property 'x' of undefinedMissing data, async timingTrace where null originates
Module not foundPath issues, missing exportCheck exact path, case sensitivity
CORS errorBackend configCheck Network tab, test with curl
TimeoutSlow operation, connection issueProfile, check network
Works locally, fails in CIEnvironment diffCompare env vars, versions, permissions
Intermittent failuresRace conditions, timingLook for shared state, async issues

Real-World Impact

From debugging sessions:

  • Systematic approach: 15-30 minutes to fix
  • Random fixes approach: 2-3 hours of thrashing
  • First-time fix rate: 95% vs 40%

See Also

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.