Agent skill · software engineering · aj-geddes
graceful-shutdown
Implement graceful shutdown procedures to handle SIGTERM signals, drain connections, complete in-flight requests, and clean up resources properly. Use when deploying containerized applications, handling server restarts, or ensuring zero-downtime deployments.
Why this skill is useful
Provides specific implementation patterns for graceful shutdown in containerized applications that the AI wouldn't reliably generate on its own.
What it needs
Requires express installed locally. About 1k tokens when loaded. Last updated 2026-03-04. 307 stars on the source repository.
What this skill does
Graceful Shutdown Table of Contents Overview When to Use Quick Start Reference Guides Best Practices Overview Implement proper shutdown procedures to ensure all requests are completed, connections are closed, and resources are released before process termination. When to Use Kubernetes/Docker deployments Rolling updates and deployments Server restarts Load balancer drain periods Zero-downtime deployments Process managers (PM2, systemd) Long-running background jobs Database connection cleanup Quick Start Minimal working example: Reference Guides Detailed implementations in the references/ directory: Guide Contents --- --- Express.js Graceful Shutdown Express.js Graceful Shutdown Kubernetes-Aware Shutdown Kubernetes-Aware Shutdown Worker Process Shutdown Worker Process Shutdown Database Connection Pool Shutdown Database Connection Pool Shutdown PM2 Graceful Shutdown PM2 Graceful Shutdown Python/Flask Graceful Shutdown Python/Flask Graceful Shutdown Best Practices ✅ DO Handle SIGTERM and SIGINT signals Stop accepting new requests immediately Wait for in-flight requests to complete Set reasonable shutdown timeouts Close database connections properly Flush logs and metrics Fail health checks during shutdown Test shutdown procedures Log shutdown progress Use graceful shutdown in containers ❌ DON'T Ignore shutdown signals Force kill processes without cleanup Set unreasonably long timeouts Skip resource cleanup Forget to close connections Block shutdown indefinitely
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aj-geddes/graceful-shutdown