runtime-nodejs
Installation
SKILL.md
Node.js Conventions
Module System
- Prefer ESM (
import/export) — set"type": "module"inpackage.json - Use
import.meta.urlandimport.meta.dirname(Node 21.2+) instead of__dirname/__filename - For CJS interop, use
createRequire(import.meta.url)when importing CJS-only packages - Follow project convention — if the project uses CJS, stay consistent
Async Patterns
async/awaitover callbacks — use promise-based APIs (fs/promises,timers/promises)- Always handle rejections — every
awaitin try/catch or.catch()on the promise; never let promises reject silently Promise.allfor concurrent work — run independent async operations in parallel, not sequentiallyPromise.allSettledwhen all results are needed regardless of individual failures- Don't mix async paradigms — don't mix callbacks with promises/async-await in the same flow. Using
.catch()for inline error transformation withawaitis fine - Convert callback APIs — use
util.promisifyto wrap callback-only packages into promises