Nodejs

Use when: write or review Node.js backends with correct async, error handling, and resource limits.

kimtth 1adc6eb 1.0 KB Updated

File contents

Goal: reliable Node.js services that handle async and failure well.

Use for:

  • HTTP services, workers, or CLI tools on Node
  • reviewing async flow, error handling, and config
  • fixing unhandled rejections and blocking code

Workflow:

  1. Use async/await; never mix with unhandled callbacks.
  2. Handle promise rejections and process-level error events.
  3. Keep the event loop unblocked; offload CPU-heavy work.
  4. Load config and secrets from the environment, validated.
  5. Stream large payloads instead of buffering them whole.
  6. Verify with tests and a linter; check for leaks under load.

Patterns:

  • async/await with try/catch at boundaries
  • AbortController for cancellation and timeouts
  • streams for large data
  • graceful shutdown on SIGTERM

Rules:

  • never leave a promise rejection unhandled
  • do not block the event loop with sync CPU work
  • validate environment config at startup
  • set timeouts on outbound calls

kimtth/agent-skill-100-lines-or-less/tree/main/skills/nodejs commit 1adc6eb207

Frequently asked questions

npx skillmds@latest add kimtth/nodejs