agentleFS
bostonaholicbostonaholic/rpikit/skills/systematic-debugging/SKILL.md

systematic-debugging

Skill19 starsChanged 8 months agoMITView on GitHub

Root cause investigation methodology for bugs and failures. Use when encountering test failures, unexpected behavior, or errors during research or implement phases. Find the cause before attempting fixes.

190 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use chinese-code-review, chinese-commit-conventions and 10 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.
  • Leodorareluctant259Skill

    chinese-code-review

    中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈

    Also in 8 projects that use this

  • Leodorareluctant259Skill

    chinese-commit-conventions

    中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化

    Also in 8 projects that use this

  • obraSkill

    diagnosing-superpowers

    Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.

    Also in 20 projects that use this

  • mjunaidcaSkill

    building-chatgpt-apps

    Guides creation of ChatGPT Apps with interactive widgets using OpenAI Apps SDK and MCP servers. Use when building ChatGPT custom apps with visual UI components, embedded widgets, or rich interactive experiences. Covers widget architecture, MCP server setup with FastMCP, response metadata, and Developer Mode configuration. NOT when building standard MCP servers without widgets (use building-mcp-servers skill instead).

    Also in 4 projects that use this

  • mjunaidcaSkill

    building-chat-interfaces

    Build AI chat interfaces with custom backends, authentication, and context injection. Use when integrating chat UI with AI agents, adding auth to chat, injecting user/page context, or implementing httpOnly cookie proxies. Covers ChatKitServer, useChatKit, and MCP auth patterns. NOT when building simple chatbots without persistence or custom agent integration.

    Also in 4 projects that use this

  • +2 more from Leodorareluctant259
  • +5 more from mjunaidca

The file

Show its rules and text

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 177 edited versions we read keep these.

  • 22

    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:

    Check git log for recent commits

    line 45
  2. Distinctive:

    Add logging at key points

    line 49
  3. Distinctive:

    Check system state (memory, disk, network)

    line 50
  4. Distinctive:

    Start from the error

    line 54
  5. Distinctive:

    Only one hypothesis at a time

    line 87
  6. Distinctive:

    Don't bundle multiple changes

    line 96
  7. Distinctive:

    Test should fail before fix

    line 114
  8. Distinctive:

    Test should pass after fix

    line 115
  9. Distinctive:

    Not symptoms or side effects

    line 119
  10. Distinctive:

    All other tests pass

    line 124
  11. Distinctive:

    Should you search for similar patterns?

    line 129
  12. Distinctive:

    When investigating an issue:

    line 146
  13. Distinctive:

    Use this skill to understand the problem

    line 148
  14. Distinctive:

    Document root cause in research findings

    line 149
  15. Distinctive:

    When a step fails verification:

    line 154
  16. Distinctive:

    Stop the step (do not proceed)

    line 156
  17. Distinctive:

    Update plan if fix requires changes

    line 159
  18. Distinctive:

    If you've attempted three or more fixes and the problem persists:

    line 164
  19. Distinctive:

    Should this be reimplemented differently?

    line 170
  20. Distinctive:

    Use AskUserQuestion to discuss architectural concerns before continuing.

    line 172
  21. Distinctive:

    Right: Verify fix addresses root cause

    line 223
  22. Distinctive:

    Wrong: Remove code until error goes away

    line 227

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

Systematic Debugging

Find the root cause before attempting fixes. Symptom fixes are failure.

Purpose

Debugging without methodology wastes time and creates new bugs. Random fixes address symptoms, not causes. This skill enforces systematic investigation to find root causes before any fix is attempted.

The Iron Law

ALWAYS find root cause before attempting fixes.

Quick patches mask underlying issues. If you're trying fixes without understanding why they might work, you're guessing - stop and investigate.

The Four Phases

Complete each phase in order. Do not skip to implementation.

Phase 1: Root Cause Investigation

Understand what's happening before theorizing why.

  1. Read the error carefully
    • Full error message, not just the first line
    • Stack trace - where did it originate?
    • Error codes or types
  2. Reproduce consistently
    • Can you trigger the failure reliably?
    • What are the exact steps?
    • Does it fail the same way every time?
  3. Review recent changes
    • What changed since it last worked?
    • Check git log for recent commits
    • Any new dependencies or configuration?
  4. Gather diagnostic evidence
    • Add logging at key points
    • Check system state (memory, disk, network)
    • Inspect input data
  5. Trace backwards
    • Start from the error
    • Work backwards through the call stack
    • Find where correct behavior diverges

