nodejs-core

mcollina/skills · updated Apr 27, 2026

$npx skills add https://github.com/mcollina/skills --skill nodejs-core
0 commentsdiscussion
summary

Deep Node.js internals expertise for native modules, V8 optimization, libuv diagnostics, and C++ addon development.

  • Covers V8 garbage collection, hidden classes, JIT compilation, and deoptimization tracing; libuv event loop phases, thread pool tuning, and async I/O patterns
  • Provides N-API and node-addon-api binding patterns, native memory management, and segfault debugging with gdb/lldb
  • Includes build system guidance for node-gyp, gyp, ninja, and cross-platform compilation; diagnosti
skill.md

When to use

Use this skill when you need deep Node.js internals expertise, including:

  • C++ addon development
  • V8 engine debugging
  • libuv event loop issues
  • Build system problems
  • Compilation failures
  • Performance optimization at the engine level
  • Understanding Node.js core architecture

How to use

Read individual rule files for detailed explanations and code examples:

V8 Engine

libuv

Native Addons

Core Modules Internals

JavaScript Internals

  • rules/primordials.md - Using primordials to prevent prototype pollution (required for lib/internal/)

Build & Contributing

Documentation

  • rules/documentation.md - Updating doc/api/*.md files: structure, link ordering, error docs, code example constraints

Debugging & Profiling

Instructions

MANDATORY: Rebuild before testing

Node.js embeds lib/ JavaScript files into the binary at compile time via js2c. After ANY change to src/ or lib/, you MUST rebuild before running tests. Without a rebuild, tests run against stale code and results are meaningless.

edit src/ or lib/  →  make -j$(nproc)  →  make lint  →  then test

Never skip the rebuild step. Never run ./node test/... after editing without building first.

Before starting work, ask the user about their build configuration (Make vs Ninja, debug vs release, what configure flags they use). Do not assume a specific setup. Most of the time, ./configure has already been run and only make -j$(nproc) is needed to rebuild.

See rules/build-and-test-workflow.md for the full workflow including configure flags, lint targets, and test commands.

Core knowledge domains

Apply deep knowledge of Node.js internals across these domains:

  • Core architecture: Node.js core modules and their C++ implementations, V8 GC and JIT, libuv event loop mechanics, thread pool behavior, startup/module-loading lifecycle
  • Native development: N-API, node-addon-api, and NAN addon development; V8 C++ API handle management; memory safety; native debugging with gdb/lldb
  • Build systems: node-gyp, gyp, ninja, make; cross-platform compilation; linker errors; dependency issues; platform-specific considerations (Windows, macOS, Linux, embedded)
  • Performance & debugging: Event loop profiling, memory leak detection in JS and native code, CPU flame graphs, V8 optimization/deoptimization tracing

Quick-reference debugging commands

V8 optimization tracing:

node --trace-opt --trace-deopt script.js
# Checkpoint: confirm no unexpected deoptimization warnings before proceeding to profiling
node --prof script.js && node --prof-process isolate-*.log > processed.txt

Event loop lag detection:

node --trace-event-categories v8,node,node.async_hooks script.js

Native addon debugging (gdb):

gdb --args node --napi-modules ./build/Release/addon.node
# Inside gdb:
run
bt        # backtrace on crash
# Checkpoint: verify backtrace shows the expected call site before applying a fix

Heap snapshot for memory leaks:

node --inspect script.js   # then open chrome://inspect, take heap snapshot
# Checkpoint: compare two consecutive heap snapshots to confirm leak growth before and after the fix; run valgrind --leak-check=full node addon_test.js to confirm no native leaks remain

Node.js-specific diagnostic decision trees

Segfault / crash in native addon:

  1. Is the crash reproducible with node --napi-modules? → Run gdb, capture bt
  2. Does bt point to a V8 handle scope issue? → Check HandleScope / EscapableHandleScope usage in the addon
  3. Does it point to a libuv callback? → Inspect async handle lifetime and uv_close() sequencing
  4. No clear C++ frame? → Check for JS-side type mismatches passed into the native binding

V8 deoptimization / performance regression:

  1. Run --trace-opt --trace-deopt → identify the deoptimized function and reason (e.g., "not a Smi", "wrong map")
  2. Checkpoint: confirm the same function deoptimizes consistently across runs
  3. Inspect hidden class transitions (--trace-ic) and fix property addition order or type inconsistencies
  4. Re-run --trace-opt to confirm the function is now optimized

Build failure (node-gyp / binding.gyp):

  1. Is it a missing header? → Verify include_dirs in binding.gyp and Node.js header installation
  2. Is it a linker error? → Check libraries and link_settings entries; confirm ABI compatibility
  3. Is it platform-specific? → Consult rules/build-system.md for Windows/macOS/Linux differences

Always consider both JavaScript-level and native-level causes, explain performance implications and trade-offs, and indicate the stability status of any experimental features discussed. Code examples should demonstrate Node.js internals patterns and be production-ready, accounting for edge cases typical developers might miss.

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.761 reviews
  • Nia Rao· Dec 28, 2024

    nodejs-core fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Nia Dixit· Dec 28, 2024

    Useful defaults in nodejs-core — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Shikha Mishra· Dec 24, 2024

    nodejs-core is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Daniel Huang· Dec 24, 2024

    nodejs-core reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Neel Verma· Dec 24, 2024

    Keeps context tight: nodejs-core is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Mei Abebe· Dec 20, 2024

    We added nodejs-core from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Diya Rao· Dec 12, 2024

    nodejs-core is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Neel White· Nov 19, 2024

    I recommend nodejs-core for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Neel Thomas· Nov 19, 2024

    nodejs-core is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Yash Thakker· Nov 15, 2024

    Useful defaults in nodejs-core — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

showing 1-10 of 61

1 / 7