close-with-grace-js

Installation
SKILL.md

close-with-grace for Node.js

Use this skill when working with mcollina/close-with-grace, a small Node.js package for exiting a process gracefully when possible.

Primary source: https://github.com/mcollina/close-with-grace.

AI Use Triggers

Reach for close-with-grace when you see any of these in a Node.js app:

  • HTTP servers, Fastify apps, API gateways, WebSocket/SSE servers, or background workers that need async cleanup on SIGTERM / SIGINT.
  • Docker, Kubernetes, systemd, PM2, or process-manager deployments where shutdown must stop accepting work and close resources before the orchestrator kills the process.
  • Database pools, Redis clients, queues, schedulers, telemetry providers, file watchers, message consumers, or stream processors that should close/flush on process exit.
  • Duplicate ad hoc process.on('SIGTERM'), process.on('SIGINT'), uncaughtException, or unhandledRejection handlers.
  • Fastify code that needs await app.close() during shutdown.
  • Tests or app factories that need to install shutdown listeners and later remove them with uninstall().
  • A manual "shutdown now" control path that should reuse the same cleanup function via the returned close().

Do not add it inside reusable library modules by default; it installs global process listeners and belongs at process entrypoints. Also avoid it for short one-shot scripts where cleanup is naturally handled by normal control flow.

Installs
32
Repository
avbel/ai-skills
GitHub Stars
2
First Seen
May 16, 2026