Phase 2: Pattern Analysis

Compare against working code.

  1. Find similar working code
    • How does a working version do this?
    • What's different about this case?
  2. Compare against references
    • Documentation examples
    • Library/framework conventions
    • Previous implementations
  3. Identify the difference
    • What's unique about the failing case?
    • What assumption is being violated?
  4. Understand dependencies
    • What does this code depend on?
    • Could a dependency have changed?
    • Are versions correct?

Phase 3: Hypothesis and Testing

Scientific method for debugging.

  1. Form a single hypothesis
    • "The error occurs because X"
    • Be specific and testable
    • Only one hypothesis at a time
  2. Design a test
    • How would you prove/disprove this hypothesis?
    • What would you expect to see if correct?
    • What would you expect to see if wrong?
  3. Make minimal changes
    • Change ONE thing to test the hypothesis
    • Don't bundle multiple changes
    • Keep changes reversible
  4. Observe results
    • Did the change affect the behavior?
    • Does it match your prediction?
    • Record what happened
  5. Iterate or proceed
    • Hypothesis confirmed: proceed to Phase 4
    • Hypothesis rejected: form new hypothesis, repeat Phase 3

Phase 4: Implementation

Fix only after understanding.

  1. Write a failing test
    • Capture the bug in a test
    • Test should fail before fix
    • Test should pass after fix
  2. Implement single fix
    • Address the root cause
    • Not symptoms or side effects
    • Minimal change required
  3. Verify the fix
    • Original test passes
    • All other tests pass
    • Manual verification if applicable
  4. Check for related issues
    • Could this bug exist elsewhere?
    • Should you search for similar patterns?

Red Flags: You're Skipping Investigation

ThoughtReality
"Let me try this quick fix"You don't understand the cause
"I'll just restart the service"Masking the symptom
"Maybe if I add a null check here"Guessing, not debugging
"Let me try a few things"Random changes waste time
"This usually fixes it"Past fixes don't explain current bugs
"I don't have time to investigate"You don't have time NOT to

Integration with RPI Workflow

During Research Phase

When investigating an issue:

  1. Use this skill to understand the problem
  2. Document root cause in research findings
  3. Root cause informs the implementation plan

During Implement Phase

When a step fails verification:

  1. Stop the step (do not proceed)
  2. Apply this debugging methodology
  3. Find root cause before attempting fixes
  4. Update plan if fix requires changes
  5. Resume implementation after fix verified

Escalation: When to Question Architecture

If you've attempted three or more fixes and the problem persists:

Stop fixing. Question the architecture.

  • Is the design fundamentally flawed?
  • Are we fighting the framework?
  • Should this be reimplemented differently?

Use AskUserQuestion to discuss architectural concerns before continuing.

Evidence Gathering Techniques

Logging

Add temporary logging:
- Entry/exit of functions
- Variable values at key points
- Timestamps for timing issues
- Request/response payloads

Bisection

When did it break?
- git bisect to find breaking commit
- Binary search through code changes
- Narrow down to specific change

Isolation

Simplify to reproduce:
- Remove unrelated code
- Use minimal test case
- Eliminate variables

Comparison

What's different?
- Working vs broken environment
- Working vs broken input
- Working vs broken configuration

Anti-Patterns

Shotgun Debugging

Wrong: Try random changes hoping one works Right: Form hypothesis, test it, iterate

Fix and Pray

Wrong: Apply fix, hope it works, move on Right: Verify fix addresses root cause

Debugging by Deletion

Wrong: Remove code until error goes away Right: Understand why code causes error

Copy-Paste Fixes

Wrong: Find similar fix online, apply blindly Right: Understand why the fix works for your case

Skipping to Phase 4

Wrong: "I think I know the fix, let me just try it" Right: Complete investigation phases first

Checklist Before Fixing

  • Error message read completely
  • Failure reproduced consistently
  • Recent changes reviewed
  • Diagnostic evidence gathered
  • Root cause identified (not just symptoms)
  • Hypothesis formed and tested
  • Fix addresses root cause
  • Failing test written before fix

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.