Skill metadata
Reference: full SKILL.md
The following is the complete skill definition that Mibyan loads when this skill is triggered. This is what the agent sees as instructions when the skill is active.
Node.js Inspect Debugger
Overview
Whenconsole.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 viachrome-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.
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
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:
debug> prompt accepts:
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):Programmatic CDP (scripting from terminal)
When you want to automate — set many breakpoints, capture scope state, script a repro — usechrome-remote-interface:
~/.mibyan/cache/scratch/cdp-debug.js):
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 Mibyan 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:
debug>:
repl → inspect props, state refs, useInput handler values, etc.
Debugging a running mibyan --tui
The TUI spawns Node from the Python CLI. Easiest path:
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
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 forHeapProfiler / 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. -
--inspectvs--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: -
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 inspectthrough an agent terminal. It’s a PTY-friendly REPL. In Mibyan, launch it withterminal(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

