node-inspect-debugger

A debugging guide for Node.js programs, covering pauses, breakpoints, running state, memory use, and processor-heavy code.

In plain words
What is it for?
Use it to inspect a running Node.js process, step through JavaScript or TypeScript code, investigate child processes, or create memory and CPU reports.
Why use it?
It helps find problems that ordinary logs may not explain, such as stuck asynchronous work, flaky tests, startup races, and memory growth.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/subhansh-dev/agent-maxxing/25-node-inspect-debugger
Any agent
npx skills add subhansh-dev/agent-maxxing --skill 25-node-inspect-debugger
Clone the repo
git clone --depth 1 https://github.com/subhansh-dev/agent-maxxing

Made for: Claude Code, Codex.

Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 925 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00028 $0.00925
Opus 5 $0.00014 $0.00463
Sonnet 5 $0.00006 $0.00185
Haiku 4.5 $0.00003 $0.00093

Measured 2d ago against content hash e6dcd0a54d91, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

node-inspect-debugger scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- Inspect target list: `curl -s http://127.0.0.1:9229/json/list | jq`
engineering/25-NODE-INSPECT-DEBUGGER/SKILL.md · 86 lines

What it actually says

Node Inspect Debugger

Use for Node.js debugging that needs inspector access: hidden locals, async hangs, flaky tests, child processes, startup races, memory growth, or CPU hot paths.

Default to node inspect first. Use Chrome DevTools Protocol only when you need scripted breakpoints, automated state capture, heap snapshots, or CPU profiles.

Quick start

  • Pause on entry: node inspect path/to/script.js
  • TypeScript: node --inspect-brk --import tsx path/to/script.ts
  • Existing PID: kill -SIGUSR1 <pid> then node inspect -p <pid>
  • Inspect target list: curl -s http://127.0.0.1:9229/json/list | jq
  • Agent CLI path: node --inspect-brk agent.mjs ...
  • Agent test path: AGENT_VITEST_MAX_WORKERS=1 node --inspect-brk scripts/run-vitest.mjs <file>

Debugger REPL

  • Continue/step: cont, next, step, out, pause
  • Breakpoints: sb('file.js', 42), sb(42), sb('functionName'), breakpoints, cb('file.js', 42)
  • Inspect: bt, list(8), watch('expr'), exec expr
  • Current scope: repl, then evaluate locals directly; Ctrl+C exits repl mode.
  • Exit safely: cont before quitting if the process should continue; otherwise kill.

OpenClaw tips

  • Prefer 127.0.0.1 inspector binds. Do not expose --inspect=0.0.0.0 unless the network is isolated.
  • For Vitest, debug one file with one worker. Avoid worker pools while stepping.
  • For TS source breakpoints, use --enable-source-maps when useful; node inspect can still show emitted paths.
  • For child processes, NODE_OPTIONS=--inspect-brk can propagate the inspector, but each child needs its own port.
  • For long-lived gateway or dev processes, attach by PID after confirming the target with /json/list.

Programmatic CDP

Install tooling outside the repo unless the project already depends on it:

mkdir -p /tmp/cdp-tools
npm --prefix /tmp/cdp-tools i chrome-remote-interface
NODE_PATH=/tmp/cdp-tools/node_modules node /tmp/cdp-debug.cjs

Minimal driver:

const CDP = require("chrome-remote-interface");

(async () => {
  const client = await CDP({ port: 9229 });
  const { Debugger, Runtime } = client;

  Debugger.paused(async ({ callFrames, reason }) => {
    const top = callFrames[0];
    console.log("paused", reason, top.url, top.location.lineNumber + 1);
    const { result } = await Debugger.evaluateOnCallFrame({
      callFrameId: top.callFrameId,
      expression: "JSON.stringify({ pid: process.pid })",
    });
    console.log(result.value ?? result.description);
    await Debugger.resume();
  });

  await Runtime.enable();
  await Debugger.enable();
  await Debugger.setBreakpointByUrl({ urlRegex: ".*target\\.js$", lineNumber: 41 });
  await Runtime.runIfWaitingForDebugger();
})();

Profiles

  • CPU: enable Profiler, start, wait, stop, write /tmp/profile.cpuprofile, open in Chrome DevTools.
  • Heap: enable HeapProfiler, collect addHeapSnapshotChunk, call takeHeapSnapshot, write /tmp/heap.heapsnapshot.

Pitfalls

  • --inspect does not pause; use --inspect-brk when setup must happen before code runs.
  • Default port is 9229; use --inspect=0 or a unique port for parallel targets.
  • If a breakpoint misses, confirm file path, source map behavior, and whether execution already passed the line.
  • If the process appears frozen after detaching, it may still be paused in the debugger.
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 86 lines · 28 tokens per session scan A e6dcd0a54d91

Subscribe to this mod's changes

node-inspect-debugger is a skill published in the GitHub repository subhansh-dev/agent-maxxing (2 stars, last pushed 1mo ago), licensed MIT. It adds 28 tokens to every session and 925 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.