agentsclimarketplace

Systematic debugging

Skill akuroglo/claude-code-setup/skills/systematic-debugging

Four-phase root cause debugging methodology. Use when investigating bugs, errors, or unexpected behavior. Prevents guess-and-check thrashing. Triggers: bug, error, debug, investigate, «баг», «ошибка», «не работает», «почему падает», «сломалось».From its SKILL.md

Install
npx -y skills add akuroglo/claude-code-setup --skill systematic-debugging

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

6.3 KB, as published. Nobody here has run it

Systematic Debugging

Based on the obra/superpowers debugging methodology.

Core Principle

NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST

Systematic debugging is FASTER than guess-and-check thrashing.

Four Essential Phases

Phase 1: Root Cause Investigation

Step 1: Read the error carefully

# Full error with stack trace (example command — use your stack's dev/run command)
npm run dev 2>&1 | head -50

Step 2: Reproduce consistently (use the Reproduction Template below)

Fill it in before proceeding — if you can't reproduce, you can't fix:

## Reproduction Report

**Bug one-liner:** [what breaks in 1 sentence]
**First seen:** [date/commit if known]
**Severity:** [blocker / critical / high / medium / low]

### Environment

- **Where:** [dev local / preview deploy / production / CI]
- **Browser/device:** [Chrome 123 desktop / Safari iOS / any — if applicable]
- **Auth state:** [logged in as role X / logged out / new user]
- **Data state:** [empty DB / dataset with N records / specific fixture]

### Steps to reproduce

1. [precise step — URL + action]
2. [precise step]
3. [observe]

### Expected

[what should happen]

### Actual

[what happens + error message / screenshot path]

### Reliability

- [ ] Always reproduces (100%)
- [ ] Intermittent — frequency: [1 in 5 / 1 in 20 / random]
- [ ] Only on specific data / timing / race

### Console / network / logs

```text
[paste error, stack trace, failed request]
```

### Minimal reproduction candidate

- [ ] Isolated to a specific component/function
- [ ] Requires full app context
- [ ] Can be reduced to an automated test (if yes — write it now as a regression test)

If you can't fill Steps to reproduce reliably → STOP. Ask the reporter for more details. Do not proceed to Phase 2 without reproduction.

Step 3: Check recent changes

git log --oneline -10
git diff HEAD~3

Step 4: Trace data flow backward

  • Where does the error occur?
  • What function called it?
  • What data was passed?

Step 5: Gather diagnostics

// Add temporary logging (frontend-stack example — adapt to your language)
console.log("[DEBUG] items:", JSON.stringify(items, null, 2));
console.log("[DEBUG] typeof:", typeof items);

Phase 2: Pattern Analysis

Find working examples:

# Search for similar working code
grep -r "useItemsData" --include="*.tsx"

Compare against reference:

  • What's different from working code?
  • Missing imports? Wrong types?
  • Different props/arguments?

Check dependencies:

# Verify package versions (example commands — use your package manager)
npm ls react
npm ls some-library

Phase 3: Hypothesis Testing

Form a specific hypothesis:

"The error occurs because `items` is undefined
when the component first renders, before data loads"

Test with a minimal change:

// ONE change to test the hypothesis
const items = data?.items ?? [];

Rules:

  • One hypothesis at a time
  • One change per test
  • Never bundle multiple fixes

Phase 4: Implementation

Create a failing test first:

// frontend-stack example — use your test framework's equivalent
it('handles undefined items gracefully', () => {
  render(<ItemsTable items={undefined} />);
  expect(screen.getByText('No data')).toBeInTheDocument();
});

Implement the fix:

  • Single fix addressing the root cause
  • Not symptoms, not workarounds

Verify (example commands — substitute your stack's test / type-check / build):

npm test
npx tsc --noEmit
npm run build

Frontend-Stack Examples (customize for your stack)

Debug entry points for a typical React/Next.js data-table stack. Replace with your own stack's equivalents.

React component issues

// Log mount/unmount and incoming props
useEffect(() => {
  console.log("[ItemsTable] mounted with:", { items, loading });
  return () => console.log("[ItemsTable] unmounted");
}, [items, loading]);

TanStack Table issues

// Debug table state
const table = useReactTable({
  data,
  columns,
  debugTable: process.env.NODE_ENV === "development",
});

Recharts issues

// Verify data format
console.log("[Chart] data format:", {
  length: data.length,
  sample: data[0],
  keys: Object.keys(data[0] || {}),
});

Next.js App Router issues

# Check server vs client boundary
grep -r "use client" app/
grep -r "use server" app/

Red Flags (Stop Immediately)

Red FlagWhat To Do
Proposing fix without investigationStop, investigate first
"I think it might be..."Form specific hypothesis
Adding multiple changesRevert, test one change
Third failed fix attemptQuestion architecture
Copying code without understandingRead and understand first

When a fix attempt requires asserting facts about the system ("this endpoint doesn't exist", "the library can't do X") — run them through the verify-before-claim skill first.

Debug Checklist

- [ ] Error message read completely?
- [ ] Issue reproduced consistently?
- [ ] Recent changes reviewed?
- [ ] Data flow traced backward?
- [ ] Working example found?
- [ ] Hypothesis formed?
- [ ] Single change tested?
- [ ] Root cause confirmed?
- [ ] Test written for the fix?
- [ ] Type-check / lint passing?

Emergency Rollback

If nothing works after 3 attempts:

# Revert to last known good state
# (if you use the shipped git-checkout-protection hook, destructive git
#  commands are blocked by default — add the escape-hatch comment shown here)
git stash  # ALLOW_GIT_OP
git checkout HEAD~1 -- path/to/file  # ALLOW_GIT_OP

# Or full reset
git reset --hard HEAD~1  # ALLOW_GIT_OP

Then start the investigation from scratch.

Keep looking

Skills are one crate of 607,533. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.