跳至主要内容
小龙虾小龙虾AI
🤖

NodeJS

Avoid common Node.js mistakes — event loop blocking, async error handling, ESM gotchas, and memory leaks.

下载1.2k
星标2
版本1.0.1
开发工具
安全通过
💬Prompt

技能说明


name: NodeJS slug: nodejs version: 1.0.1 description: Write reliable Node.js avoiding event loop blocking, async pitfalls, ESM gotchas, and memory leaks. metadata: {"clawdbot":{"emoji":"💚","requires":{"bins":["node"]},"os":["linux","darwin","win32"]}}

Quick Reference

TopicFile
Callbacks, Promises, async/await, event loopasync.md
CommonJS vs ESM, require vs importmodules.md
Error handling, uncaught exceptionserrors.md
Readable, Writable, Transform, backpressurestreams.md
Memory leaks, event loop blocking, profilingperformance.md
Input validation, dependencies, env varssecurity.md
Jest, Mocha, mocking, integration teststesting.md
npm, package.json, lockfiles, publishingpackages.md

Critical Traps

  • fs.readFileSync blocks entire server — use fs.promises.readFile
  • Unhandled rejection crashes Node 15+ — always .catch() or try/catch
  • process.env values are strings — "3000" not 3000, parseInt needed
  • JSON.parse throws on invalid — wrap in try/catch
  • require() cached — same object, mutations visible everywhere
  • Circular deps return incomplete export — restructure to avoid
  • Event listeners accumulate — removeListener or once()
  • async always returns Promise — even for plain return
  • pipeline() over .pipe() — handles errors and cleanup
  • No __dirname in ESM — use fileURLToPath(import.meta.url)
  • Buffer.from(string) — encoding matters, default UTF-8

如何使用「NodeJS」?

  1. 打开小龙虾AI(Web 或 iOS App)
  2. 点击上方「立即使用」按钮,或在对话框中输入任务描述
  3. 小龙虾AI 会自动匹配并调用「NodeJS」技能完成任务
  4. 结果即时呈现,支持继续对话优化

相关技能