ab-test-analysis
Design and analyze A/B tests, calculate statistical significance, and determine sample sizes…
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.
$ npx -y skills add aj-geddes/useful-ai-prompts --skill graceful-shutdown --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/graceful-shutdownContext preview
The summary Claude sees to decide when to auto-load this skill.
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.
name: graceful-shutdown description: > 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.
Implement proper shutdown procedures to ensure all requests are completed, connections are closed, and resources are released before process termination.
Minimal working example:
import express from "express";
import http from "http";
class GracefulShutdownServer {
private app: express.Application;
private server: http.Server;
private isShuttingDown = false;
private activeConnections = new Set<any>();
private shutdownTimeout = 30000; // 30 seconds
constructor() {
this.app = express();
this.server = http.createServer(this.app);
this.setupMiddleware();
this.setupRoutes();
this.setupShutdownHandlers();
}
private setupMiddleware(): void {
// Track active connections
this.app.use((req, res, next) => {
if (this.isShuttingDown) {
res.set("Connection", "close");
return res.status(503).json({
error: "Server is shutting down",
// ... (see reference guides for full implementation)Detailed implementations in the `references/` directory:
| Guide | Contents | |---|---| | [Express.js Graceful Shutdown](references/expressjs-graceful-shutdown.md) | Express.js Graceful Shutdown | | [Kubernetes-Aware Shutdown](references/kubernetes-aware-shutdown.md) | Kubernetes-Aware Shutdown | | [Worker Process Shutdown](references/worker-process-shutdown.md) | Worker Process Shutdown | | [Database Connection Pool Shutdown](references/database-connection-pool-shutdown.md) | Database Connection Pool Shutdown | | [PM2 Graceful Shutdown](references/pm2-graceful-shutdown.md) | PM2 Graceful Shutdown | | [Python/Flask Graceful Shutdown](references/pythonflask-graceful-shutdown.md) | Python/Flask Graceful Shutdown |
488 production-ready AI prompts, all following a standardized template with validated quality gates. Transform ChatGPT, Claude, and other AI assistants into expert consultants.
Repo: aj-geddes/useful-ai-prompts
Design and analyze A/B tests, calculate statistical significance, and determine sample sizes…
Implement Role-Based Access Control (RBAC), permissions management, and authorization…
Implement WCAG 2.1/2.2 accessibility standards, screen reader compatibility, keyboard…
Test web applications for WCAG compliance and ensure usability for users with disabilities.…
Plan and execute effective sprints using Agile methodologies. Define sprint goals, estimate…
Implement comprehensive alert management with PagerDuty, escalation policies, and incident…