agentleFS
Piyush8296Piyush8296/claude-workspace/.claude/skills/systematic-debugging/SKILL.md

systematic-debugging

Skill2 starsChanged 6 months agoMITView on GitHub

Four-phase debugging methodology with root cause analysis. Use when investigating bugs, fixing test failures, diagnosing unexpected behavior, or troubleshooting production issues. Emphasizes NO FIXES WITHOUT ROOT CAUSE FIRST.

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 171 edited versions we read keep these.

  • 5

    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:

    Never apply symptom-focused patches that mask underlying problems.

    line 12
  2. Distinctive:

    Before touching any code:

    line 18
  3. Distinctive:

    Follow the data, not your assumptions:

    line 36
  4. Distinctive:

    Before claiming a bug is fixed:

    line 161
  5. Distinctive:

    testing-strategy: Write reproducing test before fixing

    line 174

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

Core Principle

NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.

Never apply symptom-focused patches that mask underlying problems. Understand WHY something fails before writing a single line of fix code.

The Four-Phase Framework

Phase 1: Reproduce & Gather Evidence

Before touching any code:

  1. Read the full error — every word matters, including the stack trace
  2. Reproduce consistently — define exact steps. If you can't reproduce, you can't verify a fix
  3. Check recent changes — git log --oneline -10, what changed before this broke?
  4. Gather diagnostics — console output, network tab, React DevTools, state snapshots
  5. Define expected vs actual — write it down explicitly
# Find the breaking change
git log --oneline -20
git bisect start
git bisect bad HEAD
git bisect good <last-known-good-commit>

Phase 2: Trace to Root Cause

Follow the data, not your assumptions:

1. Where does the error appear? (symptom location)
2. What value is wrong at that point?
3. Where does that value come from? (trace upstream)
4. Is the value wrong at the source, or corrupted in transit?
5. What assumption was violated?

Key insight: The bug is rarely where the error appears. Trace upstream until you find where correct data becomes incorrect.

Phase 3: Hypothesize & Test

Scientific method, not shotgun debugging:

  1. One clear hypothesis — "The error occurs because X causes Y"
  2. Predict the outcome — "If my hypothesis is correct, then Z should happen when I..."
  3. Change ONE variable — isolate the test
  4. Observe result — did it match prediction?
  5. Iterate or proceed — revise hypothesis if wrong, implement if right

Phase 4: Fix & Verify

  1. Write a failing test that captures the exact bug
  2. Implement the fix — address root cause, not symptoms
  3. Verify the test passes
  4. Run full test suite — no regressions
  5. Verify in browser — test the actual user flow

Common Frontend Bug Categories

Rendering Bugs

Symptom: Component shows wrong data or doesn't update
Common causes:
- Stale closure (useCallback/useEffect missing dependency)
- Key prop wrong (React reuses component instance)
- State mutation instead of immutable update
- useEffect dependency array incorrect

Diagnosis:
- React DevTools: check props and state values
- Add console.log at render time: is data correct?
- Check useEffect deps with ESLint exhaustive-deps rule

Async/Race Condition Bugs

Symptom: Sometimes works, sometimes doesn't. Flaky tests.
Common causes:
- Response arrives after component unmounts
- Multiple rapid requests, last response isn't the latest
- State update after navigation

Diagnosis:
- Add timestamps to requests and responses
- Check for AbortController / cleanup functions
- Use React Query (handles cancellation automatically)

Layout/Styling Bugs

Symptom: Element in wrong position, wrong size, or invisible
Common causes:
- CSS specificity conflict
- Missing overflow handling
- Flexbox/Grid misconfiguration
- z-index stacking context
- Missing responsive breakpoint

Diagnosis:
- Browser DevTools: Inspect computed styles
- Check for conflicting Tailwind classes (use tailwind-merge)
- Test at all breakpoints

Hydration Mismatches (SSR)

Symptom: "Text content did not match" or "Hydration failed"
Common causes:
- Server renders different content than client
- Using browser APIs during render (window, localStorage)
- Dates/times formatted differently on server vs client
- Random values or Math.random() in render

Diagnosis:
- Check if component accesses window/document during render
- Wrap browser-only code in useEffect or dynamic import
- Use suppressHydrationWarning only for timestamps

Red Flags — Stop Immediately

  • 3+ failed fix attempts → Re-evaluate the hypothesis. You're likely fixing symptoms.
  • "This should work" → If you can't explain WHY it works, you don't understand the bug.
  • "Quick fix for now" → There is no "for now." Fix the root cause or document the technical debt.
  • "Works on my machine" → Environment difference IS the bug. Find it.

Debugging Tools

# React DevTools
# - Components tab: inspect props/state/hooks
# - Profiler tab: identify unnecessary re-renders

# Browser DevTools
# - Console: errors, warnings, custom logs
# - Network: API calls, timing, response data
# - Performance: long tasks, layout thrashing
# - Application: localStorage, cookies, cache

# Code-level
console.trace('call stack');           # Print call stack
console.table(arrayOfObjects);         # Tabular data
JSON.stringify(obj, null, 2);          # Pretty-print deep objects
debugger;                              # Breakpoint in code

Debugging Checklist

Before claiming a bug is fixed:

  • Root cause identified and documented
  • Hypothesis formed and tested
  • Fix addresses root cause, not symptoms
  • Failing test written that reproduces the bug
  • Test passes with fix applied
  • Full test suite passes (no regressions)
  • Manually verified in browser
  • Fix is minimal and focused

Integration with Other Skills

  • testing-strategy: Write reproducing test before fixing
  • react-patterns: Common React-specific bug patterns
  • state-management: State-related debugging techniques

Download now (ZIP)

  • Other versions187 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 2

    1. ChrisWiles/claude-code-showcase★ 6.1k13% same
    2. c-kick/hnl-agent-skills★ 5613% same

    Wrote their own version · 185

    1. obra/superpowers★ 305ksame name
    2. NousResearch/hermes-agent★ 259ksame name
    3. open-metadata/OpenMetadata★ 16ksame name
    4. jnMetaCode/superpowers-zh★ 8.4ksame name
    5. vudovn/ag-kit★ 8.2ksame name
    6. vudovn/antigravity-kit★ 8.2ksame name
    7. openai/plugins★ 7.4ksame name
    8. farm-fe/farm★ 5.6ksame name
    9. microsoft/FluidFramework★ 5ksame name
    10. compozy/compozy★ 2.8ksame name

    175 more not listed

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Used alongsideProjects 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.
    • GEd520Skill

      chinese-code-review

      中文 review 沟通参考——话术模板、分级标注(必须修复/建议修改/仅供参考)、国内团队常见反模式应对。仅在用户显式 /chinese-code-review 时调用,不要根据上下文自动触发。

      Also in 7 projects that use this

    • GEd520Skill

      chinese-commit-conventions

      中文 commit 与 changelog 配置参考——Conventional Commits 中文适配、commitlint/husky/commitizen 中文模板、conventional-changelog 中文配置。仅在用户显式 /chinese-commit-conventions 时调用,不要根据上下文自动触发。

      Also in 7 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 12 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 GEd520
    • +5 more from mjunaidca
  • In this repository18 other files it gives its agents.

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.