Deep Node.js internals expertise including C++ addons, V8, libuv, and build systems
Use this skill when you need deep Node.js internals expertise, including:
nodejs/node commits and pull request descriptionsRead individual rule files for detailed explanations and code examples:
lib/internal/)core-validate-commit gate for every commit so CI passes first time./configure flags for debug builds, ASan, Ninja, etc.When drafting a nodejs/node commit or pull request, read
rules/commit-and-pr-guideline.md.
Use terse subsystem-prefixed titles and plain, matter-of-fact prose. Lead with
concrete behavior, explain the reason for the change, and omit hype, canned
headings, file-by-file narration, and unsupported claims. Include the
contributor's DCO sign-off, and never add PR-URL: or Reviewed-By: — those
are added when the change lands. Validate the result with
npx core-validate-commit --no-validate-metadata <sha> in the nodejs/node
checkout.
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.
Node.js runs a Linters CI workflow on every non-draft pull request, and on
Unix make test runs no linters. Run make lint before each git commit — plus make format-cpp for C++ changes — so the lint jobs pass on
the first CI run instead of costing a force-push and another full cycle.
make -j$(nproc) # rebuild first
make lint # JS, C++, MD, docs, YAML
# C++ changes only — use the merge-base form, which is what CI checks:
CLANG_FORMAT_START="$(git merge-base HEAD upstream/main)" make format-cpp
git --no-pager diff --exit-code # must be empty
git add -A && git commit -s # -s is mandatory
npx core-validate-commit --no-validate-metadata HEAD
Never skip a step because the change looks trivial, and never commit with "will fix lint in a follow-up".
Bare make format-cpp is not enough. It defaults to
CLANG_FORMAT_START=HEAD and formats only staged changes, while the
format-cpp CI job formats everything from the merge base and fails on any
resulting diff — so unformatted code committed earlier in the branch passes
locally and fails in CI. Always pass the merge-base form shown above.
Every commit must be created with git commit -s. The -s flag adds the
Signed-off-by: trailer certifying the Developer Certificate of Origin.
Without it the signed-off-by rule of core-validate-commit fails and the PR
cannot land. The sign-off must be the human contributor's name and email —
never sign off with a tool or AI identity, and never fabricate someone else's.
If you forget it, amend with git commit --amend --signoff.
make lint runs lint-js, lint-cpp, lint-addon-docs, lint-md, and
lint-yaml — it does not cover every CI lint job. Python (make lint-py),
shell (tools/lint-sh.mjs .), C++ formatting, and commit-message validation
are separate jobs. See rules/pre-commit-lint.md
for the full gate and the CI-job-to-command mapping.
Validate every commit message with core-validate-commit, always with
--no-validate-metadata — metadata validation is on by default and enforces
trailers that only exist after landing. Never add PR-URL: or
Reviewed-By: to a commit you author; the landing process adds them.
See rules/build-and-test-workflow.md for the full workflow including configure flags, lint targets, and test commands.
Apply deep knowledge of Node.js internals across these domains:
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
Segfault / crash in native addon:
node --napi-modules? → Run gdb, capture btbt point to a V8 handle scope issue? → Check HandleScope / EscapableHandleScope usage in the addonuv_close() sequencingV8 deoptimization / performance regression:
--trace-opt --trace-deopt → identify the deoptimized function and reason (e.g., "not a Smi", "wrong map")--trace-ic) and fix property addition order or type inconsistencies--trace-opt to confirm the function is now optimizedBuild failure (node-gyp / binding.gyp):
include_dirs in binding.gyp and Node.js header installationlibraries and link_settings entries; confirm ABI compatibilityrules/build-system.md for Windows/macOS/Linux differencesAlways 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.