runtime-nodejs

Installation
SKILL.md

Node.js Conventions

Module System

  • Prefer ESM (import/export) — set "type": "module" in package.json
  • Use import.meta.url and import.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/await over callbacks — use promise-based APIs (fs/promises, timers/promises)
  • Always handle rejections — every await in try/catch or .catch() on the promise; never let promises reject silently
  • Promise.all for concurrent work — run independent async operations in parallel, not sequentially
  • Promise.allSettled when 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 with await is fine
  • Convert callback APIs — use util.promisify to wrap callback-only packages into promises

Error Handling

Installs
1
Repository
noih/dev-skills
First Seen
Apr 29, 2026