Systematic debugging

From Dicklesworthstone/pi_agent_rust · View interactive version

Systematic debugging is an AI agent skill from the GitHub repository Dicklesworthstone/pi_agent_rust. Structured approach to finding and fixing bugs

How to use this skill

Skill file

Systematic Debugging

The Process

REPRODUCE → ISOLATE → TRACE → FIX → VERIFY

Never skip steps. Never guess.

Step 1: Reproduce

Goal: See the bug happen reliably

1. Get exact reproduction steps
2. Run them yourself
3. See the exact error
4. Document: input, output, expected

Red flags:

Step 2: Isolate

Goal: Find minimum case that shows bug

1. Start removing things
2. Does bug still happen?
3. Keep removing until minimal
4. Result: smallest repro case

Why this matters:

Step 3: Trace

Goal: Find root cause (use root-cause-tracing skill)

1. Start at symptom
2. Trace backward: where does bad value come from?
3. Keep asking "where did THIS come from?"
4. Stop when you find origin

Tools:

Step 4: Fix

Goal: Change code at root cause

1. Write failing test first
2. Make minimal change to fix
3. Verify test passes
4. Check for side effects

Anti-patterns:

Step 5: Verify

Goal: Confirm fix works and nothing broke

1. Run original reproduction
2. Bug should be gone
3. Run full test suite
4. No regressions

Must have:

Common Bug Types

| Type | Debug Strategy |

|------|---------------|

| Null/undefined | Trace where value should've been set |

| Wrong value | Log at each transformation step |

| Race condition | Add logging with timestamps |

| State corruption | Find all state modifiers |

| Off-by-one | Check loop bounds and indices |

| Missing case | Check all switch/if branches |

Debug Log Pattern

When adding debug logs:

// Include: location, variable name, value, timestamp
console.log('[user.ts:45]', 'userId:', userId, Date.now());

Clean up logs before committing.

Bisect Strategy

When you don't know what broke it:

1. Find last known working version
2. Find first broken version
3. Binary search between them
4. Each step: does bug exist?
5. Result: exact commit that broke it

Integration with Skills

Integration with Checkers

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.