본문으로 건너뛰기
Skillpedia
일반 코딩260k · #572

node-inspect-debugger

하는 일

이 스킬은 Node의 내장 디버거로 AI가 Node.js 프로그램의 버그를 찾도록 돕습니다. 코드가 멈춘 상태에서 프로그램의 상태를 봐야 하는 개발자를 위한 것입니다.

사용하는 경우

  • ✓Node.js 테스트가 실패하고 값을 출력해도 이유가 드러나지 않을 때.
  • ✓Node.js 프로그램이 잘못 작동하고 멈춘 상태에서 값을 검사해야 할 때.
  • ✓실행 중인 Node 프로세스에 연결해 속도나 메모리를 프로파일링해야 할 때.

스킬 링크

https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/software-development/node-inspect-debugger/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/software-development/node-inspect-debugger/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 Node.js 테스트가 잘못된 합계로 실패하는데 console.log로는 원인을 모르겠어요. 중단점을 걸고 값을 보여 주실래요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

스킬은 Node의 내장 인스펙터로 Node를 시작한 뒤, node inspect 명령이나 DevTools 스크립트를 써서 중단점을 설정하고, 단계별로 실행하며, 멈춘 프레임의 변수를 읽습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Node.js Inspect Debugger

Overview

When console.log isn't enough, drive Node's built-in V8 inspector programmatically from the terminal. You get real breakpoints, step in/over/out, call-stack walking, local/closure scope dumps, and arbitrary expression evaluation in the paused frame.

Two tools, pick one:

  • node inspect — built-in, zero install, CLI REPL. Best for quick poking.
  • ndb / CDP via chrome-remote-interface — scriptable from Node/Python; best when you want to automate many breakpoints, collect state across runs, or debug non-interactively from an agent loop.

Prefer node inspect first. It's always available and the REPL is fast.

When to Use

  • A Node test fails and you need to see intermediate state
  • ui-tui crashes or behaves wrong and you want to inspect React/Ink state pre-render
  • tui_gateway child processes (_SlashWorker, PTY bridge workers) misbehave
  • You need to inspect a value in a closure that console.log can't reach without patching
  • Perf: attach to a running process to capture a CPU profile or heap snapshot

Don't use for: things console.log solves in under a minute. Breakpoint-driven debugging is heavier; use it when the payoff is real.

Quick Reference: node inspect REPL

Launch paused on first line:

node inspect path/to/script.js
# or with tsx
node --inspect-brk $(which tsx) path/to/script.ts

The debug> prompt accepts:

Command Action
c or cont continue
n or next step over
s or step step into
o or out step out
pause pause running code
sb('file.js', 42) set breakpoint at file.js line 42
sb(42) set breakpoint at line 42 of current file
sb('functionName') break when function is called
cb('file.js', 42) clear breakpoint
breakpoints list all breakpoints
bt backtrace (call stack)
list(5) show 5 lines of source around current position
watch('expr') evaluate expr on every pause
watchers show watched expressions
repl drop into REPL in current scope (Ctrl+C to exit REPL)
exec expr evaluate expression once
restart restart script
kill kill the script
.exit quit debugger

In the repl sub-mode: type any JS expression, including access to locals/closure variables. Ctrl+C exits back to debug>.

Attaching to a Running Process

When the process is already running (e.g. a long-lived dev server or the TUI gateway):

# 1. Send SIGUSR1 to enable the inspector on an existing process
kill -SIGUSR1 <pid>
# Node prints: Debugger listening on ws://127.0.0.1:9229/<uuid>

# 2. Attach the debugger CLI
node inspect -p <pid>
# or by URL
node inspect ws://127.0.0.1:9229/<uuid>

To start a process with the inspector from the beginning:

node --inspect script.js           # listen on 127.0.0.1:9229, keep running
node --inspect-brk script.js       # listen AND pause on first line
node --inspect=0.0.0.0:9230 script.js   # custom host:port

For TypeScript via tsx:

node --inspect-brk --import tsx script.ts
# or older tsx
node --inspect-brk -r tsx/cjs script.ts

Programmatic CDP (scripting from terminal)

When you want to automate — set many breakpoints, capture scope state, script a repro — use chrome-remote-interface:

npm i -g chrome-remote-interface        # or project-local
# Start your target:
node --inspect-brk=9229 target.js &

Driver script (save as ~/.hermes/cache/scratch/cdp-debug.js):

const CDP = require('chrome-remote-interface');

(async () => {
  const client = await CDP({ port: 9229 });
  const { Debugger, Runtime } = client;

  Debugger.paused(async ({ callFrames, reason }) => {
    const top = callFrames[0];
    console.log(`PAUSED: ${reason} @ ${top.url}:${top.location.lineNumber + 1}`);

    // Walk scopes for locals
    for (const scope of top.scopeChain) {
      if (scope.type === 'local' || scope.type === 'closure') {
        const { result } = await Runtime.getProperties({
          objectId: scope.object.objectId,
          ownProperties: true,
        });
        for (const p of result) {
          console.log(`  ${scope.type}.${p.name} =`, p.value?.value ?? p.value?.description);
        }
      }
    }

    // Evaluate an expression in the paused frame
    const { result } = await Debugger.evaluateOnCallFrame({
      callFrameId: top.callFrameId,
      expression: 'typeof state !== "un
자주 묻는 질문

설치가 필요한가요?

기본 방법은 필요 없습니다. 스킬은 node inspect가 내장되어 있으며, 스크립트 방식에는 추가 패키지가 필요하다고 말합니다.

언제는 쓸 가치가 없나요?

console.log로 1분 안에 해결할 수 있는 문제라면 쓰지 말라고 스킬이 말합니다.

실행 중인 앱을 프로파일링할 수 있나요?

네. 스킬은 CPU 프로파일이나 힙 스냅샷을 얻기 위해 실행 중인 프로세스에 연결하는 것을 언급합니다.

상세 정보

작성자의 원본 설명

Debug Node.js via --inspect + Chrome DevTools Protocol CLI.

repo: NousResearch/hermes-agent

인기도

GitHub 스타
260k
순위
#572
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