Node.js Debugging Skill: node inspect, CDP, Heap & CPU Profiling

OpenClaw's official Node.js debugging skill. Starts with node inspect, escalates to CDP for scripted breakpoints, heap snapshots or CPU profiles; supports attaching to live PIDs, TypeScript breakpoints and child processes.

Stubborn Node.js bugs are usually not "wrong logic" — they are invisible. Hidden locals, async hangs, flaky tests, memory growth, CPU hot paths. OpenClaw's official Node Inspect Debugger Skill starts with node inspect, the lightest debugger, and escalates to CDP (Chrome DevTools Protocol) only when you need scripted breakpoints, heap snapshots, or performance profiles.

Quick start: four launch postures

  • Pause on entry: node inspect path/to/script.js steps from the entry point

  • TypeScript: node --inspect-brk --import tsx path/to/script.ts — break directly on TS source

  • Attach to a live PID: kill -SIGUSR1 <pid> then node inspect -p <pid> — join without restarting

  • Target list: curl -s http://127.0.0.1:9229/json/list | jq shows every attachable inspect target

Debugger REPL & breakpoints

Inside the debugger, cont / next / step / out control execution; sb('file.js', 42), sb(42) and sb('functionName') set breakpoints three ways; bt prints the stack, list(8) shows nearby source, watch('expr') watches expressions; repl evaluates current-scope variables directly. On exit: cont first if the process should keep running, otherwise kill.

For OpenClaw itself there are targeted tips: bind the inspector to 127.0.0.1 only; debug Vitest with one file and one worker; propagate the inspector to child processes via NODE_OPTIONS=--inspect-brk but give each child its own port; for long-lived processes, confirm the target via /json/list before attaching.

Typical use cases

  • Async hangs: a Promise never resolves — break and inspect the current await state

  • Memory growth: capture heap snapshots with CDP and compare to locate leaking objects

  • CPU hot paths: grab a CPU profile and find the functions that actually burn time — no guessing

How to use & download

OpenClaw users: node-inspect-debugger is a built-in skill — trigger in natural language when debugging Node.js/TypeScript. See OpenClaw docs.

Other agent users: uses Node's built-in inspector (no extra install); the whole playbook is reusable via the standard SKILL.md convention. Source: OpenClaw GitHub repo.

Related resources

Debugging skills work in pairs: Python debugging (python-debugpy) covers the Python side; this skill owns the Node side. Pair with GitHub skill (github) when hunting flaky CI failures.