🤖
NodeJS
Avoid common Node.js mistakes — event loop blocking, async error handling, ESM gotchas, and memory leaks.
安全通过
💬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
| Topic | File |
|---|---|
| Callbacks, Promises, async/await, event loop | async.md |
| CommonJS vs ESM, require vs import | modules.md |
| Error handling, uncaught exceptions | errors.md |
| Readable, Writable, Transform, backpressure | streams.md |
| Memory leaks, event loop blocking, profiling | performance.md |
| Input validation, dependencies, env vars | security.md |
| Jest, Mocha, mocking, integration tests | testing.md |
| npm, package.json, lockfiles, publishing | packages.md |
Critical Traps
fs.readFileSyncblocks entire server — usefs.promises.readFile- Unhandled rejection crashes Node 15+ — always
.catch()or try/catch process.envvalues are strings —"3000"not3000, parseInt neededJSON.parsethrows on invalid — wrap in try/catchrequire()cached — same object, mutations visible everywhere- Circular deps return incomplete export — restructure to avoid
- Event listeners accumulate —
removeListeneroronce() asyncalways returns Promise — even for plain returnpipeline()over.pipe()— handles errors and cleanup- No
__dirnamein ESM — usefileURLToPath(import.meta.url) Buffer.from(string)— encoding matters, default UTF-8
如何使用「NodeJS」?
- 打开小龙虾AI(Web 或 iOS App)
- 点击上方「立即使用」按钮,或在对话框中输入任务描述
- 小龙虾AI 会自动匹配并调用「NodeJS」技能完成任务
- 结果即时呈现,支持继续对话优化