nodejs-core by mcollina/skills
npx skills add https://github.com/mcollina/skills --skill nodejs-core当您需要深入的 Node.js 内部原理专业知识时,请使用此技能,包括:
阅读各个规则文件以获取详细解释和代码示例:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
lib/internal/ 必需)./configure 标志Node.js 在编译时通过 js2c 将 lib/ 中的 JavaScript 文件嵌入到二进制文件中。在对 src/ 或 lib/ 进行任何更改后,您必须在运行测试前重新构建。 如果不重新构建,测试将针对过时的代码运行,结果毫无意义。
edit src/ or lib/ → make -j$(nproc) → make lint → then test
切勿跳过重新构建步骤。切勿在编辑后未先构建的情况下运行 ./node test/...。
开始工作前,询问用户他们的构建配置(Make 与 Ninja、调试版与发布版、他们使用的配置标志)。不要假设特定的设置。大多数情况下,./configure 已经运行过,只需要 make -j$(nproc) 来重新构建。
有关完整工作流程(包括配置标志、检查目标和测试命令),请参阅 rules/build-and-test-workflow.md。
在这些领域中应用 Node.js 内部原理的深入知识:
V8 优化追踪:
node --trace-opt --trace-deopt script.js
# 检查点:在继续进行分析之前,确认没有意外的去优化警告
node --prof script.js && node --prof-process isolate-*.log > processed.txt
事件循环延迟检测:
node --trace-event-categories v8,node,node.async_hooks script.js
原生插件调试(gdb):
gdb --args node --napi-modules ./build/Release/addon.node
# 在 gdb 内部:
run
bt # 崩溃时的回溯
# 检查点:在应用修复之前,验证回溯显示预期的调用点
用于内存泄漏的堆快照:
node --inspect script.js # 然后打开 chrome://inspect,获取堆快照
# 检查点:比较两个连续的堆快照,以确认修复前后的泄漏增长;运行 valgrind --leak-check=full node addon_test.js 以确认没有剩余的原生泄漏
原生插件中的段错误 / 崩溃:
node --napi-modules 是否可以重现崩溃? → 运行 gdb,捕获 btbt 是否指向 V8 句柄作用域问题? → 检查插件中 HandleScope / EscapableHandleScope 的使用uv_close() 调用顺序V8 去优化 / 性能回归:
--trace-opt --trace-deopt → 识别被去优化的函数和原因(例如,“not a Smi”、“wrong map”)--trace-ic)并修复属性添加顺序或类型不一致--trace-opt 以确认函数现在已优化构建失败(node-gyp / binding.gyp):
binding.gyp 中的 include_dirs 和 Node.js 头文件安装libraries 和 link_settings 条目;确认 ABI 兼容性rules/build-system.md 了解 Windows/macOS/Linux 的差异始终考虑 JavaScript 级别和原生级别的原因,解释性能影响和权衡,并指出所讨论的任何实验性功能的稳定性状态。代码示例应展示 Node.js 内部原理模式,并考虑到典型开发人员可能忽略的边缘情况,做到生产就绪。
每周安装量
368
代码仓库
GitHub 星标数
1.5K
首次出现
Jan 31, 2026
安全审计
安装于
codex349
github-copilot348
cursor347
opencode344
gemini-cli344
amp342
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 tosrc/ 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.
Weekly Installs
368
Repository
GitHub Stars
1.5K
First Seen
Jan 31, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex349
github-copilot348
cursor347
opencode344
gemini-cli344
amp342
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
106,200 周安装