/dstack-typescript:node-internals-diagnosisfrom DStack TypeScript
Diagnoses Node.js crashes, leaks, event-loop stalls, thread-pool saturation, V8 deoptimizations, and binding.gyp failures using gdb, Valgrind, heap snapshots, libuv trace, and deopt logs. Produces a root-cause report without editing code or restarting services.
Ships in DStack TypeScript. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Crashes and stalls in Node.js rarely explain themselves. This skill traces a native segfault, addon crash, memory leak, event-loop anomaly, thread-pool saturation, deoptimization storm, or binding.gyp failure to one root cause backed by tool evidence. The run ends with a diagnosis report naming that cause, or with a blocked report naming the blocker.
Nothing here edits code or restarts services. The skill runs diagnostic binaries and writes only the diagnosis report plus its diagnostic artifacts; rollback deletes those artifacts. No file, version-control, credential, paid, published, deployed, or remote mutation occurs. What you need before diagnosing: the symptom class, which is required, and the Node.js version and platform (OS, arch), also required.
Optional evidence sharpens the work: crash signal (such as SIGSEGV or SIGABRT) and process ID, a core dump or minidump path, a heap snapshot (--heap-snapshot-signal or v8.writeHeapSnapshot() output), a --trace-deopt log, libuv trace output (LIBUV_TRACE level 1-4), a gdb or lldb backtrace, and the crashing native addon or module name and version.
Match the symptom to one class first: segfault or addon crash, native memory leak, heap (V8) leak, event-loop anomaly, thread-pool saturation, V8 deoptimization, or binding.gyp failure. A symptom outside all seven stops the run with blocked: unsupported-failure-class.
Gather the minimum evidence for the matched class:
thread apply all bt full. Note the crashing instruction address and shared object name.--heap-snapshot-signal=SIGUSR2 or v8.writeHeapSnapshot(). Diff two snapshots and find which objects retain the most paths.LIBUV_TRACE=4 enabled. Identify handles alive past their expected lifetime and check libuv refs on them.UV_THREADPOOL_SIZE, capturing queue depth and average wait time. Correlate with the async operations outstanding.--trace-deopt output. For each deopt site, reconstruct the hidden class and property access order. A site firing repeatedly points at a polymorphic inline cache gone megamorphic.include_dirs, libraries, and cflags_c in the generated build/config.gypi. Confirm the target Node.js abi_{NODE_MODULE_VERSION} matches the runtime and that platform detection (win, darwin, linux) is correct.Each class has its own checks. A segfault trace gets HandleScope-lifetime and libuv-lifetime review: was a C++ object used after destruction, or a handle closed too early? Backtraces into a native addon point at its lifetime violations; backtraces into V8 internals point at improper Persistent handle management. A native-leak report leads to the allocating frame: an addon freeing nothing, or a Persistent handle pinning a native buffer past collection. Cross-reference the addon's cleanup path. A heap-snapshot delta exposes the retaining path: a closure holding an unexpected reference, an unremoved event listener, a cache growing without eviction, a setInterval callback holding objects. Name the path and the code creating it. An event-loop anomaly comes down to the handle type keeping the loop alive (timer, socket, pipe, signal, uv_poll_t): never closed, closed with a retained reference, or re-registered on every callback iteration. Look for missing uv_close() calls and for unref'd handles that should have stayed ref'd. Thread-pool saturation means workload beyond UV_THREADPOOL_SIZE (default 4), one slow operation blocking the pool, or work on the pool that belonged on the event loop. Name the blocking operation and the pool-size mismatch. A deopt site means property insertion order varying across calls, a constructor returning a different layout than first built, or a polymorphic cache turned megamorphic. Name the site, the hidden-class transition, and the layout-diverging code. A binding.gyp failure means a missing header path, an ABI version mismatching the runtime, or broken platform detection. Name the configuration error.
Write the diagnosis report with the root cause named as one of: C++ object lifetime violation, megamorphic IC, hidden-class layout mismatch, thread-pool starvation, libuv handle leak, native allocation leak, V8 retaining-path leak, event-loop handle leak, ABI mismatch, or other. Attach the supporting evidence: backtrace, leak report, snapshot delta, trace output, or queue metrics. Confirm the report states failure class, root cause, supporting evidence, and any missing evidence. A contradictory or ambiguous picture stops the run with blocked: ambiguous-root-cause rather than a guess.
The diagnostic binary errors or produces nothing: capture stderr and return blocked: missing-evidence with the message. Never fabricate a root cause.
The symptom fits no decision tree: return blocked: unsupported-failure-class.
Tool output contradicts itself, for instance a reported leak with a flat snapshot: return blocked: ambiguous-root-cause listing both findings. Resolve the contradiction before naming anything.
Partial evidence still has value: return the partial classification with the evidence on hand and name explicitly what is missing.
One diagnosis report: failure class, root cause, supporting evidence, and missing evidence, or blocked with the named blocker and detail.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub gosuda/dstack-skills --plugin dstack-typescript5 skills in this plugin
/nodejs-graceful-shutdownUse when asked to implement or fix service termination: SIGTERM or SIGINT, connection draining, health-check signaling. Not for general service scaffolding: use nodejs-service-foundations./nodejs-service-foundationsUse when asked to set up or harden Node.js service foundations: env validation, logging, typed errors, type stripping, and shutdown wiring. Not for dedicated shutdown: use nodejs-graceful-shutdown./typescript-best-practicesUse when TypeScript needs shaping toward narrow types, unions, exhaustive variants, and strict flags. Not for error repair: use typescript-type-hardening. Not for non-TS domains: use type-driven.Other plugins' skills for the same job