[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CRC2SA463CJPXPW8VATNRS":3,"skill-same:01M7CRC2SA463CJPXPW8VATNRS":62},{"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":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":42,"commitSha":43,"skillDirectory":44,"forksCount":14,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":47,"install":48,"resources":61},"01M7CRC2SA463CJPXPW8VATNRS","node-inspect-debugger",null,"Debug Node.js via --inspect + Chrome DevTools Protocol CLI.","thalhath2234\u002Ftimely-app","thalhath2234","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F69391707?v=4","01M7CQNWTHSAP0D50RQY6W9YZQ","Thalhath","01M7CQNWVQN600VKQXRGTWCDPH",0,"MIT","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Fhermes\u002Foptional-skills\u002Fsoftware-development\u002Fnode-inspect-debugger\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: node-inspect-debugger\ndescription: \"Debug Node.js via --inspect + Chrome DevTools Protocol CLI.\"\nversion: 1.0.0\nauthor: Hermes Agent\nlicense: MIT\nplatforms: [linux, macos, windows]\nmetadata:\n  hermes:\n    tags: [debugging, nodejs, node-inspect, cdp, breakpoints, ui-tui]\n    related_skills: [systematic-debugging, python-debugpy]\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 `~\u002F.hermes\u002Fcache\u002Fscratch\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 ~\u002F.hermes\u002Fcache\u002Fscratch\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 ~\u002F.hermes\u002Fcache\u002Fscratch\u002Fcdp-tools && cd ~\u002F.hermes\u002Fcache\u002Fscratch\u002Fcdp-tools && npm i chrome-remote-interface\nNODE_PATH=~\u002F.hermes\u002Fcache\u002Fscratch\u002Fcdp-tools\u002Fnode_modules node ~\u002F.hermes\u002Fcache\u002Fscratch\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 \u003Chermes-agent-repo>\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 \u003Chermes-agent-repo>\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('~\u002F.hermes\u002Fcache\u002Fscratch\u002Fcpu.cpuprofile', JSON.stringify(profile));\n\u002F\u002F Open ~\u002F.hermes\u002Fcache\u002Fscratch\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('~\u002F.hermes\u002Fcache\u002Fscratch\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 `~\u002F.hermes\u002Fcache\u002Fscratch\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 ~\u002F.hermes\u002Fcache\u002Fscratch\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 ~\u002F.hermes\u002Fcache\u002Fscratch\u002Fcdp-tools && cd ~\u002F.hermes\u002Fcache\u002Fscratch\u002Fcdp-tools && npm i chrome-remote-interface\nNODE_PATH=~\u002F.hermes\u002Fcache\u002Fscratch\u002Fcdp-tools\u002Fnode_modules node ~\u002F.hermes\u002Fcache\u002Fscratch\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 \u003Chermes-agent-repo>\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 \u003Chermes-agent-repo>\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('~\u002F.hermes\u002Fcache\u002Fscratch\u002Fcpu.cpuprofile', JSON.stringify(profile));\n\u002F\u002F Open ~\u002F.hermes\u002Fcache\u002Fscratch\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('~\u002F.hermes\u002Fcache\u002Fscratch\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":24,"license":15,"version":25,"metadata":26,"platforms":38,"description":7},"Hermes Agent","1.0.0",{"hermes":27},{"tags":28,"related_skills":35},[29,30,31,32,33,34],"debugging","nodejs","node-inspect","cdp","breakpoints","ui-tui",[36,37],"systematic-debugging","python-debugpy",[39,40,41],"linux","macos","windows","dev","4d9b346961dd1d220a07fe4e6ed44b52daa57e0b","apps\u002Fagent\u002Fhermes\u002Foptional-skills\u002Fsoftware-development\u002Fnode-inspect-debugger","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app","https:\u002F\u002Fgithub.com\u002Fthalhath2234","2026-11-14 05:26:10",{"source":8,"skillName":5,"commands":49,"prompt":59,"zipAvailable":60},[50,53,56],{"tool":51,"command":52},"npx","npx skills add thalhath2234\u002Ftimely-app --skill node-inspect-debugger",{"tool":54,"command":55},"bunx","bunx skills add thalhath2234\u002Ftimely-app --skill node-inspect-debugger",{"tool":57,"command":58},"pnpm","pnpm dlx skills add thalhath2234\u002Ftimely-app --skill node-inspect-debugger","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Fhermes\u002Foptional-skills\u002Fsoftware-development\u002Fnode-inspect-debugger\u002FSKILL.md",true,[],[63,70,77,84,91,97],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7CRJRHHG68Q3XZX37TD85JB","timely","Test fixture standing in for the Timely skill (IDs, markdown dialect, workspace rule).","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Ftests\u002Ffixtures\u002Fskills\u002Ftimely\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7CRJPPNS8SKWVTDP3TJ9EHG","product-price-monitor","Test fixture override of the upstream product-price-monitor skill.","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Ftests\u002Ffixtures\u002Fskills\u002Foverrides\u002Fproduct-price-monitor\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7CRJKRY4QH4RAA2MKHNZT04","blocked-page-recovery","Use when a fetch fails: 403\u002F429, paywall, WAF, bot wall.","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Fhermes\u002Fskills\u002Fweb\u002Fblocked-page-recovery\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7CRJG3JC6PRSTH3MW62KTH6","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Fhermes\u002Fskills\u002Fsoftware-development\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":92,"name":36,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M7CRJ8K3ACJYKSYDJWKJM6HV","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Fhermes\u002Fskills\u002Fsoftware-development\u002Fsystematic-debugging\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M7CRJ3Q5QP1CVBG959M3A3BM","spike","Throwaway experiments to validate an idea before build.","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Fhermes\u002Fskills\u002Fsoftware-development\u002Fspike\u002FSKILL.md",[],[]]