[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71TDPPPCJSA9V0EJFS6GT3A":3,"skill-same:01M71TDPPPCJSA9V0EJFS6GT3A":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":54,"commitSha":55,"skillDirectory":56,"forksCount":13,"repositoryHtmlUrl":57,"repositoryHomepageUrl":6,"ownerHtmlUrl":58,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":59,"install":60,"resources":73},"01M71TDPPPCJSA9V0EJFS6GT3A","node-inspect-debugger",null,"Debug Node.js via --inspect + Chrome DevTools Protocol CLI.","eliottbusiness\u002FDeptFlow-Agent","eliottbusiness","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F263418316?v=4","01M71T5T608RHFA07W6QVC6TYX","01M71T5T6R98RMYZ53PYH851T1",0,"MIT","https:\u002F\u002Fgithub.com\u002Feliottbusiness\u002FDeptFlow-Agent\u002Fblob\u002Fmain\u002Fprofile\u002Fskills\u002Fsoftware-development\u002Fnode-inspect-debugger\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"node inspect debugger","inspect","node","debugger","chrome devtools","debugpy","systematic-debugging","via","systematic","commands","cdp","cli","ui","devtools","nodejs","protocol","debugging","debug","chrome","python","2026-11-10 13:02:02",false,"---\nname: node-inspect-debugger\ndescription: \"Debug Node.js via --inspect + Chrome DevTools Protocol CLI.\"\nversion: 1.0.0\nauthor: Hermes Agent\nlicense: MIT\nmetadata:\n  hermes:\n    tags: [debugging, nodejs, node-inspect, cdp, breakpoints, ui-tui]\n    related_skills: [systematic-debugging, python-debugpy, debugging-hermes-tui-commands]\n---\n\n# Node.js Inspect Debugger\n\n## Overview\n\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.\n\nTwo tools, pick one:\n\n- **`node inspect`** — built-in, zero install, CLI REPL. Best for quick poking.\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.\n\n**Prefer `node inspect` first.** It's always available and the REPL is fast.\n\n## When to Use\n\n- A Node test fails and you need to see intermediate state\n- ui-tui crashes or behaves wrong and you want to inspect React\u002FInk state pre-render\n- tui_gateway child processes (`_SlashWorker`, PTY bridge workers) misbehave\n- You need to inspect a value in a closure that `console.log` can't reach without patching\n- Perf: attach to a running process to capture a CPU profile or heap snapshot\n\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.\n\n## Quick Reference: `node inspect` REPL\n\nLaunch paused on first line:\n\n```bash\nnode inspect path\u002Fto\u002Fscript.js\n# or with tsx\nnode --inspect-brk $(which tsx) path\u002Fto\u002Fscript.ts\n```\n\nThe `debug>` prompt accepts:\n\n| Command | Action |\n|---|---|\n| `c` or `cont` | continue |\n| `n` or `next` | step over |\n| `s` or `step` | step into |\n| `o` or `out` | step out |\n| `pause` | pause running code |\n| `sb('file.js', 42)` | set breakpoint at file.js line 42 |\n| `sb(42)` | set breakpoint at line 42 of current file |\n| `sb('functionName')` | break when function is called |\n| `cb('file.js', 42)` | clear breakpoint |\n| `breakpoints` | list all breakpoints |\n| `bt` | backtrace (call stack) |\n| `list(5)` | show 5 lines of source around current position |\n| `watch('expr')` | evaluate expr on every pause |\n| `watchers` | show watched expressions |\n| `repl` | drop into REPL in current scope (Ctrl+C to exit REPL) |\n| `exec expr` | evaluate expression once |\n| `restart` | restart script |\n| `kill` | kill the script |\n| `.exit` | quit debugger |\n\n**In the `repl` sub-mode:** type any JS expression, including access to locals\u002Fclosure variables. `Ctrl+C` exits back to `debug>`.\n\n## Attaching to a Running Process\n\nWhen the process is already running (e.g. a long-lived dev server or the TUI gateway):\n\n```bash\n# 1. Send SIGUSR1 to enable the inspector on an existing process\nkill -SIGUSR1 \u003Cpid>\n# Node prints: Debugger listening on ws:\u002F\u002F127.0.0.1:9229\u002F\u003Cuuid>\n\n# 2. Attach the debugger CLI\nnode inspect -p \u003Cpid>\n# or by URL\nnode inspect ws:\u002F\u002F127.0.0.1:9229\u002F\u003Cuuid>\n```\n\nTo start a process with the inspector from the beginning:\n\n```bash\nnode --inspect script.js           # listen on 127.0.0.1:9229, keep running\nnode --inspect-brk script.js       # listen AND pause on first line\nnode --inspect=0.0.0.0:9230 script.js   # custom host:port\n```\n\nFor TypeScript via tsx:\n\n```bash\nnode --inspect-brk --import tsx script.ts\n# or older tsx\nnode --inspect-brk -r tsx\u002Fcjs script.ts\n```\n\n## Programmatic CDP (scripting from terminal)\n\nWhen you want to automate — set many breakpoints, capture scope state, script a repro — use `chrome-remote-interface`:\n\n```bash\nnpm i -g chrome-remote-interface        # or project-local\n# Start your target:\nnode --inspect-brk=9229 target.js &\n```\n\nDriver script (save as `\u002Ftmp\u002Fcdp-debug.js`):\n\n```javascript\nconst CDP = require('chrome-remote-interface');\n\n(async () => {\n  const client = await CDP({ port: 9229 });\n  const { Debugger, Runtime } = client;\n\n  Debugger.paused(async ({ callFrames, reason }) => {\n    const top = callFrames[0];\n    console.log(`PAUSED: ${reason} @ ${top.url}:${top.location.lineNumber + 1}`);\n\n    \u002F\u002F Walk scopes for locals\n    for (const scope of top.scopeChain) {\n      if (scope.type === 'local' || scope.type === 'closure') {\n        const { result } = await Runtime.getProperties({\n          objectId: scope.object.objectId,\n          ownProperties: true,\n        });\n        for (const p of result) {\n          console.log(`  ${scope.type}.${p.name} =`, p.value?.value ?? p.value?.description);\n        }\n      }\n    }\n\n    \u002F\u002F Evaluate an expression in the paused frame\n    const { result } = await Debugger.evaluateOnCallFrame({\n      callFrameId: top.callFrameId,\n      expression: 'typeof state !== \"undefined\" ? JSON.stringify(state) : \"n\u002Fa\"',\n    });\n    console.log('state =', result.value ?? result.description);\n\n    await Debugger.resume();\n  });\n\n  await Runtime.enable();\n  await Debugger.enable();\n\n  \u002F\u002F Set a breakpoint by URL regex + line\n  await Debugger.setBreakpointByUrl({\n    urlRegex: '.*app\\\\.tsx$',\n    lineNumber: 119,       \u002F\u002F 0-indexed\n    columnNumber: 0,\n  });\n\n  await Runtime.runIfWaitingForDebugger();\n})();\n```\n\nRun it:\n\n```bash\nnode \u002Ftmp\u002Fcdp-debug.js\n```\n\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:\n\n```bash\nmkdir -p \u002Ftmp\u002Fcdp-tools && cd \u002Ftmp\u002Fcdp-tools && npm i chrome-remote-interface\nNODE_PATH=\u002Ftmp\u002Fcdp-tools\u002Fnode_modules node \u002Ftmp\u002Fcdp-debug.js\n```\n\n## Debugging Hermes ui-tui\n\nThe TUI is built Ink + tsx. Two common scenarios:\n\n### Debugging a single Ink component under dev\n\n`ui-tui\u002Fpackage.json` has `npm run dev` (tsx --watch). Add `--inspect-brk` by running tsx directly:\n\n```bash\ncd \u002Fhome\u002Fbb\u002Fhermes-agent\u002Fui-tui\nnpm run build    # produce dist\u002F once so transpile isn't needed on first load\nnode --inspect-brk dist\u002Fentry.js\n# In another terminal:\nnode inspect -p \u003Cnode pid>\n```\n\nThen inside `debug>`:\n\n```\nsb('dist\u002Fapp.js', 220)     # or wherever the suspect render is\ncont\n```\n\nWhen it pauses, `repl` → inspect `props`, state refs, `useInput` handler values, etc.\n\n### Debugging a running `hermes --tui`\n\nThe TUI spawns Node from the Python CLI. Easiest path:\n\n```bash\n# 1. Launch TUI\nhermes --tui &\nTUI_PID=$(pgrep -f 'ui-tui\u002Fdist\u002Fentry' | head -1)\n\n# 2. Enable inspector on that Node PID\nkill -SIGUSR1 \"$TUI_PID\"\n\n# 3. Find the WS URL\ncurl -s http:\u002F\u002F127.0.0.1:9229\u002Fjson\u002Flist | jq -r '.[0].webSocketDebuggerUrl'\n\n# 4. Attach\nnode inspect ws:\u002F\u002F127.0.0.1:9229\u002F\u003Cuuid>\n```\n\nInteracting with the TUI (typing in its window) continues to advance execution; your debugger can pause it on a breakpoint at any `sb(...)`.\n\n### Debugging `_SlashWorker` \u002F PTY child processes\n\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.\n\n## Running Vitest Tests Under the Debugger\n\n```bash\ncd \u002Fhome\u002Fbb\u002Fhermes-agent\u002Fui-tui\n# Run a single test file paused on entry\nnode --inspect-brk .\u002Fnode_modules\u002Fvitest\u002Fvitest.mjs run --no-file-parallelism src\u002Fapp\u002Ffoo.test.tsx\n```\n\nIn another terminal: `node inspect -p \u003Cpid>`, then `sb('src\u002Fapp\u002Ffoo.tsx', 42)`, `cont`.\n\nUse `--no-file-parallelism` (vitest) or `--runInBand` (jest) so only one worker exists — debugging a pool is painful.\n\n## Heap Snapshots & CPU Profiles (Non-interactive)\n\nFrom the CDP driver above, swap Debugger for `HeapProfiler` \u002F `Profiler`:\n\n```javascript\n\u002F\u002F CPU profile for 5 seconds\nawait client.Profiler.enable();\nawait client.Profiler.start();\nawait new Promise(r => setTimeout(r, 5000));\nconst { profile } = await client.Profiler.stop();\nrequire('fs').writeFileSync('\u002Ftmp\u002Fcpu.cpuprofile', JSON.stringify(profile));\n\u002F\u002F Open \u002Ftmp\u002Fcpu.cpuprofile in Chrome DevTools → Performance tab\n```\n\n```javascript\n\u002F\u002F Heap snapshot\nawait client.HeapProfiler.enable();\nconst chunks = [];\nclient.HeapProfiler.addHeapSnapshotChunk(({ chunk }) => chunks.push(chunk));\nawait client.HeapProfiler.takeHeapSnapshot({ reportProgress: false });\nrequire('fs').writeFileSync('\u002Ftmp\u002Fheap.heapsnapshot', chunks.join(''));\n```\n\n## Common Pitfalls\n\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.\n\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.\n\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`:\n   ```bash\n   curl -s http:\u002F\u002F127.0.0.1:9229\u002Fjson\u002Flist   # lists all inspectable targets on the host\n   ```\n\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).\n\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.\n\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.\n\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.\n\n## Verification Checklist\n\nAfter setting up a debug session, verify:\n\n- [ ] `curl -s http:\u002F\u002F127.0.0.1:9229\u002Fjson\u002Flist` returns exactly the target you expect\n- [ ] First breakpoint actually hits (if it doesn't, you likely missed `--inspect-brk` or attached after execution completed)\n- [ ] Source listing at pause shows the right file (mismatch = sourcemap issue, see pitfall 1)\n- [ ] `exec process.pid` in `repl` returns the PID you meant to attach to\n\n## One-Shot Recipes\n\n**\"Why is this variable undefined at line X?\"**\n```bash\nnode --inspect-brk script.js &\nnode inspect -p $!\n# debug>\nsb('script.js', X)\ncont\n# paused. Now:\nrepl\n> myVariable\n> Object.keys(this)\n```\n\n**\"What's the call path into this function?\"**\n```\ndebug> sb('suspectFn')\ndebug> cont\n# paused on entry\ndebug> bt\n```\n\n**\"This async chain hangs — where?\"**\n```\n# Start with --inspect (no -brk), let it run to the hang, then:\ndebug> pause\ndebug> bt\n# Now you see the stuck frame\n```\n","# Node.js Inspect Debugger\n\n## Overview\n\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.\n\nTwo tools, pick one:\n\n- **`node inspect`** — built-in, zero install, CLI REPL. Best for quick poking.\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.\n\n**Prefer `node inspect` first.** It's always available and the REPL is fast.\n\n## When to Use\n\n- A Node test fails and you need to see intermediate state\n- ui-tui crashes or behaves wrong and you want to inspect React\u002FInk state pre-render\n- tui_gateway child processes (`_SlashWorker`, PTY bridge workers) misbehave\n- You need to inspect a value in a closure that `console.log` can't reach without patching\n- Perf: attach to a running process to capture a CPU profile or heap snapshot\n\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.\n\n## Quick Reference: `node inspect` REPL\n\nLaunch paused on first line:\n\n```bash\nnode inspect path\u002Fto\u002Fscript.js\n# or with tsx\nnode --inspect-brk $(which tsx) path\u002Fto\u002Fscript.ts\n```\n\nThe `debug>` prompt accepts:\n\n| Command | Action |\n|---|---|\n| `c` or `cont` | continue |\n| `n` or `next` | step over |\n| `s` or `step` | step into |\n| `o` or `out` | step out |\n| `pause` | pause running code |\n| `sb('file.js', 42)` | set breakpoint at file.js line 42 |\n| `sb(42)` | set breakpoint at line 42 of current file |\n| `sb('functionName')` | break when function is called |\n| `cb('file.js', 42)` | clear breakpoint |\n| `breakpoints` | list all breakpoints |\n| `bt` | backtrace (call stack) |\n| `list(5)` | show 5 lines of source around current position |\n| `watch('expr')` | evaluate expr on every pause |\n| `watchers` | show watched expressions |\n| `repl` | drop into REPL in current scope (Ctrl+C to exit REPL) |\n| `exec expr` | evaluate expression once |\n| `restart` | restart script |\n| `kill` | kill the script |\n| `.exit` | quit debugger |\n\n**In the `repl` sub-mode:** type any JS expression, including access to locals\u002Fclosure variables. `Ctrl+C` exits back to `debug>`.\n\n## Attaching to a Running Process\n\nWhen the process is already running (e.g. a long-lived dev server or the TUI gateway):\n\n```bash\n# 1. Send SIGUSR1 to enable the inspector on an existing process\nkill -SIGUSR1 \u003Cpid>\n# Node prints: Debugger listening on ws:\u002F\u002F127.0.0.1:9229\u002F\u003Cuuid>\n\n# 2. Attach the debugger CLI\nnode inspect -p \u003Cpid>\n# or by URL\nnode inspect ws:\u002F\u002F127.0.0.1:9229\u002F\u003Cuuid>\n```\n\nTo start a process with the inspector from the beginning:\n\n```bash\nnode --inspect script.js           # listen on 127.0.0.1:9229, keep running\nnode --inspect-brk script.js       # listen AND pause on first line\nnode --inspect=0.0.0.0:9230 script.js   # custom host:port\n```\n\nFor TypeScript via tsx:\n\n```bash\nnode --inspect-brk --import tsx script.ts\n# or older tsx\nnode --inspect-brk -r tsx\u002Fcjs script.ts\n```\n\n## Programmatic CDP (scripting from terminal)\n\nWhen you want to automate — set many breakpoints, capture scope state, script a repro — use `chrome-remote-interface`:\n\n```bash\nnpm i -g chrome-remote-interface        # or project-local\n# Start your target:\nnode --inspect-brk=9229 target.js &\n```\n\nDriver script (save as `\u002Ftmp\u002Fcdp-debug.js`):\n\n```javascript\nconst CDP = require('chrome-remote-interface');\n\n(async () => {\n  const client = await CDP({ port: 9229 });\n  const { Debugger, Runtime } = client;\n\n  Debugger.paused(async ({ callFrames, reason }) => {\n    const top = callFrames[0];\n    console.log(`PAUSED: ${reason} @ ${top.url}:${top.location.lineNumber + 1}`);\n\n    \u002F\u002F Walk scopes for locals\n    for (const scope of top.scopeChain) {\n      if (scope.type === 'local' || scope.type === 'closure') {\n        const { result } = await Runtime.getProperties({\n          objectId: scope.object.objectId,\n          ownProperties: true,\n        });\n        for (const p of result) {\n          console.log(`  ${scope.type}.${p.name} =`, p.value?.value ?? p.value?.description);\n        }\n      }\n    }\n\n    \u002F\u002F Evaluate an expression in the paused frame\n    const { result } = await Debugger.evaluateOnCallFrame({\n      callFrameId: top.callFrameId,\n      expression: 'typeof state !== \"undefined\" ? JSON.stringify(state) : \"n\u002Fa\"',\n    });\n    console.log('state =', result.value ?? result.description);\n\n    await Debugger.resume();\n  });\n\n  await Runtime.enable();\n  await Debugger.enable();\n\n  \u002F\u002F Set a breakpoint by URL regex + line\n  await Debugger.setBreakpointByUrl({\n    urlRegex: '.*app\\\\.tsx$',\n    lineNumber: 119,       \u002F\u002F 0-indexed\n    columnNumber: 0,\n  });\n\n  await Runtime.runIfWaitingForDebugger();\n})();\n```\n\nRun it:\n\n```bash\nnode \u002Ftmp\u002Fcdp-debug.js\n```\n\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:\n\n```bash\nmkdir -p \u002Ftmp\u002Fcdp-tools && cd \u002Ftmp\u002Fcdp-tools && npm i chrome-remote-interface\nNODE_PATH=\u002Ftmp\u002Fcdp-tools\u002Fnode_modules node \u002Ftmp\u002Fcdp-debug.js\n```\n\n## Debugging Hermes ui-tui\n\nThe TUI is built Ink + tsx. Two common scenarios:\n\n### Debugging a single Ink component under dev\n\n`ui-tui\u002Fpackage.json` has `npm run dev` (tsx --watch). Add `--inspect-brk` by running tsx directly:\n\n```bash\ncd \u002Fhome\u002Fbb\u002Fhermes-agent\u002Fui-tui\nnpm run build    # produce dist\u002F once so transpile isn't needed on first load\nnode --inspect-brk dist\u002Fentry.js\n# In another terminal:\nnode inspect -p \u003Cnode pid>\n```\n\nThen inside `debug>`:\n\n```\nsb('dist\u002Fapp.js', 220)     # or wherever the suspect render is\ncont\n```\n\nWhen it pauses, `repl` → inspect `props`, state refs, `useInput` handler values, etc.\n\n### Debugging a running `hermes --tui`\n\nThe TUI spawns Node from the Python CLI. Easiest path:\n\n```bash\n# 1. Launch TUI\nhermes --tui &\nTUI_PID=$(pgrep -f 'ui-tui\u002Fdist\u002Fentry' | head -1)\n\n# 2. Enable inspector on that Node PID\nkill -SIGUSR1 \"$TUI_PID\"\n\n# 3. Find the WS URL\ncurl -s http:\u002F\u002F127.0.0.1:9229\u002Fjson\u002Flist | jq -r '.[0].webSocketDebuggerUrl'\n\n# 4. Attach\nnode inspect ws:\u002F\u002F127.0.0.1:9229\u002F\u003Cuuid>\n```\n\nInteracting with the TUI (typing in its window) continues to advance execution; your debugger can pause it on a breakpoint at any `sb(...)`.\n\n### Debugging `_SlashWorker` \u002F PTY child processes\n\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.\n\n## Running Vitest Tests Under the Debugger\n\n```bash\ncd \u002Fhome\u002Fbb\u002Fhermes-agent\u002Fui-tui\n# Run a single test file paused on entry\nnode --inspect-brk .\u002Fnode_modules\u002Fvitest\u002Fvitest.mjs run --no-file-parallelism src\u002Fapp\u002Ffoo.test.tsx\n```\n\nIn another terminal: `node inspect -p \u003Cpid>`, then `sb('src\u002Fapp\u002Ffoo.tsx', 42)`, `cont`.\n\nUse `--no-file-parallelism` (vitest) or `--runInBand` (jest) so only one worker exists — debugging a pool is painful.\n\n## Heap Snapshots & CPU Profiles (Non-interactive)\n\nFrom the CDP driver above, swap Debugger for `HeapProfiler` \u002F `Profiler`:\n\n```javascript\n\u002F\u002F CPU profile for 5 seconds\nawait client.Profiler.enable();\nawait client.Profiler.start();\nawait new Promise(r => setTimeout(r, 5000));\nconst { profile } = await client.Profiler.stop();\nrequire('fs').writeFileSync('\u002Ftmp\u002Fcpu.cpuprofile', JSON.stringify(profile));\n\u002F\u002F Open \u002Ftmp\u002Fcpu.cpuprofile in Chrome DevTools → Performance tab\n```\n\n```javascript\n\u002F\u002F Heap snapshot\nawait client.HeapProfiler.enable();\nconst chunks = [];\nclient.HeapProfiler.addHeapSnapshotChunk(({ chunk }) => chunks.push(chunk));\nawait client.HeapProfiler.takeHeapSnapshot({ reportProgress: false });\nrequire('fs').writeFileSync('\u002Ftmp\u002Fheap.heapsnapshot', chunks.join(''));\n```\n\n## Common Pitfalls\n\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.\n\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.\n\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`:\n   ```bash\n   curl -s http:\u002F\u002F127.0.0.1:9229\u002Fjson\u002Flist   # lists all inspectable targets on the host\n   ```\n\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).\n\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.\n\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.\n\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.\n\n## Verification Checklist\n\nAfter setting up a debug session, verify:\n\n- [ ] `curl -s http:\u002F\u002F127.0.0.1:9229\u002Fjson\u002Flist` returns exactly the target you expect\n- [ ] First breakpoint actually hits (if it doesn't, you likely missed `--inspect-brk` or attached after execution completed)\n- [ ] Source listing at pause shows the right file (mismatch = sourcemap issue, see pitfall 1)\n- [ ] `exec process.pid` in `repl` returns the PID you meant to attach to\n\n## One-Shot Recipes\n\n**\"Why is this variable undefined at line X?\"**\n```bash\nnode --inspect-brk script.js &\nnode inspect -p $!\n# debug>\nsb('script.js', X)\ncont\n# paused. Now:\nrepl\n> myVariable\n> Object.keys(this)\n```\n\n**\"What's the call path into this function?\"**\n```\ndebug> sb('suspectFn')\ndebug> cont\n# paused on entry\ndebug> bt\n```\n\n**\"This async chain hangs — where?\"**\n```\n# Start with --inspect (no -brk), let it run to the hang, then:\ndebug> pause\ndebug> bt\n# Now you see the stuck frame\n```\n",{"name":5,"author":43,"license":14,"version":44,"metadata":45,"description":7},"Hermes Agent","1.0.0",{"hermes":46},{"tags":47,"related_skills":51},[34,32,48,28,49,50],"node-inspect","breakpoints","ui-tui",[24,52,53],"python-debugpy","debugging-hermes-tui-commands","main","3ffb682eba417bd920665a7146fecc206b3bccf8","profile\u002Fskills\u002Fsoftware-development\u002Fnode-inspect-debugger","https:\u002F\u002Fgithub.com\u002Feliottbusiness\u002FDeptFlow-Agent","https:\u002F\u002Fgithub.com\u002Feliottbusiness","2026-05-03 19:19:17",{"source":8,"skillName":5,"commands":61,"prompt":71,"zipAvailable":72},[62,65,68],{"tool":63,"command":64},"npx","npx skills add eliottbusiness\u002FDeptFlow-Agent --skill node-inspect-debugger",{"tool":66,"command":67},"bunx","bunx skills add eliottbusiness\u002FDeptFlow-Agent --skill node-inspect-debugger",{"tool":69,"command":70},"pnpm","pnpm dlx skills add eliottbusiness\u002FDeptFlow-Agent --skill node-inspect-debugger","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Feliottbusiness\u002FDeptFlow-Agent\u002Fblob\u002Fmain\u002Fprofile\u002Fskills\u002Fsoftware-development\u002Fnode-inspect-debugger\u002FSKILL.md",true,[],[75,118,140,157,176,200],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":97,"publishedAt":38},"01M71TEDB3XPT9H5R3SH05XWES","writing-plans","Write implementation plans: bite-sized tasks, paths, code.","https:\u002F\u002Fgithub.com\u002Feliottbusiness\u002FDeptFlow-Agent\u002Fblob\u002Fmain\u002Fprofile\u002Fskills\u002Fsoftware-development\u002Fwriting-plans\u002FSKILL.md",[81,86,89,94],{"categoryNo":82,"categoryName":83,"taxonomyType":84,"taxonomyTypeDesc":85},"01JBSEEDCAT000000000000015","视觉设计","SCENARIO","使用场景",{"categoryNo":87,"categoryName":88,"taxonomyType":84,"taxonomyTypeDesc":85},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":90,"categoryName":91,"taxonomyType":92,"taxonomyTypeDesc":93},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",{"categoryNo":95,"categoryName":96,"taxonomyType":92,"taxonomyTypeDesc":93},"01JBSEEDCAT000000000000036","内容创作者",[98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117],"writing","writing plans","plans","test-driven","test-driven-development","superpowers","design","workflow","code","tasks","subagent","code-review","review","documentation","write","paths","planning","development","test","implementation",{"skillNo":119,"name":102,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":129,"publishedAt":38},"01M71TEB43BNQKKCRMQZDZ7SAQ","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002Feliottbusiness\u002FDeptFlow-Agent\u002Fblob\u002Fmain\u002Fprofile\u002Fskills\u002Fsoftware-development\u002Ftest-driven-development\u002FSKILL.md",[123,126],{"categoryNo":124,"categoryName":125,"taxonomyType":84,"taxonomyTypeDesc":85},"01JBSEEDCAT000000000000007","代码审查",{"categoryNo":127,"categoryName":128,"taxonomyType":84,"taxonomyTypeDesc":85},"01JBSEEDCAT000000000000008","测试与质量",[130,115,116,131,132,133,134,103,98,34,106,108,26,135,24,136,137,100,138,139],"test driven development","driven","green","red-green-refactor","testing","refactor","enforce","tests","tdd","quality",{"skillNo":141,"name":24,"nameZh":6,"description":142,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":143,"categories":144,"keywords":146,"publishedAt":38},"01M71TE76KV9R1WY1V5XQXMMTJ","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002Feliottbusiness\u002FDeptFlow-Agent\u002Fblob\u002Fmain\u002Fprofile\u002Fskills\u002Fsoftware-development\u002Fsystematic-debugging\u002FSKILL.md",[145],{"categoryNo":127,"categoryName":128,"taxonomyType":84,"taxonomyTypeDesc":85},[147,34,26,101,148,149,102,103,98,108,150,151,115,152,100,153,116,154,155,156],"systematic debugging","problem","problem-solving","phase","bugs","root cause","root-cause","investigation","understand","hermes",{"skillNo":158,"name":159,"nameZh":6,"description":160,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":161,"categories":162,"keywords":168,"publishedAt":38},"01M71TE2Y2TRFZNT6YRPKQA33R","subagent-driven-development","Execute plans via delegate_task subagents (2-stage review).","https:\u002F\u002Fgithub.com\u002Feliottbusiness\u002FDeptFlow-Agent\u002Fblob\u002Fmain\u002Fprofile\u002Fskills\u002Fsoftware-development\u002Fsubagent-driven-development\u002FSKILL.md",[163,164,167],{"categoryNo":87,"categoryName":88,"taxonomyType":84,"taxonomyTypeDesc":85},{"categoryNo":165,"categoryName":166,"taxonomyType":84,"taxonomyTypeDesc":85},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":95,"categoryName":96,"taxonomyType":92,"taxonomyTypeDesc":93},[169,108,115,131,101,102,170,171,103,98,105,106,109,110,172,173,100,174,175,116],"subagent driven development","delegate","delegation","subagents","parallel","stage","task",{"skillNo":177,"name":178,"nameZh":6,"description":179,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":180,"categories":181,"keywords":185,"publishedAt":38},"01M71TE0E7WRGXY6N0WTMDXY23","spike","Throwaway experiments to validate an idea before build.","https:\u002F\u002Fgithub.com\u002Feliottbusiness\u002FDeptFlow-Agent\u002Fblob\u002Fmain\u002Fprofile\u002Fskills\u002Fsoftware-development\u002Fspike\u002FSKILL.md",[182],{"categoryNo":183,"categoryName":184,"taxonomyType":84,"taxonomyTypeDesc":85},"01JBSEEDCAT000000000000021","资料检索与研究",[178,186,187,188,114,115,100,189,190,98,191,192,108,193,194,195,196,197,198,199],"concept","exploration","get","throwaway","shit","proof-of-concept","done","prototype","plan","research","build","sketch","mvp","validate",{"skillNo":201,"name":202,"nameZh":6,"description":203,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":204,"categories":205,"keywords":208,"publishedAt":38},"01M71TDY3JXZHWSYNF3AZ2XM2D","requesting-code-review","Pre-commit review: security scan, quality gates, auto-fix.","https:\u002F\u002Fgithub.com\u002Feliottbusiness\u002FDeptFlow-Agent\u002Fblob\u002Fmain\u002Fprofile\u002Fskills\u002Fsoftware-development\u002Frequesting-code-review\u002FSKILL.md",[206,207],{"categoryNo":124,"categoryName":125,"taxonomyType":84,"taxonomyTypeDesc":85},{"categoryNo":90,"categoryName":91,"taxonomyType":92,"taxonomyTypeDesc":93},[209,210,106,110,101,102,211,212,103,213,98,214,215,108,109,216,217,115,218,100],"code review","requesting code review","fix","auto-fix","auto","security scan","commit","verification","security","scan"]