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

systematic-debugging

Skill2 starsChanged 7 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.

191 other projects use a version of this, 2 of them edited.

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

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 173 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 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

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)

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.