agentleFS
rolandbrechtrolandbrecht/agent-skills/systematic-debugging/SKILL.md

systematic-debugging

Skill4 starsChanged 4 months agoMITView on GitHub

Trigger this AUTOMATICALLY anytime you encounter a stack trace, test failure, production bug, or unexpected behavior. Do NOT guess the fix or propose code changes before explicitly triggering this skill. This skill mandates a strict data-gathering and hypothesis phase before you are permitted to edit ANY source code.

191 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use diagnosing-superpowers, building-chatgpt-apps 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.
  • 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 6 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

  • MorningStar0709Skill

    chinese-git-workflow

    Configure Git for domestic platforms and manage branching strategies suitable for Chinese teams. Use when the user asks to configure remotes, set up SSH, or manage Git workflows for Gitee, Coding, Jihu GitLab, or CNB, including requests like "配置国内 Git", "设置 Gitee 远程仓库", "推荐适合小团队的 Git 流程".

    Also in 4 projects that use this

  • +8 more from mjunaidca

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 1 is common, 11 are distinctive, and 3 are very specific to this project.

  • 1

    Common

    Most of the 173 edited versions we read keep these.

  • 11

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Common:

    Core principle: ALWAYS find the root cause before attempting fixes.

    line 12
  2. Distinctive:

    The Iron Law: NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.

    line 13
  3. Distinctive:

    Use for ANY technical issue:

    line 17
  4. Distinctive:

    Read the error message and stack trace completely.

    line 37
  5. Very specific:

    Use view_file to read the surrounding code where the error occurred.

    line 38
  6. Very specific:

    Use grep_search to find definitions, usages, or configurations related to the failing components.

    line 39
  7. Distinctive:

    If you cannot reproduce it locally, you must gather more data.

    line 44
  8. Distinctive:

    If the system has multiple layers (e.g., Frontend → API → Database), do not guess which layer failed.

    line 47
  9. Very specific:

    Inject telemetry temporarily: Use replace_file_content to add console.log, print(), or logger statements at the boundary of each component.

    line 48
  10. Distinctive:

    Run the system once to see exactly what data entered and exited each layer.

    line 49
  11. Distinctive:

    Do not bundle formatting refactoring, "cleanups," or unrelated typo fixes into this bug fix.

    line 63
  12. Distinctive:

    Run the failing test case or the reproduction script you built in Phase 1.

    line 66
  13. Distinctive:

    If it passes *without* breaking adjacent tests, you have proven resolution.

    line 67
  14. Distinctive:

    If you have attempted 3 different fixes and the system is still failing, STOP CHANGING CODE IMMEDIATELY.

    line 82
  15. Distinctive:

    If you catch yourself doing any of the following, you are violating the systematic debugging protocol.

    line 90

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

Overview

Random fixes waste time and create new bugs. Quick patches mask underlying issues. As an AI agent, it is tempting to rapidly guess the solution based on symptoms because it is fast. You must resist this temptation.

Core principle: ALWAYS find the root cause before attempting fixes. The Iron Law: NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.

When to Use

Use for ANY technical issue:

  • Test failures
  • Bugs in production or local development
  • Build or CI pipeline failures
  • Unexplained performance issues

Do not skip this process even if:

  • The issue seems "simple" or "obvious"
  • You are under time pressure
  • The user asks for a "quick fix"

Phase 1: Planning (Root Cause Investigation)

BEFORE attempting ANY code modification or fix:

  1. Information Gathering (Do Not Guess)
    • Read the error message and stack trace completely. Note the exact file paths and line numbers.
    • Use view_file to read the surrounding code where the error occurred.
    • Use grep_search to find definitions, usages, or configurations related to the failing components.
    • Never assume you know what a file contains without checking or listing its directory.
  2. Reproduce and Isolate
    • Can you trigger the bug reliably? If there isn't an existing test, write a minimal, standalone reproduction script (e.g., repro.py or .js in /tmp/) using write_to_file and then execute it via run_command.
    • If you cannot reproduce it locally, you must gather more data. Do not guess the fix.
  3. Map the Boundaries (Multi-Component Systems)
    • If the system has multiple layers (e.g., Frontend → API → Database), do not guess which layer failed.
    • Inject telemetry temporarily: Use replace_file_content to add console.log, print(), or logger statements at the boundary of each component.
    • Run the system once to see exactly what data entered and exited each layer.

Phase 2: Execution (Hypothesis & Minimal Fix)

Once the root cause is proven (not guessed):

  1. Form a Single Hypothesis
    • You must explicitly state your hypothesis before editing code. (e.g., "I hypothesize the root cause is that user_id is being passed as a string from the API layer, but the database ORM requires an integer.")
  2. Test Minimally
    • Make the SMALLEST possible change to test your hypothesis.
    • Change exactly one variable at a time using replace_file_content.
    • Do not bundle formatting refactoring, "cleanups," or unrelated typo fixes into this bug fix.
  3. Verify the Fix Against the Reproduction Script
    • Run the failing test case or the reproduction script you built in Phase 1.
    • If it passes without breaking adjacent tests, you have proven resolution.

Phase 3: Verification (The "3 Strikes" Rule)

  1. Verify the Fix
    • Did your minimal change resolve the issue?
    • Did it break any adjacent tests in the suite?
  2. If the Fix Failed: REVERT & STOP
    • Undo your change immediately. Do not stack fixes on top of failed fixes.
    • Re-evaluate your hypothesis based on the new failure.
  3. The 3 Strikes Rule (CRITICAL)
    • If you have attempted 3 different fixes and the system is still failing, STOP CHANGING CODE IMMEDIATELY.
    • You are likely fighting a fundamental architectural flaw, an incorrect underlying assumption, or a hallucinated dependency.
    • You must write a summary of the failure modes (e.g., in a /tmp/bug-report.md) and notify the user for an architectural alignment discussion. Do not keep guessing silently.

Red Flags (When to STOP and Restart Phase 1)

If you catch yourself doing any of the following, you are violating the systematic debugging protocol. STOP and return to Phase 1:

  • "Quick fix for now, investigate later"
  • "Let me just try changing X and see if it works"
  • Proposing solutions without having read the file contents where the error originated.
  • Applying 3 or more unrelated changes in a single fix attempt.
  • Encountering a new, completely unrelated bug every time you fix the previous one (indicates fundamental architectural rot).

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.