node-inspect-debugger
Debug Node.js via --inspect + Chrome DevTools Protocol CLI.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- node-inspect-debugger
- author
- Hermes Agent, ported for CrusorAI
- license
- MIT
- version
- 1.1.0
- metadata
- { "hermes": { "tags": [ "debugging", "nodejs", "node-inspect", "cdp", "breakpoints" ], "related_skills": [ "systematic-debugging", "python-debugpy" ] } }
- platforms
- [ "linux", "macos", "windows" ]
- description
- Debug Node.js via --inspect + Chrome DevTools Protocol CLI.
03 SKILL.md 正文
Triggers: node inspect, node --inspect, node, node debugger, javascript debugger, cdp debugger, node breakpoint, v8 inspector, debug node
Node.js Inspect Debugger
Overview
When console.log isn't enough, drive Node's built-in V8 inspector from the terminal: real breakpoints, step in/over/out, call stacks, scope dumps, expression evaluation in the paused frame.
Two tools: node inspect (built-in, zero install, CLI REPL — prefer first) and --inspect + CDP (scriptable, for automating breakpoints or attaching to running dev servers like the Crusor webview's Vite server).
When to Use
- A Node test fails and you need intermediate state
- A Vite/React dev server or Electron main process misbehaves and you can't reproduce with prints
- You need a value from a closure that
console.logcan't reach without patching - Attach to a running process to capture a CPU profile or heap snapshot
Don't use for: things console.log solves in under a minute.
node inspect REPL Quick Reference
Launch paused on the first line (all through run_terminal):
node inspect path/to/script.js
node --inspect-brk $(which tsx) path/to/script.ts # TypeScript via tsx
| Command | Action |
|---|---|
c / n / s / o |
continue / step over / step into / step out |
sb('file.js', 42) |
breakpoint at file.js line 42 (cb clears) |
bt |
backtrace |
list(5) |
5 lines of source around the current position |
watch('expr') + watchers |
evaluate expr on every pause |
repl |
REPL in current scope — read locals/closures (Ctrl+C to exit) |
exec expr |
evaluate once |
restart / kill / .exit |
restart / kill / quit |
Attaching to a Running Process
kill -SIGUSR1 <pid> # enable inspector on an existing Node process
node inspect -p <pid> # attach the CLI
node --inspect script.js # or start listening on 127.0.0.1:9229
node --inspect-brk script.js # listen AND pause on first line
Scripted CDP (when the REPL is too slow)
npm i chrome-remote-interface
node -e "
const CDP = require('chrome-remote-interface');
(async () => {
const client = await CDP({port: 9229});
await client.Runtime.enable();
// set breakpoints, step, evaluate — collect state across runs
await client.Runtime.evaluate({expression: '1+1'});
})().catch(console.error);
"
Rule: prefer node inspect first; script CDP only when you need many breakpoints or non-interactive runs.
With systematic-debugging
This skill is the instrument; systematic-debugging is the method. Form the hypothesis first, then use a breakpoint to prove/disprove it — don't fish.
Integration notes
- Everything runs through
run_terminal(guarded); interactive REPLs are awkward in agent loops — prefer--inspect-brk+ CDP scripting, orexec/watchcommands driven non-interactively viaprintf 'sb(42)\nc\nwatchers\n' | node inspect script.js. - Never leave
--inspectenabled in committed start scripts — it's a remote-code-execution port.
04 同仓库更多 Skills
interaction-patterns-architect
Architect-level interaction design in code — choosing established patterns over invented ones, feedback and latency behaviour, destructive-action safeguards, navigation and overlay conventions, and the state model behind every interactive surface. Use when a screen has to behave, not just look.
design-system-ops-architect
Architect-level operation of a design system in code — token pipelines and versioning, component API and variant policy, the catalogue as the contract, adoption metrics, and the governance that stops a system from forking into three. Use when a component library must survive several teams.
design-handoff-architect
Architect-level design handoff — what must be specified before implementation starts, tokens over raw values, responsive and content-limit contracts, state matrices, and the review loop that catches drift between design and code. Use when a design is about to become code.
content-microcopy-architect
Architect-level UI content — where strings live, voice and terminology consistency, error and empty-state copy as part of the interface, translation-ready authoring, and the content model a product needs before it multiplies screens. Use when the words in the interface matter as much as the pixels.
ui-ux-implementation-architect
Architect-level direction for turning a design into working UI — the handoff contract, component ownership versus screen-level layout, interaction and state conventions, design QA gates, and the review habits that keep an implementation faithful without frozen pixels. Use before any specific UI implementation skill.
test-strategy-architect
Architect-level test strategy — allocating assertions across unit, integration, contract and end-to-end layers, designing for testability through dependency boundaries, fixture and data strategy, and the flake and coverage policies that keep a suite trustworthy. Use when defining how a codebase is tested.