Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add aj-geddes/useful-ai-prompts --skill graceful-shutdowngit clone --depth 1 https://github.com/aj-geddes/useful-ai-promptsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/aj-geddes/useful-ai-prompts/graceful-shutdown)<a href="https://agentmods.dev/skills/aj-geddes/useful-ai-prompts/graceful-shutdown"><img src="https://agentmods.dev/badge/skills/aj-geddes/useful-ai-prompts/graceful-shutdown/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/aj-geddes/useful-ai-prompts/graceful-shutdown"><img src="https://agentmods.dev/badge/skills/aj-geddes/useful-ai-prompts/graceful-shutdown.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- Socket pass
- Snyk pass
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00050 | $0.00678 |
| Opus 5.5 | $0.00020 | $0.00271 |
| Sonnet 5.5 | $0.00010 | $0.00136 |
| Haiku 4.5 | $0.00005 | $0.00068 |
Grade A, and why
graceful-shutdown scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 104 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Graceful Shutdown
Table of Contents
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:
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)
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 |
What ships with it
8 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- references/database-connection-pool-shutdown.md 1.2 KB
- references/expressjs-graceful-shutdown.md 5.4 KB
- references/kubernetes-aware-shutdown.md 1.2 KB
- references/pm2-graceful-shutdown.md 1.3 KB
- references/pythonflask-graceful-shutdown.md 1.8 KB
- references/worker-process-shutdown.md 1.9 KB
- scripts/validate-config.sh 427 B runs code
- templates/config-starter.yaml 453 B
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 104 lines · 50 tokens per session scan A 543976e2d64b
graceful-shutdown is a skill published in the GitHub repository aj-geddes/useful-ai-prompts (376 stars, last pushed 8mo ago), licensed MIT. It adds 50 tokens to every session and 678 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
graceful-shutdown compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| graceful-shutdownaj-geddes/useful-ai-prompts | Skill | 376 | 8mo ago | MIT | A | 50 | Claude Code, Codex |
| deploy-docker-composeomnigent-ai/omnigent | Skill | 11k | yesterday | Apache-2.0 | A | 84 | Claude Code, Codex |
| bdd-container-updateNVIDIA-AI-Blueprints/video-search-and-summarization | Skill | 2.0k | yesterday | Apache-2.0 | A | 117 | Cursor |
| securing-kubernetes-on-cloudxalgorix/xalgorix | Skill | 1.3k | yesterday | Apache-2.0 | A | 80 | Claude Code, Codex |
| detecting-privilege-escalation-in-kubernetes-podsxalgorix/xalgorix | Skill | 1.3k | yesterday | Apache-2.0 | A | 40 | Claude Code, Codex |
| docker-socket-mountPurpleAILAB/Decepticon | Skill | 6.5k | 8d ago | Apache-2.0 | B | 67 | Claude Code |
| k8s-networkingrohitg00/kubectl-mcp-server | Skill | 968 | 15d ago | MIT | A | 34 | Claude Code, Codex |