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:
Read individual rule files for detailed explanations and code examples:
lib/internal/)./configure flags for debug builds, ASan, Ninja, etc.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.
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.