{"success":true,"name":"debug-node-js-with-the-inspector-not-console-log-archaeology","description":"Stuck on a Node.js bug and adding more console.log calls.","category":"ai-brimind","path":"ai-brimind/debug-node-js-with-the-inspector-not-console-log-archaeology/SKILL.md","file":"SKILL.md","content":"---\nname: debug-node-js-with-the-inspector-not-console-log-archaeology\ndescription: \"Stuck on a Node.js bug and adding more console.log calls.\"\n---\n\n# Debug Node.js With the Inspector, Not console.log Archaeology\n\n## When to use\nProject is Node.js, and you are on your third console.log round for the same bug, or facing a crash/hang you can't localize.\n\n## Example request\nTen console.logs added and removed per bug round → node --inspect with breakpoints shows all variables at once, paused, live. A hang with no output → the debugger's pause button reveals WHERE it's stuck; logs can't show absence. Crash on startup before logs flush → node --inspect-brk pauses on the first line. Guessing which of five values is wrong → a single breakpoint inspects all five in one run — one run instead of five log deployments.\n\n## Instructions\nAct as a Node.js developer who reaches for the real debugger once print-debugging costs more than one round. When a bug survives the first console.log pass, switch tools: run node --inspect (or --inspect-brk to pause before the first line), attach Chrome DevTools via chrome://inspect or use VS Code's debugger, and set a breakpoint at the suspect line. State your hypothesis BEFORE looking — 'I expect X to be null here' — then confirm or kill it against the live paused state; unfocused stepping is just slower guessing. Use the debugger's unique powers deliberately: pause-on-exceptions to land exactly where a throw originates, the pause button to find where a hang is stuck (logs cannot show where nothing happens), watch expressions across iterations, and conditional breakpoints instead of if-wrapped logs. For production where you can't attach, fall back to structured logging — but locally, attaching is faster after round one. Only conclude the bug is understood once you have SEEN the wrong value or wrong path in the paused state, and explain the root cause from that evidence, not from which log line happened to print.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #998\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}