CommunityCodierung & Entwicklunggithub.com

Node-Inspect-Debugger

Debuggen von Node.js mit node inspect, --inspect, Haltepunkten, CDP, Heap- und CPU-Profilen.

Was ist Node-Inspect-Debugger?

Dieses Skill ermöglicht das Debuggen von Node.js-Anwendungen mit dem integrierten `node inspect` Befehl und dem Chrome DevTools Protocol (CDP). Es eignet sich besonders für schwierige Situationen wie versteckte lokale Variablen, asynchrone Hänger, flaky Tests, Child-Prozesse, Start-Race-Conditions, Speicherwachstum und CPU-hot-paths. Standardmäßig wird `node inspect` empfohlen; CDP kommt zum Einsatz, wenn programmatische Haltepunkte, automatisierte Zustandserfassung, Heap-Snapshots oder CPU-Profile benötigt werden. Das Skill unterstützt Debugging von TypeScript über `tsx`, das Anhängen an laufende Prozesse via PID und die Integration mit dem OpenClaw-Testframework. Es enthält auch einen minimalen CDP-Treiber für eigene Debugging-Skripte und zeigt häufige Fallstricke wie das Vergessen von `--inspect-brk` oder Probleme mit Quellkarten auf.

Funktioniert mit~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/clawdbot/clawdbot/tree/main/skills/node-inspect-debugger

Installed? Explore more Codierung & Entwicklung skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Node Inspect Debugger

Verwenden für Node.js-Debugging, das Inspector-Zugriff benötigt: versteckte lokale Variablen, asynchrone Hänger, flaky Tests, Child-Prozesse, Start-Race-Conditions, Speicherwachstum oder CPU-hot-paths.

Standardmäßig node inspect verwenden. Chrome DevTools Protocol nur dann verwenden, wenn programmatische Haltepunkte, automatisierte Zustandserfassung, Heap-Snapshots oder CPU-Profile benötigt werden.

Schnellstart

  • Beim Einstieg pausieren: node inspect path/to/script.js
  • TypeScript: node --inspect-brk --import tsx path/to/script.ts
  • Vorhandene PID: kill -SIGUSR1 <pid> dann node inspect -p <pid>
  • Inspect-Ziele auflisten: curl -s http://127.0.0.1:9229/json/list | jq
  • OpenClaw CLI-Pfad: node --inspect-brk openclaw.mjs ...
  • OpenClaw Test-Pfad: OPENCLAW_VITEST_MAX_WORKERS=1 node --inspect-brk scripts/run-vitest.mjs <file>

Debugger-REPL

  • Fortsetzen/Schritt: cont, next, step, out, pause
  • Haltepunkte: sb('file.js', 42), sb(42), sb('functionName'), breakpoints, cb('file.js', 42)
  • Untersuchen: bt, list(8), watch('expr'), exec expr
  • Aktueller Gültigkeitsbereich: repl, dann lokale Variablen direkt auswerten; Strg+C verlässt den REPL-Modus.
  • Sicheres Beenden: cont vor dem Verlassen, wenn der Prozess fortgesetzt werden soll; andernfalls kill.

OpenClaw-Tipps

  • Bevorzugt 127.0.0.1 Inspector-Bindungen verwenden. --inspect=0.0.0.0 nur freigeben, wenn das Netzwerk isoliert ist.
  • Für Vitest eine Datei mit einem Worker debuggen. Vermeiden Sie Worker-Pools während des Schrittdurchlaufs.
  • Für TS-Quellhaltepunkte --enable-source-maps verwenden, wenn nützlich; node inspect kann weiterhin emittierte Pfade anzeigen.
  • Für Child-Prozesse kann NODE_OPTIONS=--inspect-brk den Inspector weitergeben, aber jeder Child-Prozess benötigt einen eigenen Port.
  • Für langlebige Gateway- oder Entwicklungsumgebungsprozesse per PID anhängen, nachdem das Ziel mit /json/list bestätigt wurde.

Programmatische CDP

Werkzeuge außerhalb des Repositorys installieren, sofern das Projekt nicht bereits darauf angewiesen ist:

mkdir -p /tmp/cdp-tools
npm --prefix /tmp/cdp-tools i chrome-remote-interface
NODE_PATH=/tmp/cdp-tools/node_modules node /tmp/cdp-debug.cjs

Minimaler Treiber:

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);
    const { result } = await Debugger.evaluateOnCallFrame({
      callFrameId: top.callFrameId,
      expression: "JSON.stringify({ pid: process.pid })",
    });
    console.log(result.value ?? result.description);
    await Debugger.resume();
  });

  await Runtime.enable();
  await Debugger.enable();
  await Debugger.setBreakpointByUrl({ urlRegex: ".*target\\.js$", lineNumber: 41 });
  await Runtime.runIfWaitingForDebugger();
})();

Profile

  • CPU: Profiler aktivieren, start, warten, stop, /tmp/profile.cpuprofile schreiben, in Chrome DevTools öffnen.
  • Heap: HeapProfiler aktivieren, addHeapSnapshotChunk sammeln, takeHeapSnapshot aufrufen, /tmp/heap.heapsnapshot schreiben.

Fallstricke

  • --inspect pausiert nicht; verwenden Sie --inspect-brk, wenn die Einrichtung vor der Codeausführung erfolgen muss.
  • Standardport ist 9229; verwenden Sie --inspect=0 oder einen eindeutigen Port für parallele Ziele.
  • Wenn ein Haltepunkt nicht zuschlägt, überprüfen Sie den Dateipfad, das Verhalten der Quellkarten und ob die Ausführung die Zeile bereits passiert hat.
  • Wenn der Prozess nach dem Trennen eingefroren erscheint, könnte er noch im Debugger pausieren.

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

acp-router

Route plain-language requests for Claude Code, Cursor, Copilot, OpenClaw ACP, OpenCode, Gemini CLI, Grok Build, Qwen, Kiro, Kimi, iFlow, Factory Droid, Kilocode, or explicit ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation. Codex chat binding defaults to the native Codex app-server plugin unless ACP is explicit or background spawn needs ACP.

add-model-provider

Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials.

agent-transcript

Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.

apple-notes

Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.

apple-reminders

List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.

auto-qa

Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

bear-notes

Create, search, and manage Bear notes via grizzly CLI.

blacksmith-testbox

Run Blacksmith Testbox for CI-parity checks, secrets, hosted services, migrations, or builds local cannot reproduce.

block-kit

Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

blogwatcher

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

blucli

BluOS CLI (blu) for discovery, playback, grouping, and volume.

bluebubbles

Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.

browser-automation

Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.

camsnap

Capture frames or clips from RTSP/ONVIF cameras and local webcams, including USB pan/tilt/zoom control.

canvas

Present HTML on connected OpenClaw node canvases, navigate/eval/snapshot, and debug canvas host URLs.

channel-message-flows

Use when running QA Lab channel message flow evidence.

clawdtributor

Clawtributor PRs here, last week or another window: discover conversation refs, recheck GitHub, rank by impact.

clawhub

Search ClawHub for plugins by default, or skills when explicitly requested; install, verify, update, uninstall, publish, or sync skills.

Verwandte Skills