[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6JDQRRVSFFEXSM0THRP561G":3,"skill-same:01M6JDQRRVSFFEXSM0THRP561G":83},{"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":22,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":61,"commitSha":62,"skillDirectory":63,"forksCount":64,"repositoryHtmlUrl":65,"repositoryHomepageUrl":66,"ownerHtmlUrl":67,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":68,"install":69,"resources":82},"01M6JDQRRVSFFEXSM0THRP561G","node-inspect-debugger",null,"Debug Node.js via --inspect + Chrome DevTools Protocol CLI.","S3YED\u002Fappie-kit","S3YED","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F62743867?v=4","01M6JBKBRRVP6KMS0VWZ27T3R6","01M6JBKBX0KG30284PW1DBYJT1",14,"MIT","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Ffleet\u002Fnode-inspect-debugger-sd\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"inspect","node inspect debugger","node","debugger","ui","systematic-debugging","via","systematic","commands","cdp","chrome devtools","macos","devtools","debugging","debug","windows","chrome","linux","python","cli","2026-11-10 10:12:30",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, 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":48,"license":14,"version":49,"metadata":50,"platforms":60,"description":7},"Hermes Agent","1.0.0",{"hermes":51},{"tags":52,"related_skills":57},[36,53,54,32,55,56],"nodejs","node-inspect","breakpoints","ui-tui",[28,58,59],"python-debugpy","debugging-hermes-tui-commands",[40,34,38],"master","8ec37df6d71fb664ea19d32c079e7d3ff931a8e0","skills\u002Ffleet\u002Fnode-inspect-debugger-sd",3,"https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit","https:\u002F\u002Fweblyfe.ai","https:\u002F\u002Fgithub.com\u002FS3YED","2026-08-27 01:54:02",{"source":8,"skillName":5,"commands":70,"prompt":80,"zipAvailable":81},[71,74,77],{"tool":72,"command":73},"npx","npx skills add S3YED\u002Fappie-kit --skill node-inspect-debugger",{"tool":75,"command":76},"bunx","bunx skills add S3YED\u002Fappie-kit --skill node-inspect-debugger",{"tool":78,"command":79},"pnpm","pnpm dlx skills add S3YED\u002Fappie-kit --skill node-inspect-debugger","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Ffleet\u002Fnode-inspect-debugger-sd\u002FSKILL.md",true,[],[84,116,150,176,203,226],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":97,"publishedAt":43},"01M6JFD4M6N4DSGC7TXEJ5R3J2","ai-music","AI music generation and audio tools: HeartMuLa lyrics-to-music generation, songwriting craft (+ Suno prompts), and audio spectrogram\u002Ffeature visualization.","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fwethlete\u002Fai-music\u002FSKILL.md",[90,93,96],{"categoryNo":91,"categoryName":92,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000013","分析与可视化",{"categoryNo":94,"categoryName":95,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000016","图像与多媒体",{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115],"music","ai music","humanizer","visualization","Tools","Audio","hermes","hermes agent","songwriting","suno","lyrics","prompts","heartmula","craft","generation","feature","ai music generation","music generation",{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":120,"categories":121,"keywords":130,"publishedAt":43},"01M6JFCZE4XNFQFMNZDHKHT5V5","agentic-webdesign-design-system-ingestion","Use v0 Design Systems 2.0, Bolt Design System Agents, or Lovable to generate production UI from a client's real design system components — not generic Tailwind. Use when building a client website where brand consistency matters.","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fweb-design\u002Fagentic-webdesign-design-system-ingestion\u002FSKILL.md",[122,125],{"categoryNo":123,"categoryName":124,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000015","视觉设计",{"categoryNo":126,"categoryName":127,"taxonomyType":128,"taxonomyTypeDesc":129},"01JBSEEDCAT000000000000032","设计师","PROFESSION","适用职业",[131,132,133,134,135,136,137,138,139,140,141,27,142,143,144,145,146,147,148,149],"design","agentic","design system","system","ingestion","webdesign","agentic webdesign design system ingestion","components","generate","design systems","website","Tailwind","bolt","lovable","v0","design-system","wed","design system components","appie",{"skillNo":151,"name":152,"nameZh":6,"description":153,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":154,"categories":155,"keywords":158,"publishedAt":43},"01M6JFCVPX3913CFAS6QQJ33ZB","agentic-webdesign-agent-elements","Use 21st.dev Agent Elements — 25 shadcn\u002Fui components purpose-built for AI agent UIs. Tool cards (Bash, Edit, Search, Plan, Subagent, MCP), chat, input, streaming. Open source, shadcn-registry install, no runtime lock-in.","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fweb-design\u002Fagentic-webdesign-agent-elements\u002FSKILL.md",[156,157],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":126,"categoryName":127,"taxonomyType":128,"taxonomyTypeDesc":129},[132,159,136,160,161,162,138,163,164,165,166,167,168,169,170,171,172,173,174,175],"elements","agentic webdesign agent elements","MCP","ai agent","registry","search","streaming","open source","open","Bash","plan","subagent","edit","install","input","lock","source",{"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":186,"publishedAt":43},"01M6JFCQC7H65M9QJ6TRE71BS1","vercel-deployment","Deploy static sites and frontends to Vercel — handles both CLI and REST API paths, including the CLI token sanitization workaround.","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fsoftware-development\u002Fvercel-deployment\u002FSKILL.md",[182,185],{"categoryNo":183,"categoryName":184,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000011","运维与部署",{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[187,188,189,34,42,40,38,190,191,192,193,194,195,196,197,198,199,200,201,202],"deployment","vercel deployment","vercel","deploy","vercel deploy","REST","api","site","deploy to vercel","token","rest api","host","sites","paths","sanitization","static site",{"skillNo":204,"name":205,"nameZh":6,"description":206,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":207,"categories":208,"keywords":210,"publishedAt":43},"01M6JFCM4SMTXBM5A01BK2YQG1","software-quality-workflows","Umbrella workflow for TDD, debugging, code simplification, spikes, pre-commit review, and debugger-assisted investigation.","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fsoftware-development\u002Fsoftware-quality-workflows\u002FSKILL.md",[209],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[211,212,213,214,215,216,217,218,36,219,26,220,221,222,223,224,225],"workflows","quality","software","software quality workflows","review","tdd","workflow","commit","code","pre-commit","investigation","code simplification","user","simplification","for",{"skillNo":227,"name":228,"nameZh":6,"description":229,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":230,"categories":231,"keywords":239,"publishedAt":43},"01M6JFCGD0M6CEATY01W7YN6DB","react-component-refactoring","Safely refactor large React components into smaller, maintainable pieces using proven patterns","https:\u002F\u002Fgithub.com\u002FS3YED\u002Fappie-kit\u002Fblob\u002Fmaster\u002Fskills\u002Fsoftware-development\u002Freact-component-refactoring\u002FSKILL.md",[232,235,238],{"categoryNo":233,"categoryName":234,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000007","代码审查",{"categoryNo":236,"categoryName":237,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000009","前端开发",{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[240,241,242,243,244,245,246,247,34,248,249,138,250,38,251,219,252,253,254,255],"react","component","refactoring","component refactoring","react component","react component refactoring","frontend","writing","safe","typescript","react components","modular","refactor","simplify","patterns","test-driven-development"]