← ClaudeAtlas

node-opslisted

Production Node.js operations advisor. Always use this skill when deploying or operating Node.js applications, handling graceful shutdown, SIGTERM, clustering, memory leaks, health checks, readiness probes, uncaught exceptions, or process management. Use when the user asks "how do I handle SIGTERM in Node.js", "graceful shutdown in Express", "how do I add health checks or readiness probes", "my Node app crashes and restarts", "uncaught exception handler", "should I use cluster mode", or "Node.js kubernetes". Read this before advising on any Node.js production or deployment topic.
AllThingsSmitty/agent-skills · ★ 1 · Code & Development · score 74
Install: claude install-skill AllThingsSmitty/agent-skills
# Production Node.js Operations A Node.js app that works in development often has silent operational problems in production: it crashes on uncaught errors, drops in-flight requests during deploys, leaks memory over time, or gives load balancers no way to know it's ready. These are all fixable — and they should be addressed before the first production deploy, not after the first incident. ## Graceful shutdown When a container or process manager sends `SIGTERM`, the app has a window to finish what it's doing before it's killed. If you don't handle it, the process exits immediately and drops every in-flight request. ```ts const server = app.listen(3000); process.on('SIGTERM', () => { server.close(() => { // connections drained — exit cleanly process.exit(0); }); // Safety valve: force exit if drain takes too long setTimeout(() => process.exit(1), 10_000).unref(); }); ``` `server.close()` stops accepting new connections and waits for existing ones to finish. The timeout prevents the app from hanging indefinitely if a connection never closes (e.g., a long-polling client). For database connections, message consumers, or other resources: close them in the `SIGTERM` handler too, after the HTTP server has stopped accepting work. ## Handle uncaught exceptions and unhandled rejections An uncaught exception or unhandled rejection leaves the process in an indeterminate state. The safest response is to log the error and exit �� let the process manager restart you.