[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6DD7H90H5NMQTXJC2GBTTWW":3,"skill-same:01M6DD7H90H5NMQTXJC2GBTTWW":94},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":58,"commitSha":59,"skillDirectory":60,"forksCount":61,"repositoryHtmlUrl":62,"repositoryHomepageUrl":6,"ownerHtmlUrl":63,"ownerBlogUrl":6,"ownerDescription":64,"updatedAt":65,"install":66,"resources":79},"01M6DD7H90H5NMQTXJC2GBTTWW","node-inspect-debugger",null,"Debug Node.js via --inspect + Chrome DevTools Protocol CLI.","zapabob\u002FSkills","zapabob","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F130830376?v=4","01M6DBMYZAGRTFQDSQYW3W764P","峯岸 亮","01M6DBMZ3GKDSJ01NZ9XTZD7JD",2,"MIT","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Farchive\u002Fskill-md-reviewed\u002Fsha256\u002F24\u002F24bcedf106b95d4e425090bb6fcca15cd27783720608e001e671791d0d23d3ed\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"node inspect debugger","node","debugger","devtools","systematic","commands","cdp","tui","hermes agent","hermes","chrome devtools","cli","nodejs","protocol","debugging","debug","windows","chrome","linux","python","2026-11-10 10:12:30",false,"---\r\nname: node-inspect-debugger\r\ndescription: \"Debug Node.js via --inspect + Chrome DevTools Protocol CLI.\"\r\nversion: 1.0.0\r\nauthor: Hermes Agent\r\nlicense: MIT\r\nplatforms: [linux, macos, windows]\r\nmetadata:\r\n  hermes:\r\n    tags: [debugging, nodejs, node-inspect, cdp, breakpoints, ui-tui]\r\n    related_skills: [systematic-debugging, python-debugpy, debugging-hermes-tui-commands]\r\n---\r\n\r\n# Node.js Inspect Debugger\r\n\r\n## Overview\r\n\r\nWhen `console.log` isn't enough, drive Node's built-in V8 inspector programmatically from the terminal. You get real breakpoints, step in\u002Fover\u002Fout, call-stack walking, local\u002Fclosure scope dumps, and arbitrary expression evaluation in the paused frame.\r\n\r\nTwo tools, pick one:\r\n\r\n- **`node inspect`** — built-in, zero install, CLI REPL. Best for quick poking.\r\n- **`ndb` \u002F CDP via `chrome-remote-interface`** — scriptable from Node\u002FPython; best when you want to automate many breakpoints, collect state across runs, or debug non-interactively from an agent loop.\r\n\r\n**Prefer `node inspect` first.** It's always available and the REPL is fast.\r\n\r\n## When to Use\r\n\r\n- A Node test fails and you need to see intermediate state\r\n- ui-tui crashes or behaves wrong and you want to inspect React\u002FInk state pre-render\r\n- tui_gateway child processes (`_SlashWorker`, PTY bridge workers) misbehave\r\n- You need to inspect a value in a closure that `console.log` can't reach without patching\r\n- Perf: attach to a running process to capture a CPU profile or heap snapshot\r\n\r\n**Don't use for:** things `console.log` solves in under a minute. Breakpoint-driven debugging is heavier; use it when the payoff is real.\r\n\r\n## Quick Reference: `node inspect` REPL\r\n\r\nLaunch paused on first line:\r\n\r\n```bash\r\nnode inspect path\u002Fto\u002Fscript.js\r\n# or with tsx\r\nnode --inspect-brk $(which tsx) path\u002Fto\u002Fscript.ts\r\n```\r\n\r\nThe `debug>` prompt accepts:\r\n\r\n| Command | Action |\r\n|---|---|\r\n| `c` or `cont` | continue |\r\n| `n` or `next` | step over |\r\n| `s` or `step` | step into |\r\n| `o` or `out` | step out |\r\n| `pause` | pause running code |\r\n| `sb('file.js', 42)` | set breakpoint at file.js line 42 |\r\n| `sb(42)` | set breakpoint at line 42 of current file |\r\n| `sb('functionName')` | break when function is called |\r\n| `cb('file.js', 42)` | clear breakpoint |\r\n| `breakpoints` | list all breakpoints |\r\n| `bt` | backtrace (call stack) |\r\n| `list(5)` | show 5 lines of source around current position |\r\n| `watch('expr')` | evaluate expr on every pause |\r\n| `watchers` | show watched expressions |\r\n| `repl` | drop into REPL in current scope (Ctrl+C to exit REPL) |\r\n| `exec expr` | evaluate expression once |\r\n| `restart` | restart script |\r\n| `kill` | kill the script |\r\n| `.exit` | quit debugger |\r\n\r\n**In the `repl` sub-mode:** type any JS expression, including access to locals\u002Fclosure variables. `Ctrl+C` exits back to `debug>`.\r\n\r\n## Attaching to a Running Process\r\n\r\nWhen the process is already running (e.g. a long-lived dev server or the TUI gateway):\r\n\r\n```bash\r\n# 1. Send SIGUSR1 to enable the inspector on an existing process\r\nkill -SIGUSR1 \u003Cpid>\r\n# Node prints: Debugger listening on ws:\u002F\u002F127.0.0.1:9229\u002F\u003Cuuid>\r\n\r\n# 2. Attach the debugger CLI\r\nnode inspect -p \u003Cpid>\r\n# or by URL\r\nnode inspect ws:\u002F\u002F127.0.0.1:9229\u002F\u003Cuuid>\r\n```\r\n\r\nTo start a process with the inspector from the beginning:\r\n\r\n```bash\r\nnode --inspect script.js           # listen on 127.0.0.1:9229, keep running\r\nnode --inspect-brk script.js       # listen AND pause on first line\r\nnode --inspect=0.0.0.0:9230 script.js   # custom host:port\r\n```\r\n\r\nFor TypeScript via tsx:\r\n\r\n```bash\r\nnode --inspect-brk --import tsx script.ts\r\n# or older tsx\r\nnode --inspect-brk -r tsx\u002Fcjs script.ts\r\n```\r\n\r\n## Programmatic CDP (scripting from terminal)\r\n\r\nWhen you want to automate — set many breakpoints, capture scope state, script a repro — use `chrome-remote-interface`:\r\n\r\n```bash\r\nnpm i -g chrome-remote-interface        # or project-local\r\n# Start your target:\r\nnode --inspect-brk=9229 target.js &\r\n```\r\n\r\nDriver script (save as `\u002Ftmp\u002Fcdp-debug.js`):\r\n\r\n```javascript\r\nconst CDP = require('chrome-remote-interface');\r\n\r\n(async () => {\r\n  const client = await CDP({ port: 9229 });\r\n  const { Debugger, Runtime } = client;\r\n\r\n  Debugger.paused(async ({ callFrames, reason }) => {\r\n    const top = callFrames[0];\r\n    console.log(`PAUSED: ${reason} @ ${top.url}:${top.location.lineNumber + 1}`);\r\n\r\n    \u002F\u002F Walk scopes for locals\r\n    for (const scope of top.scopeChain) {\r\n      if (scope.type === 'local' || scope.type === 'closure') {\r\n        const { result } = await Runtime.getProperties({\r\n          objectId: scope.object.objectId,\r\n          ownProperties: true,\r\n        });\r\n        for (const p of result) {\r\n          console.log(`  ${scope.type}.${p.name} =`, p.value?.value ?? p.value?.description);\r\n        }\r\n      }\r\n    }\r\n\r\n    \u002F\u002F Evaluate an expression in the paused frame\r\n    const { result } = await Debugger.evaluateOnCallFrame({\r\n      callFrameId: top.callFrameId,\r\n      expression: 'typeof state !== \"undefined\" ? JSON.stringify(state) : \"n\u002Fa\"',\r\n    });\r\n    console.log('state =', result.value ?? result.description);\r\n\r\n    await Debugger.resume();\r\n  });\r\n\r\n  await Runtime.enable();\r\n  await Debugger.enable();\r\n\r\n  \u002F\u002F Set a breakpoint by URL regex + line\r\n  await Debugger.setBreakpointByUrl({\r\n    urlRegex: '.*app\\\\.tsx$',\r\n    lineNumber: 119,       \u002F\u002F 0-indexed\r\n    columnNumber: 0,\r\n  });\r\n\r\n  await Runtime.runIfWaitingForDebugger();\r\n})();\r\n```\r\n\r\nRun it:\r\n\r\n```bash\r\nnode \u002Ftmp\u002Fcdp-debug.js\r\n```\r\n\r\nHermes-specific note: `chrome-remote-interface` is NOT in `ui-tui\u002Fpackage.json`. Install it to a throwaway location if you don't want to dirty the project:\r\n\r\n```bash\r\nmkdir -p \u002Ftmp\u002Fcdp-tools && cd \u002Ftmp\u002Fcdp-tools && npm i chrome-remote-interface\r\nNODE_PATH=\u002Ftmp\u002Fcdp-tools\u002Fnode_modules node \u002Ftmp\u002Fcdp-debug.js\r\n```\r\n\r\n## Debugging Hermes ui-tui\r\n\r\nThe TUI is built Ink + tsx. Two common scenarios:\r\n\r\n### Debugging a single Ink component under dev\r\n\r\n`ui-tui\u002Fpackage.json` has `npm run dev` (tsx --watch). Add `--inspect-brk` by running tsx directly:\r\n\r\n```bash\r\ncd \u002Fhome\u002Fbb\u002Fhermes-agent\u002Fui-tui\r\nnpm run build    # produce dist\u002F once so transpile isn't needed on first load\r\nnode --inspect-brk dist\u002Fentry.js\r\n# In another terminal:\r\nnode inspect -p \u003Cnode pid>\r\n```\r\n\r\nThen inside `debug>`:\r\n\r\n```\r\nsb('dist\u002Fapp.js', 220)     # or wherever the suspect render is\r\ncont\r\n```\r\n\r\nWhen it pauses, `repl` → inspect `props`, state refs, `useInput` handler values, etc.\r\n\r\n### Debugging a running `hermes --tui`\r\n\r\nThe TUI spawns Node from the Python CLI. Easiest path:\r\n\r\n```bash\r\n# 1. Launch TUI\r\nhermes --tui &\r\nTUI_PID=$(pgrep -f 'ui-tui\u002Fdist\u002Fentry' | head -1)\r\n\r\n# 2. Enable inspector on that Node PID\r\nkill -SIGUSR1 \"$TUI_PID\"\r\n\r\n# 3. Find the WS URL\r\ncurl -s http:\u002F\u002F127.0.0.1:9229\u002Fjson\u002Flist | jq -r '.[0].webSocketDebuggerUrl'\r\n\r\n# 4. Attach\r\nnode inspect ws:\u002F\u002F127.0.0.1:9229\u002F\u003Cuuid>\r\n```\r\n\r\nInteracting with the TUI (typing in its window) continues to advance execution; your debugger can pause it on a breakpoint at any `sb(...)`.\r\n\r\n### Debugging `_SlashWorker` \u002F PTY child processes\r\n\r\nThose 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\u002F`) use this skill.\r\n\r\n## Running Vitest Tests Under the Debugger\r\n\r\n```bash\r\ncd \u002Fhome\u002Fbb\u002Fhermes-agent\u002Fui-tui\r\n# Run a single test file paused on entry\r\nnode --inspect-brk .\u002Fnode_modules\u002Fvitest\u002Fvitest.mjs run --no-file-parallelism src\u002Fapp\u002Ffoo.test.tsx\r\n```\r\n\r\nIn another terminal: `node inspect -p \u003Cpid>`, then `sb('src\u002Fapp\u002Ffoo.tsx', 42)`, `cont`.\r\n\r\nUse `--no-file-parallelism` (vitest) or `--runInBand` (jest) so only one worker exists — debugging a pool is painful.\r\n\r\n## Heap Snapshots & CPU Profiles (Non-interactive)\r\n\r\nFrom the CDP driver above, swap Debugger for `HeapProfiler` \u002F `Profiler`:\r\n\r\n```javascript\r\n\u002F\u002F CPU profile for 5 seconds\r\nawait client.Profiler.enable();\r\nawait client.Profiler.start();\r\nawait new Promise(r => setTimeout(r, 5000));\r\nconst { profile } = await client.Profiler.stop();\r\nrequire('fs').writeFileSync('\u002Ftmp\u002Fcpu.cpuprofile', JSON.stringify(profile));\r\n\u002F\u002F Open \u002Ftmp\u002Fcpu.cpuprofile in Chrome DevTools → Performance tab\r\n```\r\n\r\n```javascript\r\n\u002F\u002F Heap snapshot\r\nawait client.HeapProfiler.enable();\r\nconst chunks = [];\r\nclient.HeapProfiler.addHeapSnapshotChunk(({ chunk }) => chunks.push(chunk));\r\nawait client.HeapProfiler.takeHeapSnapshot({ reportProgress: false });\r\nrequire('fs').writeFileSync('\u002Ftmp\u002Fheap.heapsnapshot', chunks.join(''));\r\n```\r\n\r\n## Common Pitfalls\r\n\r\n1. **Wrong line numbers in TS source.** Breakpoints hit the emitted JS, not the `.ts`. Either (a) break in the built `dist\u002F*.js`, or (b) enable sourcemaps (`node --enable-source-maps`) and use `sb('src\u002Fapp.tsx', N)` — but only with CDP clients that follow sourcemaps. `node inspect` CLI does not.\r\n\r\n2. **`--inspect` vs `--inspect-brk`.** `--inspect` starts the inspector but doesn't pause; your script races past your first breakpoint if you attach too late. Use `--inspect-brk` when you need to set breakpoints before any code runs.\r\n\r\n3. **Port collisions.** Default is `9229`. If multiple Node processes are inspecting, pass `--inspect=0` (random port) and read the actual URL from `\u002Fjson\u002Flist`:\r\n   ```bash\r\n   curl -s http:\u002F\u002F127.0.0.1:9229\u002Fjson\u002Flist   # lists all inspectable targets on the host\r\n   ```\r\n\r\n4. **Child processes.** `--inspect` on a parent does NOT inspect its children. Use `NODE_OPTIONS='--inspect-brk' node parent.js` to propagate to every child; be aware they all need unique ports (Node auto-increments when `NODE_OPTIONS='--inspect'` is inherited).\r\n\r\n5. **Background kills.** If you `Ctrl+C` out of `node inspect` while the target is paused, the target stays paused. Either `cont` first, or `kill` the target explicitly.\r\n\r\n6. **Running `node inspect` through an agent terminal.** It's a PTY-friendly REPL. In Hermes, launch it with `terminal(pty=true)` or `background=true` + `process(action='submit', data='...')`. Non-PTY foreground mode will work for one-shot commands but not for interactive stepping.\r\n\r\n7. **Security.** `--inspect=0.0.0.0:9229` exposes arbitrary code execution. Always bind to `127.0.0.1` (the default) unless you have an isolated network.\r\n\r\n## Verification Checklist\r\n\r\nAfter setting up a debug session, verify:\r\n\r\n- [ ] `curl -s http:\u002F\u002F127.0.0.1:9229\u002Fjson\u002Flist` returns exactly the target you expect\r\n- [ ] First breakpoint actually hits (if it doesn't, you likely missed `--inspect-brk` or attached after execution completed)\r\n- [ ] Source listing at pause shows the right file (mismatch = sourcemap issue, see pitfall 1)\r\n- [ ] `exec process.pid` in `repl` returns the PID you meant to attach to\r\n\r\n## One-Shot Recipes\r\n\r\n**\"Why is this variable undefined at line X?\"**\r\n```bash\r\nnode --inspect-brk script.js &\r\nnode inspect -p $!\r\n# debug>\r\nsb('script.js', X)\r\ncont\r\n# paused. Now:\r\nrepl\r\n> myVariable\r\n> Object.keys(this)\r\n```\r\n\r\n**\"What's the call path into this function?\"**\r\n```\r\ndebug> sb('suspectFn')\r\ndebug> cont\r\n# paused on entry\r\ndebug> bt\r\n```\r\n\r\n**\"This async chain hangs — where?\"**\r\n```\r\n# Start with --inspect (no -brk), let it run to the hang, then:\r\ndebug> pause\r\ndebug> bt\r\n# Now you see the stuck frame\r\n```\r\n","# Node.js Inspect Debugger\r\n\r\n## Overview\r\n\r\nWhen `console.log` isn't enough, drive Node's built-in V8 inspector programmatically from the terminal. You get real breakpoints, step in\u002Fover\u002Fout, call-stack walking, local\u002Fclosure scope dumps, and arbitrary expression evaluation in the paused frame.\r\n\r\nTwo tools, pick one:\r\n\r\n- **`node inspect`** — built-in, zero install, CLI REPL. Best for quick poking.\r\n- **`ndb` \u002F CDP via `chrome-remote-interface`** — scriptable from Node\u002FPython; best when you want to automate many breakpoints, collect state across runs, or debug non-interactively from an agent loop.\r\n\r\n**Prefer `node inspect` first.** It's always available and the REPL is fast.\r\n\r\n## When to Use\r\n\r\n- A Node test fails and you need to see intermediate state\r\n- ui-tui crashes or behaves wrong and you want to inspect React\u002FInk state pre-render\r\n- tui_gateway child processes (`_SlashWorker`, PTY bridge workers) misbehave\r\n- You need to inspect a value in a closure that `console.log` can't reach without patching\r\n- Perf: attach to a running process to capture a CPU profile or heap snapshot\r\n\r\n**Don't use for:** things `console.log` solves in under a minute. Breakpoint-driven debugging is heavier; use it when the payoff is real.\r\n\r\n## Quick Reference: `node inspect` REPL\r\n\r\nLaunch paused on first line:\r\n\r\n```bash\r\nnode inspect path\u002Fto\u002Fscript.js\r\n# or with tsx\r\nnode --inspect-brk $(which tsx) path\u002Fto\u002Fscript.ts\r\n```\r\n\r\nThe `debug>` prompt accepts:\r\n\r\n| Command | Action |\r\n|---|---|\r\n| `c` or `cont` | continue |\r\n| `n` or `next` | step over |\r\n| `s` or `step` | step into |\r\n| `o` or `out` | step out |\r\n| `pause` | pause running code |\r\n| `sb('file.js', 42)` | set breakpoint at file.js line 42 |\r\n| `sb(42)` | set breakpoint at line 42 of current file |\r\n| `sb('functionName')` | break when function is called |\r\n| `cb('file.js', 42)` | clear breakpoint |\r\n| `breakpoints` | list all breakpoints |\r\n| `bt` | backtrace (call stack) |\r\n| `list(5)` | show 5 lines of source around current position |\r\n| `watch('expr')` | evaluate expr on every pause |\r\n| `watchers` | show watched expressions |\r\n| `repl` | drop into REPL in current scope (Ctrl+C to exit REPL) |\r\n| `exec expr` | evaluate expression once |\r\n| `restart` | restart script |\r\n| `kill` | kill the script |\r\n| `.exit` | quit debugger |\r\n\r\n**In the `repl` sub-mode:** type any JS expression, including access to locals\u002Fclosure variables. `Ctrl+C` exits back to `debug>`.\r\n\r\n## Attaching to a Running Process\r\n\r\nWhen the process is already running (e.g. a long-lived dev server or the TUI gateway):\r\n\r\n```bash\r\n# 1. Send SIGUSR1 to enable the inspector on an existing process\r\nkill -SIGUSR1 \u003Cpid>\r\n# Node prints: Debugger listening on ws:\u002F\u002F127.0.0.1:9229\u002F\u003Cuuid>\r\n\r\n# 2. Attach the debugger CLI\r\nnode inspect -p \u003Cpid>\r\n# or by URL\r\nnode inspect ws:\u002F\u002F127.0.0.1:9229\u002F\u003Cuuid>\r\n```\r\n\r\nTo start a process with the inspector from the beginning:\r\n\r\n```bash\r\nnode --inspect script.js           # listen on 127.0.0.1:9229, keep running\r\nnode --inspect-brk script.js       # listen AND pause on first line\r\nnode --inspect=0.0.0.0:9230 script.js   # custom host:port\r\n```\r\n\r\nFor TypeScript via tsx:\r\n\r\n```bash\r\nnode --inspect-brk --import tsx script.ts\r\n# or older tsx\r\nnode --inspect-brk -r tsx\u002Fcjs script.ts\r\n```\r\n\r\n## Programmatic CDP (scripting from terminal)\r\n\r\nWhen you want to automate — set many breakpoints, capture scope state, script a repro — use `chrome-remote-interface`:\r\n\r\n```bash\r\nnpm i -g chrome-remote-interface        # or project-local\r\n# Start your target:\r\nnode --inspect-brk=9229 target.js &\r\n```\r\n\r\nDriver script (save as `\u002Ftmp\u002Fcdp-debug.js`):\r\n\r\n```javascript\r\nconst CDP = require('chrome-remote-interface');\r\n\r\n(async () => {\r\n  const client = await CDP({ port: 9229 });\r\n  const { Debugger, Runtime } = client;\r\n\r\n  Debugger.paused(async ({ callFrames, reason }) => {\r\n    const top = callFrames[0];\r\n    console.log(`PAUSED: ${reason} @ ${top.url}:${top.location.lineNumber + 1}`);\r\n\r\n    \u002F\u002F Walk scopes for locals\r\n    for (const scope of top.scopeChain) {\r\n      if (scope.type === 'local' || scope.type === 'closure') {\r\n        const { result } = await Runtime.getProperties({\r\n          objectId: scope.object.objectId,\r\n          ownProperties: true,\r\n        });\r\n        for (const p of result) {\r\n          console.log(`  ${scope.type}.${p.name} =`, p.value?.value ?? p.value?.description);\r\n        }\r\n      }\r\n    }\r\n\r\n    \u002F\u002F Evaluate an expression in the paused frame\r\n    const { result } = await Debugger.evaluateOnCallFrame({\r\n      callFrameId: top.callFrameId,\r\n      expression: 'typeof state !== \"undefined\" ? JSON.stringify(state) : \"n\u002Fa\"',\r\n    });\r\n    console.log('state =', result.value ?? result.description);\r\n\r\n    await Debugger.resume();\r\n  });\r\n\r\n  await Runtime.enable();\r\n  await Debugger.enable();\r\n\r\n  \u002F\u002F Set a breakpoint by URL regex + line\r\n  await Debugger.setBreakpointByUrl({\r\n    urlRegex: '.*app\\\\.tsx$',\r\n    lineNumber: 119,       \u002F\u002F 0-indexed\r\n    columnNumber: 0,\r\n  });\r\n\r\n  await Runtime.runIfWaitingForDebugger();\r\n})();\r\n```\r\n\r\nRun it:\r\n\r\n```bash\r\nnode \u002Ftmp\u002Fcdp-debug.js\r\n```\r\n\r\nHermes-specific note: `chrome-remote-interface` is NOT in `ui-tui\u002Fpackage.json`. Install it to a throwaway location if you don't want to dirty the project:\r\n\r\n```bash\r\nmkdir -p \u002Ftmp\u002Fcdp-tools && cd \u002Ftmp\u002Fcdp-tools && npm i chrome-remote-interface\r\nNODE_PATH=\u002Ftmp\u002Fcdp-tools\u002Fnode_modules node \u002Ftmp\u002Fcdp-debug.js\r\n```\r\n\r\n## Debugging Hermes ui-tui\r\n\r\nThe TUI is built Ink + tsx. Two common scenarios:\r\n\r\n### Debugging a single Ink component under dev\r\n\r\n`ui-tui\u002Fpackage.json` has `npm run dev` (tsx --watch). Add `--inspect-brk` by running tsx directly:\r\n\r\n```bash\r\ncd \u002Fhome\u002Fbb\u002Fhermes-agent\u002Fui-tui\r\nnpm run build    # produce dist\u002F once so transpile isn't needed on first load\r\nnode --inspect-brk dist\u002Fentry.js\r\n# In another terminal:\r\nnode inspect -p \u003Cnode pid>\r\n```\r\n\r\nThen inside `debug>`:\r\n\r\n```\r\nsb('dist\u002Fapp.js', 220)     # or wherever the suspect render is\r\ncont\r\n```\r\n\r\nWhen it pauses, `repl` → inspect `props`, state refs, `useInput` handler values, etc.\r\n\r\n### Debugging a running `hermes --tui`\r\n\r\nThe TUI spawns Node from the Python CLI. Easiest path:\r\n\r\n```bash\r\n# 1. Launch TUI\r\nhermes --tui &\r\nTUI_PID=$(pgrep -f 'ui-tui\u002Fdist\u002Fentry' | head -1)\r\n\r\n# 2. Enable inspector on that Node PID\r\nkill -SIGUSR1 \"$TUI_PID\"\r\n\r\n# 3. Find the WS URL\r\ncurl -s http:\u002F\u002F127.0.0.1:9229\u002Fjson\u002Flist | jq -r '.[0].webSocketDebuggerUrl'\r\n\r\n# 4. Attach\r\nnode inspect ws:\u002F\u002F127.0.0.1:9229\u002F\u003Cuuid>\r\n```\r\n\r\nInteracting with the TUI (typing in its window) continues to advance execution; your debugger can pause it on a breakpoint at any `sb(...)`.\r\n\r\n### Debugging `_SlashWorker` \u002F PTY child processes\r\n\r\nThose 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\u002F`) use this skill.\r\n\r\n## Running Vitest Tests Under the Debugger\r\n\r\n```bash\r\ncd \u002Fhome\u002Fbb\u002Fhermes-agent\u002Fui-tui\r\n# Run a single test file paused on entry\r\nnode --inspect-brk .\u002Fnode_modules\u002Fvitest\u002Fvitest.mjs run --no-file-parallelism src\u002Fapp\u002Ffoo.test.tsx\r\n```\r\n\r\nIn another terminal: `node inspect -p \u003Cpid>`, then `sb('src\u002Fapp\u002Ffoo.tsx', 42)`, `cont`.\r\n\r\nUse `--no-file-parallelism` (vitest) or `--runInBand` (jest) so only one worker exists — debugging a pool is painful.\r\n\r\n## Heap Snapshots & CPU Profiles (Non-interactive)\r\n\r\nFrom the CDP driver above, swap Debugger for `HeapProfiler` \u002F `Profiler`:\r\n\r\n```javascript\r\n\u002F\u002F CPU profile for 5 seconds\r\nawait client.Profiler.enable();\r\nawait client.Profiler.start();\r\nawait new Promise(r => setTimeout(r, 5000));\r\nconst { profile } = await client.Profiler.stop();\r\nrequire('fs').writeFileSync('\u002Ftmp\u002Fcpu.cpuprofile', JSON.stringify(profile));\r\n\u002F\u002F Open \u002Ftmp\u002Fcpu.cpuprofile in Chrome DevTools → Performance tab\r\n```\r\n\r\n```javascript\r\n\u002F\u002F Heap snapshot\r\nawait client.HeapProfiler.enable();\r\nconst chunks = [];\r\nclient.HeapProfiler.addHeapSnapshotChunk(({ chunk }) => chunks.push(chunk));\r\nawait client.HeapProfiler.takeHeapSnapshot({ reportProgress: false });\r\nrequire('fs').writeFileSync('\u002Ftmp\u002Fheap.heapsnapshot', chunks.join(''));\r\n```\r\n\r\n## Common Pitfalls\r\n\r\n1. **Wrong line numbers in TS source.** Breakpoints hit the emitted JS, not the `.ts`. Either (a) break in the built `dist\u002F*.js`, or (b) enable sourcemaps (`node --enable-source-maps`) and use `sb('src\u002Fapp.tsx', N)` — but only with CDP clients that follow sourcemaps. `node inspect` CLI does not.\r\n\r\n2. **`--inspect` vs `--inspect-brk`.** `--inspect` starts the inspector but doesn't pause; your script races past your first breakpoint if you attach too late. Use `--inspect-brk` when you need to set breakpoints before any code runs.\r\n\r\n3. **Port collisions.** Default is `9229`. If multiple Node processes are inspecting, pass `--inspect=0` (random port) and read the actual URL from `\u002Fjson\u002Flist`:\r\n   ```bash\r\n   curl -s http:\u002F\u002F127.0.0.1:9229\u002Fjson\u002Flist   # lists all inspectable targets on the host\r\n   ```\r\n\r\n4. **Child processes.** `--inspect` on a parent does NOT inspect its children. Use `NODE_OPTIONS='--inspect-brk' node parent.js` to propagate to every child; be aware they all need unique ports (Node auto-increments when `NODE_OPTIONS='--inspect'` is inherited).\r\n\r\n5. **Background kills.** If you `Ctrl+C` out of `node inspect` while the target is paused, the target stays paused. Either `cont` first, or `kill` the target explicitly.\r\n\r\n6. **Running `node inspect` through an agent terminal.** It's a PTY-friendly REPL. In Hermes, launch it with `terminal(pty=true)` or `background=true` + `process(action='submit', data='...')`. Non-PTY foreground mode will work for one-shot commands but not for interactive stepping.\r\n\r\n7. **Security.** `--inspect=0.0.0.0:9229` exposes arbitrary code execution. Always bind to `127.0.0.1` (the default) unless you have an isolated network.\r\n\r\n## Verification Checklist\r\n\r\nAfter setting up a debug session, verify:\r\n\r\n- [ ] `curl -s http:\u002F\u002F127.0.0.1:9229\u002Fjson\u002Flist` returns exactly the target you expect\r\n- [ ] First breakpoint actually hits (if it doesn't, you likely missed `--inspect-brk` or attached after execution completed)\r\n- [ ] Source listing at pause shows the right file (mismatch = sourcemap issue, see pitfall 1)\r\n- [ ] `exec process.pid` in `repl` returns the PID you meant to attach to\r\n\r\n## One-Shot Recipes\r\n\r\n**\"Why is this variable undefined at line X?\"**\r\n```bash\r\nnode --inspect-brk script.js &\r\nnode inspect -p $!\r\n# debug>\r\nsb('script.js', X)\r\ncont\r\n# paused. Now:\r\nrepl\r\n> myVariable\r\n> Object.keys(this)\r\n```\r\n\r\n**\"What's the call path into this function?\"**\r\n```\r\ndebug> sb('suspectFn')\r\ndebug> cont\r\n# paused on entry\r\ndebug> bt\r\n```\r\n\r\n**\"This async chain hangs — where?\"**\r\n```\r\n# Start with --inspect (no -brk), let it run to the hang, then:\r\ndebug> pause\r\ndebug> bt\r\n# Now you see the stuck frame\r\n```\r\n",{"name":5,"author":44,"license":15,"version":45,"metadata":46,"platforms":56,"description":7},"Hermes Agent","1.0.0",{"hermes":47},{"tags":48,"related_skills":52},[33,31,49,25,50,51],"node-inspect","breakpoints","ui-tui",[53,54,55],"systematic-debugging","python-debugpy","debugging-hermes-tui-commands",[37,57,35],"macos","main","0d1434f89f4bc6b07e9d272accd8c1013768820f","archive\u002Fskill-md-reviewed\u002Fsha256\u002F24\u002F24bcedf106b95d4e425090bb6fcca15cd27783720608e001e671791d0d23d3ed",0,"https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills","https:\u002F\u002Fgithub.com\u002Fzapabob","The Open University of JAPAN　2019-now\r\n\r\nTokyo University of Science　2007-2010","2026-10-26 16:29:01",{"source":8,"skillName":5,"commands":67,"prompt":77,"zipAvailable":78},[68,71,74],{"tool":69,"command":70},"npx","npx skills add zapabob\u002FSkills --skill node-inspect-debugger",{"tool":72,"command":73},"bunx","bunx skills add zapabob\u002FSkills --skill node-inspect-debugger",{"tool":75,"command":76},"pnpm","pnpm dlx skills add zapabob\u002FSkills --skill node-inspect-debugger","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Farchive\u002Fskill-md-reviewed\u002Fsha256\u002F24\u002F24bcedf106b95d4e425090bb6fcca15cd27783720608e001e671791d0d23d3ed\u002FSKILL.md",true,[80,86,90],{"path":81,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":84,"sourceHtmlUrl":85},"provenance\u002Foriginal.SKILL.md","REFERENCE","参考文档",4639,"https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked\u002Fblob\u002Fmain\u002Fincluded\u002Frepaired\u002Fskills\u002Fby-category\u002Fcoding-refactoring-repository-automation\u002Freddit-verified-gtm-registry\u002Fexplain-this-pr\u002Fprovenance\u002Foriginal.SKILL.md",{"path":87,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":88,"sourceHtmlUrl":89},"provenance\u002Fupstream.README.md",1884,"https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked\u002Fblob\u002Fmain\u002Fincluded\u002Frepaired\u002Fskills\u002Fby-category\u002Fcoding-refactoring-repository-automation\u002Freddit-verified-gtm-registry\u002Fexplain-this-pr\u002Fprovenance\u002Fupstream.README.md",{"path":91,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":92,"sourceHtmlUrl":93},"repair.json",1866,"https:\u002F\u002Fgithub.com\u002Fstrmt7\u002Fai_skills_collection_benchmarked\u002Fblob\u002Fmain\u002Fincluded\u002Frepaired\u002Fskills\u002Fby-category\u002Fcoding-refactoring-repository-automation\u002Freddit-verified-gtm-registry\u002Fexplain-this-pr\u002Frepair.json",[95,114,138,162,186,202],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":39},"01M6GJTE1GESGGF9K028Y7753E","xurl","X\u002FTwitter via xurl CLI: post, search, DM, media, v2 API.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fxurl\u002Fvariants\u002Fhermes-agent\u002FSKILL.md",[],[97,102,57,30,103,37,35,104,105,106,107,108,109,28,27,110,58,111,112,113],"openclaw","github","official","search","https","social-media","api","Media","twitter","social","via","post",{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":39},"01M6GJT8S1PXQ8WPXT1HSNBWH2","writing-plans","Write implementation plans: bite-sized tasks, paths, code.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fwriting-plans\u002Fvariants\u002Fhermes-agent\u002FSKILL.md",[],[121,122,123,124,57,125,37,126,35,127,128,129,130,131,132,133,134,135,136,137],"writing","writing plans","plans","design","review","workflow","documentation","tasks","development","code","planning","code-review","subagent","write","superpowers","paths","test-driven-development",{"skillNo":139,"name":140,"nameZh":6,"description":141,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":142,"categories":143,"keywords":144,"publishedAt":39},"01M6GJST0H5X7WHBJ3BZK0DVKH","whisper","OpenAI's general-purpose speech recognition model. Supports 99 languages, transcription, translation to English, and language identification. Six model sizes from tiny (39M params) to large (1550M params). Use for speech-to-text, podcast transcription, or multilingual audio processing. Best for robust, multilingual ASR.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fwhisper\u002Fvariants\u002Fhermes-agent-optional\u002FSKILL.md",[],[140,57,37,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161],"openai","speech","multimodal","Transformers","ASR","Audio","text","model","speech recognition","use","general","multilingual","translation","english","identification","processing","Audio Processing",{"skillNo":163,"name":164,"nameZh":6,"description":165,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":166,"categories":167,"keywords":168,"publishedAt":39},"01M6GJSMRQ8EETZTYMG72P70EA","weights-and-biases","W&B: log ML experiments, sweeps, model registry, dashboards.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fweights-and-biases\u002Fvariants\u002Fhermes-agent\u002FSKILL.md",[],[169,57,170,171,35,172,173,174,175,176,177,152,178,179,180,181,182,183,184,185],"weights and biases","tensorflow","experiments","pytorch","visualization","registry","real-time","tuning","dashboards","experiment","log","time","Experiment Tracking","Model Registry","Hyperparameter Tuning","WandB","Real-Time Visualization",{"skillNo":187,"name":188,"nameZh":6,"description":189,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":190,"categories":191,"keywords":192,"publishedAt":39},"01M6GJS19KDPRY112JTR326S06","watchers","Poll RSS, JSON APIs, and GitHub with watermark dedup.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fwatchers\u002Fvariants\u002Fhermes-agent-optional\u002FSKILL.md",[],[188,57,193,103,37,194,195,196,197,198,199,28,27,200,201],"terminal","automation","http","monitoring","cron","json","rss","devops","with",{"skillNo":203,"name":204,"nameZh":6,"description":205,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":206,"categories":207,"keywords":208,"publishedAt":39},"01M6GJRHJD2A6Q830SWF9W48BC","serving-llms-vllm","vLLM: high-throughput LLM serving, OpenAI API, quantization.","https:\u002F\u002Fgithub.com\u002Fzapabob\u002FSkills\u002Fblob\u002Fmain\u002Fregistry\u002Fskills\u002Fvllm\u002Fvariants\u002Fhermes-agent\u002FSKILL.md",[],[209,210,211,37,212,145,213,214,215,148,216,108,217,218,219,220,221,222,223,224],"llms","vLLM","serving llms vllm","research","openai api","tensor","Inference Serving","Production","llm serving","High Throughput","PagedAttention","Continuous Batching","Quantization","Tensor Parallelism","high-throughput","throughput"]