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.

rulesasync-context.md

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

AsyncLocalStorage additions

Source: doc/api/async_context.md at nodejs/node ab476eccd03. Verified by examples/als-scope.mjs and examples/als-options.mjs.

new AsyncLocalStorage({ defaultValue, name }) (v24.0.0)

  • getStore() returns defaultValue when no store has been entered.
  • als.run(undefined, fn) and als.exit(fn) give undefined inside fn, not defaultValue.
  • als.name is the given name, or '' when none was given.

als.withScope(store) → RunScope (v25.9.0, v24.20.0; Stability 1)

{
  using _ = als.withScope(store);   // enter
  work();                           // getStore() === store
}                                   // previous store restored, also on throw
const s = als.withScope(store); /* ... */ s.dispose(); // manual; idempotent
  • RunScope has dispose() and [Symbol.dispose](). The class is not exported.
  • Without using, a missing dispose() leaves the store entered for the rest of the current execution context. That is the same as enterWith().
  • Async trap: in an async function, the scope entered before the first await stays visible to the caller after it gets the promise back. This was verified: await f() followed by getStore() in the caller still returns the leaked store. Use als.run(store, async () => ...) for async work.
  • Prefer withScope over enterWith for block-scoped sync context (request parsing, middleware that must restore on throw).

The diagnostics_channel counterpart is channel.withStoreScope(data) (v26.1.0). See diagnostics-channel.md.

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