node-inspect-debugger
moltbot/clawdbot/skills/node-inspect-debugger/SKILL.md
Debug Node.js with node inspect, --inspect, breakpoints, CDP, heap, and CPU profiles.
Skill392k starsChanged yesterday
What's in it
- Node Inspect Debugger
---
name: node-inspect-debugger
description: Debug Node.js with node inspect, --inspect, breakpoints, CDP, heap, and CPU profiles.
metadata: { "openclaw": { "emoji": "🪲", "requires": { "bins": ["node"] } } }
---
# 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`
- OpenClaw CLI path: `node --inspect-brk openclaw.mjs ...`
- OpenClaw test path: `OPENCLAW_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:
```bash
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:
```js
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.
More agent context in moltbot/clawdbot
107 other files this repository gives its agents, the first 60 shown.
Skill
- agent-transcript.agents/skills/agent-transcript/SKILL.md
- auto-qa.agents/skills/auto-qa/SKILL.md
- autoreview.agents/skills/autoreview/SKILL.md
- channel-message-flows.agents/skills/channel-message-flows/SKILL.md
- clawdtributor.agents/skills/clawdtributor/SKILL.md
- claw-score.agents/skills/claw-score/SKILL.md
- clawsweeper.agents/skills/clawsweeper/SKILL.md
- control-ui-e2e.agents/skills/control-ui-e2e/SKILL.md
- crabbox.agents/skills/crabbox/SKILL.md
- discord-clawd.agents/skills/discord-clawd/SKILL.md
- discord-e2e.agents/skills/discord-e2e/SKILL.md
- discord-user-post.agents/skills/discord-user-post/SKILL.md
- discrawl.agents/skills/discrawl/SKILL.md
- gitcrawl.agents/skills/gitcrawl/SKILL.md
- graincrawl.agents/skills/graincrawl/SKILL.md
- notcrawl.agents/skills/notcrawl/SKILL.md
- openclaw-changelog-update.agents/skills/openclaw-changelog-update/SKILL.md
- openclaw-ci-limits.agents/skills/openclaw-ci-limits/SKILL.md
- openclaw-debugging.agents/skills/openclaw-debugging/SKILL.md
- openclaw-docker-e2e-authoring.agents/skills/openclaw-docker-e2e-authoring/SKILL.md
- openclaw-ghsa-maintainer.agents/skills/openclaw-ghsa-maintainer/SKILL.md
- openclaw-live-updater.agents/skills/openclaw-live-updater/SKILL.md
- openclaw-parallels-smoke.agents/skills/openclaw-parallels-smoke/SKILL.md
- openclaw-pr-maintainer.agents/skills/openclaw-pr-maintainer/SKILL.md
- openclaw-qa-testing.agents/skills/openclaw-qa-testing/SKILL.md
- openclaw-refactor-docs.agents/skills/openclaw-refactor-docs/SKILL.md
- openclaw-release-validation.agents/skills/openclaw-release-validation/SKILL.md
- openclaw-repair-sweep.agents/skills/openclaw-repair-sweep/SKILL.md
- openclaw-secret-scanning-maintainer.agents/skills/openclaw-secret-scanning-maintainer/SKILL.md
- openclaw-test-heap-leaks.agents/skills/openclaw-test-heap-leaks/SKILL.md
- openclaw-testing.agents/skills/openclaw-testing/SKILL.md
- openclaw-test-performance.agents/skills/openclaw-test-performance/SKILL.md
- openclaw-update.agents/skills/openclaw-update/SKILL.md
- parallels-discord-roundtrip.agents/skills/parallels-discord-roundtrip/SKILL.md
- plugin-sdk-impact.agents/skills/plugin-sdk-impact/SKILL.md
- proof-video.agents/skills/proof-video/SKILL.md
- prototype-openclaw-tui.agents/skills/prototype-openclaw-tui/SKILL.md
- pr-simplify.agents/skills/pr-simplify/SKILL.md
- release-openclaw-announcement.agents/skills/release-openclaw-announcement/SKILL.md
- release-openclaw-ci.agents/skills/release-openclaw-ci/SKILL.md
- release-openclaw-mac.agents/skills/release-openclaw-mac/SKILL.md
- release-openclaw-maintainer.agents/skills/release-openclaw-maintainer/SKILL.md
- release-openclaw-plugin-testing.agents/skills/release-openclaw-plugin-testing/SKILL.md
- security-triage.agents/skills/security-triage/SKILL.md
- slack-e2e.agents/skills/slack-e2e/SKILL.md
- slacrawl.agents/skills/slacrawl/SKILL.md
- solid.agents/skills/solid/SKILL.md
- tag-duplicate-prs-issues.agents/skills/tag-duplicate-prs-issues/SKILL.md
- technical-documentation.agents/skills/technical-documentation/SKILL.md
- telegram-e2e-userbot.agents/skills/telegram-e2e-userbot/SKILL.md
- test-audit.agents/skills/test-audit/SKILL.md
- update-team-server.agents/skills/update-team-server/SKILL.md
- verify-release.agents/skills/verify-release/SKILL.md
- 1passwordskills/1password/SKILL.md
Also found in 9 other repositories
The same file, byte for byte, in the weekly crawl of public GitHub.
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool registry_write, action report. How to connect one.

