Index of every page on this site: llms.txt
All skills
jasnell avatar

/node-diagnostics

@5f83e6c
Run it yourself

Instrumentation, context propagation and profiling added since Node.js 24. Use to instrument a library for APM or OpenTelemetry, propagate request context across async calls, profile one section of code (CPU or heap), capture a heap profile before an out-of-memory crash, find leaked objects, or set a conditional logpoint without editing code. Covers diagnostics_channel boundedChannel and TracingChannel (Stable), built-in channels, AsyncLocalStorage withScope/defaultValue, v8.startCpuProfile/startHeapProfile, setHeapProfileNearHeapLimit, queryObjects, node inspect --probe (--cond, --max-hit) and inspector Network/DOMStorage. Node.js 24+, some 26+.

Use this Skill: https://skilld.dev/gh/jasnell/node-skills/node-diagnostics

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

rulesprobe-mode.md

≈881 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Debugger probe mode (node inspect --probe)

Source: doc/api/debugger.md ("Probe mode") at nodejs/node ab476eccd03. Stability 1. Verified by examples/probe-mode.mjs (v24.19+) and examples/probe-cond.mjs (v24.20+).

Capability Versions
--probe/--expr, --json, --preview, --timeout, --port v26.1.0, v24.16.0
JSON schema v2 (target object, location per hit) v26.2.0, v24.19.0
probe_failure terminal error, error.details v26.3.0, v24.19.0
--max-hit <n> v26.4.0, v24.19.0
--cond <expr> v26.6.0, v24.20.0
node inspect [--json] [--preview] [--timeout=<ms>] [--port=<port>] \
  --probe <file>:<line>[:<col>] --expr <expr> [--cond <expr>] [--max-hit <n>] \
  [--probe ... --expr ...] [--] [<node-option> ...] <script> [args...]

Rules:

  • --probe must be followed immediately by exactly one --expr. --cond and --max-hit come after that pair, at most once each.
  • <file> is a path-separator-anchored suffix of the script URL (utils.js matches every utils.js, so use src/utils.js to narrow it). Line and column are 1-based. Without a column, the probe binds to the first executable column.
  • The expression is evaluated before the line runs, in its lexical scope. Don't probe a let/const on its own declaration line (ReferenceError).
  • Probes sharing a location share one pause, and their expressions run in command-line order. They must share one --cond (or none). Conflicting conditions exit 9 with Probes at app.js:3 must use the same --cond (or none) on stderr.
  • A --cond that throws counts as false.
  • --max-hit applies per pair. When any probe reaches its limit, the session detaches and reports. The target keeps running.
  • Child Node.js flags go after --. The child's stdout and stderr are silenced. Default timeout is 30000 ms.
  • On v24.19 (no --cond), passing --cond fails with "Use -- before child Node.js flags in probe mode" plus the usage text.

Text output

Hit 1 at file:///path/app.js:3:3
  i = 4
Completed

JSON v2 (--json)

{"v":2,
 "probes":[{"expr":"i","target":{"suffix":"app.js","line":3},"condition":"i>1","maxHit":2}],
 "results":[
  {"probe":0,"event":"hit","hit":1,"location":{"url":"file:///…/app.js","line":3,"column":3},
   "result":{"type":"number","value":2,"description":"2"}},
  {"event":"completed"}]}
  • target.column is present only if you gave :col. condition and maxHit are present only when set.
  • A failing expression produces a hit with error: { message, details? } instead of result, and the session continues. The contents of message and details are informational and unstable.
  • The last entry is always a terminal event:
    • {"event":"completed"}: normal end, or --max-hit reached
    • {"event":"miss","pending":[i,...]}: the script ended with probes never hit (exit 0)
    • {"event":"timeout","pending":[...],"error":{"code":"probe_timeout",...}}: exit 1 (observed)
    • {"event":"error","pending":[...],"error":{"code":"probe_target_exit","exitCode":3,"stderr":"",...}}: the target exited before every probe was hit. The prober still exits 0 (observed)
    • {"event":"error","error":{"code":"probe_failure","probe":i,...}}: non-zero exit (per docs; not reproduced here)
  • Use --preview to include CDP property previews for object values. Or use --expr 'JSON.stringify(obj)'.
  • Invalid arguments print usage to stderr with no report (exit 9 observed).

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts5d3 checks · Risk SAFE
  • Gen Agent Trust Hub5d

    This skill provides technical documentation and examples for Node.js diagnostics and profiling features (v24+). It covers instrumentation, context propagation, and debugging utilities like TracingChannel and AsyncLocalStorage. No security risks were identified.

  • Socket5d

    No alerts

  • Snyk5d

    Risk: LOW · No issues

Signed by skilld at 5f83e6c. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 5 days ago.

Activeupdated last week

README badge

README badge for jasnell/node-skills/node-diagnostics