node-inspect-debugger · openclaw — скилл для Claude Code: установка
Скилл node-inspect-debugger для Claude Code отлаживает Node.js через node inspect: брейкпоинты, зависания async-кода, CPU-профили и heap snapshot. Разбирает причины, не видимые по логам.
MIT 299 установок ★ 395 001 обновлён 2026-10-25
npx skills add openclaw/openclaw --skill node-inspect-debugger -a claude-codeЧто делает node-inspect-debugger
Скилл учит агента отлаживать Node.js через инспектор: ставить брейкпоинты и смотреть локальные переменные. Подходит для зависших async-вызовов, нестабильных тестов, гонок на старте, дочерних процессов, роста памяти и горячих мест по CPU. По умолчанию агент берёт node inspect, а Chrome DevTools Protocol подключает, когда нужны брейкпоинты из скрипта, автоматический снимок состояния, heap snapshot или CPU-профиль.
Внутри — шпаргалка по REPL отладчика (cont, next, step, sb(...), bt, watch), запуск для TypeScript, подключение к работающему процессу по PID (kill -SIGUSR1 <pid>, затем node inspect -p <pid>) и минимальный драйвер на chrome-remote-interface. Инструменты CDP скилл советует ставить в /tmp/cdp-tools, а не в проект. Профили пишутся в /tmp/profile.cpuprofile и /tmp/heap.heapsnapshot. Есть и строки запуска для OpenClaw CLI и его раннера Vitest.
--inspect процесс не останавливает: если настройку нужно сделать до первой строки кода, нужен --inspect-brk. В окружении должен быть node. Инспектор лучше держать на 127.0.0.1, а --inspect=0.0.0.0 скилл не советует открывать вне изолированной сети.
Какие задачи решает
- найти, почему async-код завис и не завершается
- подключиться к уже запущенному процессу по PID и посмотреть локальные переменные
- остановить дочерний процесс на старте через
NODE_OPTIONS=--inspect-brk - снять CPU-профиль и открыть его в Chrome DevTools
- сделать heap snapshot, когда память растёт
Примеры запросов агенту
- Отладь
path/to/script.jsчерезnode inspect: поставь брейкпоинт на строке 42 и покажи локальные переменные. - Подключись к процессу с PID
<pid>черезnode inspect -pи скажи, где он завис. - Сними CPU-профиль работающего Node.js-процесса и сохрани его в
/tmp/profile.cpuprofile.
Как установить node-inspect-debugger
1Через Skills CLI (Vercel)
npx skills add openclaw/openclaw --skill node-inspect-debugger -a claude-code2Вручную: положить файлы
~/.claude/skills/node-inspect-debugger/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/node-inspect-debugger/
1Через Skills CLI (Vercel)
npx skills add openclaw/openclaw --skill node-inspect-debugger -a codex2Вручную: положить файлы
.agents/skills/node-inspect-debugger/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add openclaw/openclaw --skill node-inspect-debugger -a cursor2Вручную: положить файлы
.cursor/skills/node-inspect-debugger/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install openclaw/openclaw skills/node-inspect-debugger2Вручную: положить файлы
.github/skills/node-inspect-debugger/SKILL.md1Через Skills CLI (Vercel)
npx skills add openclaw/openclaw --skill node-inspect-debugger -a gemini-cli2Командой платформы
gemini skills install https://github.com/openclaw/openclaw --path skills/node-inspect-debuggerВручную: положить файлы
.devin/skills/node-inspect-debugger/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add openclaw/openclaw --skill node-inspect-debugger -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о node-inspect-debugger
Как установить node-inspect-debugger в Claude Code?
Выполните npx skills add openclaw/openclaw --skill node-inspect-debugger -a claude-code. Файл скилла окажется в ~/.claude/skills/node-inspect-debugger/SKILL.md.
Что делает node-inspect-debugger?
Даёт агенту порядок работы с инспектором Node.js: запуск с --inspect-brk, подключение по PID, команды REPL отладчика и снятие CPU и heap профилей.
Когда нужен CDP, а когда хватит node inspect?
Скилл начинает с node inspect. К Chrome DevTools Protocol переходит, когда нужны брейкпоинты из скрипта, автоматический сбор состояния, heap snapshot или CPU-профиль.
Исходный текст
SKILL.md · MIT
---
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.
© openclaw · MIT · openclaw/openclaw
Похожие скиллы
Все скиллы по теме «Бэкенд и API» →Сначала — node-inspect-debugger от других авторов.