nodejs-development

Guides Node.js runtime patterns for event loop, streams, worker threads, and production deployment.

Updated Jul 29, 2026
One-click install
npx skills add https://github.com/MaiconGambini/opencode-harness-guide --skill nodejs-development-maicongambini
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nodejs-development
Source: https://github.com/MaiconGambini/opencode-harness-guide/tree/main/skills/nodejs-development
Command: npx skills add https://github.com/MaiconGambini/opencode-harness-guide --skill nodejs-development-maicongambini

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building production-grade Node.js services requires deep understanding of the runtime—event loop behavior, async patterns, error handling, and security. This Skill provides structured guidance on Node.js internals so you avoid common pitfalls like blocking the event loop, unhandled rejections, and memory leaks. ## Core Features & Use Cases - Runtime Mastery: Covers event loop phases, async/await hierarchy, Promise composition, and concurrency control patterns. - Production Hardening: Includes graceful shutdown, structured logging with pino, health/readiness endpoints, environment validation with Zod, and security headers with helmet. - Performance & Scaling: Guidance on streams with pipeline(), worker threads for CPU-bound tasks, cluster mode, and profiling tools like clinic.js and 0x. - Use Case: When debugging high latency in an Express API, use this Skill to identify event loop blocking, offload CPU work to worker threads, and add proper error handling and observability. ## Quick Start Ask the AI to review your Node.js service for event loop blocking, error handling gaps, and production readiness using the nodejs-development guidelines.

Frequently Asked Questions about nodejs-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent blocking the Node.js event loop?

Avoid synchronous I/O in request handlers and offload CPU-intensive work over 50ms to worker threads. Use async/await for all I/O, prefer setImmediate over setTimeout(fn, 0), and monitor event loop lag with clinic.js or --prof.

When should I use worker threads vs streams in Node.js?

Use worker threads for CPU-bound tasks like hashing, compression, or large JSON parsing. Use streams for I/O-bound work like processing large files or proxying data, where backpressure and memory efficiency matter.

Should I use ESM or CommonJS for a new Node.js project?

Use ESM for new projects by setting "type": "module" in package.json. ESM supports top-level await and better tree-shaking. Never mix require() and import in the same file; migrate existing CommonJS projects incrementally.

How do I handle errors in Node.js production applications?

Distinguish operational errors (validation, timeouts) from programmer errors (bugs). Always catch async errors since unhandled rejections crash Node 16+, use custom error classes, log with context, and crash on programmer errors with a restart.

Why does my Node.js app have high memory usage under load?

Common causes include unbounded global caches, event listener leaks, and closure leaks in handlers. Use LRU caches, track and remove listeners, monitor with process.memoryUsage(), and tune --max-old-space-size.

What is the correct way to shut down a Node.js server gracefully?

Listen for SIGTERM and SIGINT, stop accepting new requests with server.close(), finish in-flight requests with a timeout, close database connections, flush logs, then exit. This prevents dropped requests during deployments.