Index of every page on this site: llms.txt
Avatar for James M Snell

James M Snell

@jasnellperson

Node.js Core Contributor / TSC Cloudflare Principal Engineer, Workers Runtime

19 skills 66 Clovis, California Synced
npx skilld add jasnell/node-skills --all
  • Node.js now has a built-in benchmark runner, node:bench. Use it whenever writing or running a JavaScript performance benchmark instead of a hand-written timing loop: "which is faster", measuring how fast code is, comparing two implementations, check for a performance regression, or when reaching for benchmark.js, tinybench or mitata. Covers bench, suite/describe, hooks, BenchContext start/end/record, doNotOptimize, createRunner/run, reporters, and the --experimental-bench and --bench* flags. Node.js 26.9+ only (not on v24).

  • Modern node:crypto and WebCrypto: Argon2 password hashing, post-quantum ML-KEM/ML-DSA/SLH-DSA, KMAC, SHA-3/SHAKE, AES-SIV/GCM-SIV/OCB, ChaCha20-Poly1305, UUIDv7, PKCS#12 parsing and X.509 certificate generation. Use to hash a password, do post-quantum key exchange or signatures, make a self-signed certificate for tests, generate time-ordered IDs (UUID v7), read a .p12/.pfx, or fix CryptoKey, setEngine or SHAKE outputLength errors. Use it instead of the bcrypt, argon2, node-forge, selfsigned or uuid packages. Covers crypto.argon2, encapsulate/decapsulate, createMac, SubtleCrypto.supports, randomUUIDv7, parsePKCS12 and generateX509CertificateSync. Node.js 24.7+.

  • 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+.

  • Verifies that an experimental or recently added Node.js API, CLI flag, or global exists in the user's installed Node.js before code depends on it, and finds the version-matched docs. Use before writing code that uses any Stability 1.x Node.js feature (node:bench, node:vfs, node:ffi, node:quic, node:dtls, stream/iter, zlib ZipFile, --experimental-* or --allow-* flags) or any API added in Node.js 24+, or when an API "is not a function", ERR_UNKNOWN_BUILTIN_MODULE, or "bad option" appears.

  • Calls C functions in shared libraries directly from JavaScript with the built-in node:ffi, with no C++ addon. Use to call libc, libsqlite3 or a vendor .so/.dylib/.dll from Node.js, pass a JS callback to native code, or read and write native memory. Use it instead of ffi-napi, node-ffi, or an addon written for one function. Covers ffi.dlopen, DynamicLibrary, getFunction, registerCallback, toFunction, the pointer and memory helpers and --allow-ffi. Node.js 26.1+ (not on v24).

  • Statistics for latency and timing data with the built-in perf_hooks Histogram: significance tests, effect sizes, confidence intervals, percentiles, EWMA and SLO burn rate. Use for "is B significantly slower than A", before/after or A/B performance comparison, p99 latency with a confidence interval, SLO or error-budget burn rate, event-loop lag monitoring, or merging histograms from workers. Use it instead of simple-statistics or hdr-histogram-js. Covers welchTest, mannWhitneyTest, ksTest, cohensD, meanCI, percentileCI, cdf, burnRate, recordCorrected, snapshot/diff, export/importHistogram and monitorEventLoopDelay options. Node.js 24.12+; most need 24.21+ or 26.8+.

  • Fixes Node.js code that uses APIs removed or deprecated in v25-v28, or that relies on changed defaults. Use when upgrading Node.js; when fixing a DEP0xxx DeprecationWarning, ERR_UNKNOWN_BUILTIN_MODULE, "cannot be invoked without 'new'" or "is not a function" after an upgrade; or when reviewing code written for Node 22 or older. Covers SlowBuffer, fs.F_OK, fs.rmdir recursive, assert.CallTracker, node:_stream_*, crypto.fips, setEngine, CryptoKey in node:crypto, SHAKE outputLength, and the zlib/REPL classes that now need new. Also covers the new defaults for keepAliveTimeout (65s), Buffer.poolSize, readable.read() and localStorage. Node.js 24+.

  • Node.js now runs TypeScript .ts files directly (type stripping is Stable) and loads code differently: require() of ES modules, loader hooks with module.registerHooks (which replaces module.register and --loader), package maps and the compile cache. Use when running TypeScript without a build step or instead of tsx/ts-node, requiring ESM from CommonJS, writing or migrating loader hooks, fixing "bad option: --loader", resolving packages in a monorepo, or using --config-file. Covers --no-strip-types, ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX, ERR_REQUIRE_ASYNC_MODULE, import with type 'text', Wasm import source, the "worker" condition, "private" packages and the compile cache. Node.js 24+.

  • Networking APIs and behavior changes since Node.js 24 in net, dgram, tls, http and http2. Use to reserve a port before listening, block private IPs (SSRF), cancel work when a client disconnects, send 103 Early Hints, honor HTTP_PROXY/HTTPS_PROXY, validate header values, use promise-based net, or debug keepAliveTimeout (now 65s), upgrade-request bodies or dns.reverse. Covers node:net/promises, net.BoundSocket, BlockList PRIVATE_RANGES, setKeepAlive({ interval, count }), dgram bindSync, TLS certificateCompression, http.isValidHeaderValue, websocketMask, req.signal, NODE_USE_ENV_PROXY and HTTP/2 http1Options. Node.js 24+, some 26/27+.

  • Sandboxes Node.js processes with the built-in permission model (--permission). Use to run an untrusted script; restrict a process to read-only access to a folder; block network, env, child processes, workers or addons; drop privileges after startup; audit which permissions an app needs; or handle ERR_ACCESS_DENIED. Covers --allow-fs-read/--allow-fs-write, --allow-net, --allow-env, --allow-child-process, --allow-worker, --allow-addons, --allow-wasi, --allow-ffi, --allow-inspector, process.permission.has()/drop(), --permission-audit and the config-file "permission" namespace. Node.js 24+ (--allow-net 25+, --allow-env 27+).

  • Node.js can now limit how long any process runs and explain why it was stuck: --process-timeout=duration. On expiry it exits with code 124 and prints the JS stack and the handles keeping the event loop alive. Use whenever a Node.js script, CLI tool, server, cron job, test run or CI step hangs or won't exit when it's done; to find out why a process is still running (open handles, leaked servers or sockets, timers); to bound a run without wrapper code or timeout(1); or to tell whether a child process was killed by its timeout option (subprocess.timedOut). Also covers --report-on-process-timeout. Node.js 26.11+ (not on v24); timedOut v27+.

  • QUIC, HTTP/3 and DTLS in Node.js with node:quic and node:dtls. Use for QUIC connections or streams, HTTP/3, unreliable datagrams, DTLS over UDP, IoT/CoAP with pre-shared keys, or WebRTC DTLS-SRTP keying. Covers quic.connect/listen, QuicEndpoint/QuicSession/QuicStream, sendDatagram, dtls.listen/connect, PSK, SNI, session resumption, --experimental-quic and --experimental-dtls. Needs a Node.js built with QUIC/DTLS support (standard release builds lack it). QUIC 24.16+/26.x, DTLS 26.9+.

  • Maintains the node-skills repo as Node.js evolves: surveys nodejs/node for new or changed APIs, finds stale or missing coverage, updates existing skills or creates new ones, verifies every claim on real binaries, tunes descriptions so skills trigger, and re-pins provenance. Use when asked to update the Node.js skills for a new release or for nodejs/node main, add a skill for a new Node.js feature, check the skills for drift or staleness, fix a skill that gives wrong or outdated guidance, or improve skill triggering.

  • Node.js now has a built-in SQLite database, node:sqlite, with no npm dependency. Use whenever a Node.js task needs a database that runs in-process: SQLite, a local, embedded or in-memory database, or app/CLI storage; safe parameterized SQL that prevents SQL injection; running untrusted SQL; or would otherwise reach for better-sqlite3 or sqlite3. Covers Database/Statement (DatabaseSync and StatementSync are deprecated aliases), createTagStore tagged-template SQL, setAuthorizer, defensive mode (on by default), limits, serialize/deserialize, createModule virtual tables, statement.close/stat and using. Node.js 24+; some parts need 24.22+ or 26.x.

  • Experimental iterable-first streams API, node:stream/iter (behind --experimental-stream-iter). Use only when the user asks for stream/iter or that flag, or explicitly accepts an experimental API for async-iterable stream pipelines with backpressure. Without that opt-in, prefer classic node:stream for production code. Covers from/pull/pipeTo/push/duplex/broadcast/share, text/bytes/array consumers, transforms, filehandle.pull/writer, fromReadable/toReadable interop and node:zlib/iter compressGzip/decompressZstd. Node.js 24.20+ or 25.9+; behavior differs before 26.12.

  • New node:test features since Node.js 24. Use when writing or running node:test suites: tagging or filtering tests, randomizing order to expose order-dependent tests, rerunning only failures, global setup/teardown, failing on .only, expected-failure tests, asserting mock calls, logging from tests, tracing tests with OpenTelemetry, or porting jest/vitest tests (toHaveBeenCalledWith, test.failing, mockReturnValue). Covers --experimental-test-tag-filter, --test-randomize, --test-rerun-failures, --test-global-setup, --test-forbid-only, expectFailure, context.log, getTestContext(), t.assert.called/nthCalledWith and --test-coverage-include-all. Node.js 24+.

  • Small built-ins added since Node.js 24 that replace common npm packages. Use for debounce/throttle, temp files and directories with automatic cleanup, URL pattern matching or routing, an in-process mutex (Web Locks), Web Workers, partial deep-equality checks, UTF-8 byte length or fs.glob depth limits, or when about to install lodash.debounce, p-throttle, tmp or urlpattern-polyfill. Covers util.debounce/throttle, isPartialDeepStrictEqual, markPromiseAsHandled, Buffer.stringLength, fs.mkdtempDisposable, fs.mkstemp, openAsBlobSync, Utf8Stream, URLPattern, navigator.locks, the global Worker, addUncaughtExceptionCaptureCallback and tty raw modes. Node.js 24+.

  • Node.js now has a built-in virtual file system, node:vfs, plus single executable apps with bundled assets (--build-sea). Use whenever code that uses fs must be tested without touching the real disk (instead of memfs/mock-fs or stubbing fs), bundle assets or a whole app into one executable, import or run modules from a zip, or overlay a directory copy-on-write. Covers vfs.create, MemoryProvider, ComposableProvider, RealFSProvider, ZipProvider, mount, --vfs-load, --allow-fs-vfs and SEA useVfs/vfsArchive. Node.js 26.4+ (not on v24; needs --experimental-vfs on 26.x).

  • Node.js now has built-in ZIP archive support in node:zlib, with no npm dependency. Use whenever Node.js code must create, read, extract, stream or modify .zip files, including writing a function or script that zips or unzips: unzip or extract an upload, read a .zip, stream a large entry, append to or delete from an existing zip, safely handle untrusted zips (Zip Slip, zip bombs), or when reaching for adm-zip, jszip, archiver, yauzl or unzipper. Covers ZipFile, ZipBuffer, ZipEntry, zipFiles, createZipArchive, setMaxZipContentSize and zlib.crc32c. Node.js 26.8+ (not on v24).

Curated skills from @jasnell. Checked GitHub just now