All skills
jeffallan avatar

/debugging-wizard

@efebc44
by jeffallanjeffallan/claude-skills12k stars
1,124

Parses error messages, traces execution flow through stack traces, correlates log entries to identify failure points, and applies systematic hypothesis-driven methodology to isolate and resolve bugs. Use when investigating errors, analyzing stack traces, finding root causes of unexpected behavior, troubleshooting crashes, or performing log analysis, error investigation, or root cause analysis.

Use this Skill: https://skilld.dev/gh/jeffallan/claude-skills/debugging-wizard

This session only. Nothing lands on disk.

referencescommon-patterns.md

≈776 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Common Bug Patterns

Pattern Recognition

Pattern Symptom Likely Cause
Race condition Intermittent failures Missing await, async timing
Off-by-one Missing first/last item < vs <=, array bounds
Null reference "undefined is not..." Missing null check
Memory leak Growing memory Uncleaned listeners/intervals
N+1 queries Slow with more data Fetching in loop
Type coercion Unexpected behavior == instead of ===
Closure issue Wrong variable value Loop variable capture
Stale state Old value used React state closure

Race Condition

// BUG: Race condition
let data;
fetchData().then(result => { data = result; });
console.log(data); // undefined!

// FIX: Await the result
const data = await fetchData();
console.log(data);

Off-by-One

// BUG: Skips last element
for (let i = 0; i < array.length - 1; i++) { }

// FIX: Include last element
for (let i = 0; i < array.length; i++) { }

// BUG: Array index out of bounds
const last = array[array.length]; // undefined

// FIX: Correct index
const last = array[array.length - 1];

Null Reference

// BUG: Crashes if user is null
const name = user.profile.name;

// FIX: Optional chaining
const name = user?.profile?.name ?? 'Unknown';

// FIX: Guard clause
if (!user?.profile) {
  return 'Unknown';
}
return user.profile.name;

Memory Leak

// BUG: Listener never removed
useEffect(() => {
  window.addEventListener('resize', handleResize);
}, []);

// FIX: Cleanup function
useEffect(() => {
  window.addEventListener('resize', handleResize);
  return () => window.removeEventListener('resize', handleResize);
}, []);

// BUG: Interval never cleared
setInterval(pollData, 1000);

// FIX: Store and clear
const intervalId = setInterval(pollData, 1000);
return () => clearInterval(intervalId);

Closure in Loop

// BUG: All callbacks use i = 5
for (var i = 0; i < 5; i++) {
  setTimeout(() => console.log(i), 100);
}

// FIX: Use let (block scoped)
for (let i = 0; i < 5; i++) {
  setTimeout(() => console.log(i), 100);
}

// FIX: Capture in closure
for (var i = 0; i < 5; i++) {
  ((j) => setTimeout(() => console.log(j), 100))(i);
}

React Stale State

// BUG: count is stale in closure
const [count, setCount] = useState(0);
useEffect(() => {
  setInterval(() => {
    setCount(count + 1); // Always uses initial count
  }, 1000);
}, []);

// FIX: Use functional update
setCount(prev => prev + 1);

// FIX: Include in dependency array with cleanup
useEffect(() => {
  const id = setInterval(() => setCount(c => c + 1), 1000);
  return () => clearInterval(id);
}, []);

Quick Reference

Symptom First Check
"undefined is not..." Null check missing
Works sometimes Race condition
Wrong value in callback Closure/stale state
Gets slower over time Memory leak, N+1
Off by one item Loop bounds, array index
Type mismatch == vs ===, coercion

Source: SKILL.md on GitHub

1 alert17d5 checks · Risk CRITICAL
  • Gen Agent Trust Hub17d

    The skill provides comprehensive instructions, guides, and workflows for debugging applications. All references and commands are educational and standard development practices. The documentation links belong to the skill author and present no security risks.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer6mo

    1/6 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at efebc44. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 5 months ago
Other metadata
metadata
{
  "author": "https://github.com/Jeffallan",
  "version": "1.1.0",
  "domain": "quality",
  "triggers": "debug, error, bug, exception, traceback, stack trace, troubleshoot, not working, crash, fix issue",
  "role": "specialist",
  "scope": "analysis",
  "output-format": "analysis",
  "related-skills": "test-master, fullstack-guardian, monitoring-expert"
}

README badge

README badge for jeffallan/claude-skills/debugging-wizard