Systematic Debugging Tools

•
6
•

Facilitates rapid bug identification and resolution through standardized log injection, pattern recognition, and runtime analysis.

The Debugging Skill provides a structured framework for troubleshooting complex software issues within Claude Code. It implements a standardized logging format designed for efficient grep filtering and automated cleanup, offering specialized patterns for React, Next.js, and Node.js environments. By utilizing confidence scoring and predefined bug patterns—such as race conditions and stale closures—it helps developers pinpoint root causes faster while integrating seamlessly with MCP tools like Console Ninja and Chrome DevTools for deeper runtime inspection.

Key Features

01Comprehensive diagnostic table for common issues like race conditions and null access
02Direct integration with Console Ninja and Chrome DevTools for runtime visibility
036 GitHub stars
04Predefined log patterns for React hooks, Express routes, and API lifecycles
05Confidence scoring system to prioritize and report probable root causes
06Standardized [DEBUG] log format for easy grep identification and automated cleanup

Use Cases

01Verifying API request/response payloads and error handling in real-time
02Diagnosing intermittent race conditions in asynchronous Node.js operations
03Troubleshooting silent failures in React state management or useEffect hooks
name description context
debugging
Guide for debugging with targeted log injection and runtime analysis
fork

Debugging Skill

Guide for debugging with targeted log injection and runtime analysis.

When to Activate

Suggest /debug-tools:debug when users describe:

  • "X is not working"
  • "Getting error Y when doing Z"
  • "Something broke after [change]"
  • Silent failures or unexpected behavior

Log Format

console.log('[DEBUG] [file:line] description', { values });
  • [DEBUG] - Prefix for grep and cleanup
  • [file:line] - Location for navigation
  • description - What this log checks
  • { values } - Relevant data (no sensitive info)

Log Patterns

React/Next.js

// Lifecycle
console.log('[DEBUG] [Component.tsx:10] mount', { props });

// Effect
useEffect(() => {
  console.log('[DEBUG] [Component.tsx:15] effect run', { deps });
  return () => console.log('[DEBUG] [Component.tsx:17] cleanup');
}, [deps]);

// State
console.log('[DEBUG] [Component.tsx:25] before setState', { current: state });

Node.js/Express

// Request
console.log('[DEBUG] [route.ts:10] request', { method: req.method, path: req.path });

// Error
console.log('[DEBUG] [service.ts:30] caught error', { name: err.name, message: err.message });

API Calls

console.log('[DEBUG] [api.ts:10] fetch start', { url, method });
console.log('[DEBUG] [api.ts:15] fetch done', { status: res.status, ok: res.ok });

Common Bug Patterns

Pattern Symptom Check
Null access "Cannot read property X of undefined" Optional chaining, defaults
Race condition Works sometimes, fails randomly Async ordering, state timing
Stale closure Using old values in callbacks useCallback deps, event bindings
API mismatch Data not displaying Response shape, null handling
Silent error Nothing happens Empty catch blocks, missing error state

Confidence Scoring

Score Meaning Action
>= 70 High - clear evidence Report as probable cause
50-69 Medium - possible Suggest logs to confirm
< 50 Low - speculation Do not report

Cleanup

After debugging, all [DEBUG] logs are removed automatically.

Manual check:

grep -rn '\[DEBUG\]' . --include='*.ts' --include='*.tsx' --include='*.js' --include='*.jsx'

MCP Integration

MCP Provides
Console Ninja Runtime values, test status, coverage
Chrome DevTools Network inspection, browser console, DOM state