首页/后端开发/nodejs-core
N

nodejs-core

by @mcollinav1.0.0
0.0(0)

Debugs native module crashes, optimizes V8 performance, configures node-gyp builds, writes N-API/node-addon-api bindings, and diagnoses libuv event loop issues in Node.js. Use when working with C++ addons, native modules, binding.gyp, node-gyp errors, segfaults, memory leaks in native code, V8 optim

Node.jsJavaScript BackendEvent LoopAsynchronous ProgrammingNPMGitHub
安装方式
npx skills add mcollina/skills --skill nodejs-core
compare_arrows

Before / After 效果对比

0

description 文档


name: nodejs-core description: Debugs native module crashes, optimizes V8 performance, configures node-gyp builds, writes N-API/node-addon-api bindings, and diagnoses libuv event loop issues in Node.js. Use when working with C++ addons, native modules, binding.gyp, node-gyp errors, segfaults, memory leaks in native code, V8 optimization/deoptimization, libuv thread pool tuning, N-API or NAN bindings, build system failures, or any Node.js internals below the JavaScript layer. metadata: tags: nodejs, v8, libuv, cpp, native-addons, performance, debugging, internals

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

Build & Contributing

Debugging & Profiling

Instructions

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.

forum用户评价 (0)

发表评价

效果
易用性
文档
兼容性

暂无评价,来写第一条吧

统计数据

安装量0
评分0.0 / 5.0
版本1.0.0
更新日期2026年3月16日
对比案例0 组

用户评分

0.0(0)
5
0%
4
0%
3
0%
2
0%
1
0%

为此 Skill 评分

0.0

兼容平台

🔧Claude Code

时间线

创建2026年3月16日
最后更新2026年3月16日