nodejs-expert

Diagnose and fix Node.js async, module, memory, and HTTP server issues.

3|Updated Jan 15, 2026
One-click install
npx skills add https://github.com/trudyan141/my-antigravity-agents-kit --skill nodejs-expert-trudyan141
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nodejs-expert
Source: https://github.com/trudyan141/my-antigravity-agents-kit/tree/main/templates/.agent/skills/nodejs-expert
Command: npx skills add https://github.com/trudyan141/my-antigravity-agents-kit --skill nodejs-expert-trudyan141

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Node.js applications frequently fail with cryptic runtime errors like unhandled promise rejections, ESM/CommonJS conflicts, memory leaks, and event loop blocking. This Skill provides structured playbooks and diagnostic commands to identify and resolve these issues quickly. ## Core Features & Use Cases - Async & Promise Debugging: Fix unhandled rejections, use Promise.allSettled for batch operations, and trace warnings with Node.js flags. - Module System Resolution: Resolve ESM vs CommonJS conflicts using package.json configuration and dynamic imports. - Performance & Memory Diagnostics: Profile with --prof and --inspect, monitor heap usage, and handle streams with proper backpressure. - Use Case: Your Express server crashes in production with "JavaScript heap out of memory". Use this Skill to run memory diagnostics, identify the leak from missing listener cleanup, and apply the fix with graceful shutdown handlers. ## Quick Start Ask the AI to diagnose why your Node.js server is throwing unhandled promise rejection errors and suggest a fix.

Frequently Asked Questions about nodejs-expert

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

FAQPage Schema
How do I fix unhandled promise rejection errors in Node.js?

Unhandled promise rejections are fixed by wrapping await calls in try/catch blocks or attaching .catch() handlers to every promise. Run node with --unhandled-rejections=strict to surface failures early, and use Promise.allSettled instead of Promise.all for batch operations.

How to resolve 'Cannot use import statement outside a module' error?

This error occurs when ESM syntax runs in a CommonJS context. Set "type": "module" in package.json to enable ESM, or use dynamic import() to load ES modules from CommonJS code.

Why does Node.js run out of memory and how do I fix it?

Heap exhaustion usually comes from memory leaks like unremoved event listeners or uncleared timers. Diagnose with node --inspect or --prof, monitor process.memoryUsage(), and temporarily raise the limit with --max-old-space-size=4096.

Does Node.js stream pipeline handle backpressure automatically?

Yes, the pipeline function from stream/promises manages backpressure between readable, transform, and writable streams automatically. It also propagates errors and cleans up streams, making it safer than manual pipe() chaining.

How do I implement graceful shutdown in a Node.js server?

Register handlers for SIGTERM and SIGINT signals that close the HTTP server and release resources before calling process.exit(0). This prevents dropped connections during deployments and container stops.