🎁 Get the FREE AI Skills Starter Guide β€” Subscribe β†’
BytesAgainBytesAgain
πŸ¦€ ClawHub

Node Auto Debugger

by @jengajojo

Scan Node.js/Express/Next.js projects for bugs, security issues, and anti-patterns. Use when debugging a Node.js web app, running code audits, fixing client-...

Versionv1.0.0
Downloads757
TERMINAL
clawhub install node-auto-debugger

πŸ“– About This Skill


name: node-auto-debugger description: Scan Node.js/Express/Next.js projects for bugs, security issues, and anti-patterns. Use when debugging a Node.js web app, running code audits, fixing client-side exceptions, hydration errors, hardcoded secrets, missing error handling, or preparing for production. Covers backend (Express/Fastify routes, async errors, undefined vars) and frontend (Next.js/React hydration, SSR crashes, wagmi/RainbowKit issues, missing 'use client' directives) plus config validation and optional build verification.

Node.js Auto Debugger

Automated scanner for Node.js projects β€” finds bugs across backend, frontend, and config.

Quick Start

node scripts/auto-debug.js 

Options:

  • --build β€” Also run npm run build and capture compilation errors
  • What It Checks

    Backend (Express/Fastify)

  • Undefined variables β€” .push() on undeclared variables
  • Missing try/catch β€” async route handlers without error handling
  • Hardcoded secrets β€” API keys, private keys, passwords in source
  • Frontend (Next.js/React)

  • Missing 'use client' β€” hooks or browser APIs without directive
  • Hydration risks β€” Date.now(), Math.random() in render (should be in useEffect or useState)
  • SSR crashes β€” window/document access outside useEffect
  • Missing loading states β€” wagmi hooks without isLoading/isFetching
  • Config

  • Missing next.config.js β€” defaults warning
  • Missing build script β€” package.json validation
  • Output

    Report saved to /AUTO-DEBUG-REPORT.md with issues grouped by severity:

  • πŸ”΄ Critical β€” will crash or leak secrets
  • 🟠 High β€” likely runtime errors
  • 🟑 Medium β€” hydration mismatches, missing loading states
  • 🟒 Low β€” minor issues
  • Exit code: 1 if any critical issues found, 0 otherwise.

    Fixing Hydration Issues (Next.js)

    Date.now()/new Date() in render:

    // ❌ Bad β€” causes hydration mismatch
    const now = Math.floor(Date.now() / 1000);

    // βœ… Good β€” guard with isMounted const [isMounted, setIsMounted] = useState(false); useEffect(() => { setIsMounted(true); }, []); const now = isMounted ? Math.floor(Date.now() / 1000) : 0;

    Math.random() in render:

    // ❌ Bad β€” different on server vs client
    
    ${Math.random() * 100}% }} />

    // βœ… Good β€” pre-generate in useState (runs once) const [particles] = useState(() => Array.from({ length: 10 }, () => ({ left: ${Math.random() * 100}%, })) );

    window/document access:

    // ❌ Bad β€” crashes during SSR
    const width = window.innerWidth;

    // βœ… Good β€” only after mount const [width, setWidth] = useState(0); useEffect(() => setWidth(window.innerWidth), []);

    πŸ’‘ Examples

    node scripts/auto-debug.js 
    

    Options:

  • --build β€” Also run npm run build and capture compilation errors
  • βš™οΈ Configuration

  • Missing next.config.js β€” defaults warning
  • Missing build script β€” package.json validation