m4an5you6/aspera-agent/node-inspect-debugger
Claude Code and agent skill by m4an5you6/aspera-agent
- community
Checking that the SKILL.md file is still in the repository.
Debug Node.js via --inspect + Chrome DevTools Protocol CLI.
Install
npx vskill@latest install m4an5you6/aspera-agent/node-inspect-debuggerSKILL.md
The same SKILL.md was published earlier as m4an5you6/aspera-agent/node-inspect-debugger.
Node.js Inspect Debugger
Overview
When console.log isn't enough, drive Node's built-in V8 inspector programmatically from the terminal. You get real breakpoints, step in/over/out, call-stack walking, local/closure scope dumps, and arbitrary expression evaluation in the paused frame.
Two tools, pick one:
- `node inspect` — built-in, zero install, CLI REPL. Best for quick poking.
- `ndb` / CDP via `chrome-remote-interface` — scriptable from Node/Python; best when you want to automate many breakpoints, collect state across runs, or debug non-interactively from an agent loop.
Prefer `node inspect` first. It's always available and the REPL is fast.
When to Use
- A Node test fails and you need to see intermediate state
- ui-tui crashes or behaves wrong and you want to inspect React/Ink state pre-render
- tui_gateway child processes (
_SlashWorker, PTY bridge workers) misbehave - You need to inspect a value in a closure that
console.logcan't reach without patching - Perf: 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. Breakpoint-driven debugging is heavier; use it when the payoff is real.
Quick Reference: node inspect REPL
Launch paused on first line:
The debug> prompt accepts:
| Command | Action | |
|---|---|---|
c or cont | continue | |
n or next | step over | |
s or step | step into | |
o or out | step out | |
pause | pause running code | |
sb('file.js', 42) | set breakpoint at file.js line 42 | |
sb(42) | set breakpoint at line 42 of current file | |
sb('functionName') | break when function is called | |
cb('file.js', 42) | clear breakpoint | |
breakpoints | list all breakpoints | |
bt | backtrace (call stack) | |
list(5) | show 5 lines of source around current position | |
watch('expr') | evaluate expr on every pause | |
watchers | show watched expressions | |
repl | drop into REPL in current scope (Ctrl+C to exit REPL) | |
exec expr | evaluate expression once | |
restart | restart script | |
kill | kill the script | |
.exit | quit debugger |
In the `repl` sub-mode: type any JS expression, including access to locals/closure variables. Ctrl+C exits back to debug>.
Attaching to a Running Process
When the process is already running (e.g. a long-lived dev server or the TUI gateway):
To start a process with the inspector from the beginning:
For TypeScript via tsx:
Programmatic CDP (scripting from terminal)
When you want to automate — set many breakpoints, capture scope state, script a repro — use chrome-remote-interface:
Driver script (save as /tmp/cdp-debug.js):
Run it:
GPUCLOUD-specific note: chrome-remote-interface is NOT in ui-tui/package.json. Install it to a throwaway location if you don't want to dirty the project:
Debugging GPUCLOUD ui-tui
The TUI is built Ink + tsx. Two common scenarios:
Debugging a single Ink component under dev
ui-tui/package.json has npm run dev (tsx --watch). Add --inspect-brk by running tsx directly:
Then inside debug>:
When it pauses, repl → inspect props, state refs, useInput handler values, etc.
Debugging a running gpucloud --tui
The TUI spawns Node from the Python CLI. Easiest path:
Interacting with the TUI (typing in its window) continues to advance execution; your debugger can pause it on a breakpoint at any sb(...).
Debugging _SlashWorker / PTY child processes
Those are Python, not Node — use the python-debugpy skill for them. Only Node portions (Ink UI, tui_gateway client, tsx-run tests under ui-tui/) use this skill.
Running Vitest Tests Under the Debugger
In another terminal: node inspect -p <pid>, then sb('src/app/foo.tsx', 42), cont.
Use --no-file-parallelism (vitest) or --runInBand (jest) so only one worker exists — debugging a pool is painful.
Heap Snapshots & CPU Profiles (Non-interactive)
From the CDP driver above, swap Debugger for HeapProfiler / Profiler:
Common Pitfalls
- Wrong line numbers in TS source. Breakpoints hit the emitted JS, not the
.ts. Either (a) break in the builtdist/*.js, or (b) enable sourcemaps (node --enable-source-maps) and usesb('src/app.tsx', N)— but only with CDP clients that follow sourcemaps.node inspectCLI does not.
- `--inspect` vs `--inspect-brk`.
--inspectstarts the inspector but doesn't pause; your script races past your first breakpoint if you attach too late. Use--inspect-brkwhen you need to set breakpoints before any code runs.
- Port collisions. Default is
9229. If multiple Node processes are inspecting, pass--inspect=0(random port) and read the actual URL from/json/list:
``bash curl -s http://127.0.0.1:9229/json/list # lists all inspectable targets on the host ``
- Child processes.
--inspecton a parent does NOT inspect its children. UseNODE_OPTIONS='--inspect-brk' node parent.jsto propagate to every child; be aware they all need unique ports (Node auto-increments whenNODE_OPTIONS='--inspect'is inherited).
- Background kills. If you
Ctrl+Cout ofnode inspectwhile the target is paused, the target stays paused. Eithercontfirst, orkillthe target explicitly.
- Running `node inspect` through an agent terminal. It's a PTY-friendly REPL. In GPUCLOUD, launch it with
terminal(pty=true)orbackground=true+process(action='submit', data='...'). Non-PTY foreground mode will work for one-shot commands but not for interactive stepping.
- Security.
--inspect=0.0.0.0:9229exposes arbitrary code execution. Always bind to127.0.0.1(the default) unless you have an isolated network.
Verification Checklist
After setting up a debug session, verify:
- [ ]
curl -s http://127.0.0.1:9229/json/listreturns exactly the target you expect - [ ] First breakpoint actually hits (if it doesn't, you likely missed
--inspect-brkor attached after execution completed) - [ ] Source listing at pause shows the right file (mismatch = sourcemap issue, see pitfall 1)
- [ ]
exec process.pidinreplreturns the PID you meant to attach to
One-Shot Recipes
"Why is this variable undefined at line X?"
"What's the call path into this function?"
"This async chain hangs — where?"
Security
- Security scanPassed, 96 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/software-development/node-inspect-debugger/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/m4an5you6/aspera-agent/node-inspect-debugger)