agentleFS
leroyguillaumeleroyguillaume/skills/signal-handling-conventions/SKILL.md

signal-handling-conventions

Skill7 starsChanged 5 days agoMITView on GitHub

Signals and graceful shutdown for long-running processes. TRIGGER when: writing or editing the `main` of a long-running process, an HTTP or RPC server, a worker, a queue consumer or a daemon loop; wiring shutdown, signal handlers or drain logic; user asks about SIGTERM, SIGINT or graceful shutdown. SKIP when: a short-lived one-shot (CLI, library, script).

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

Signal handling and graceful shutdown

Applies to every long-running process (servers, workers, daemons) in any language or runtime. The language skills (rust-conventions, python-conventions) give the mechanics: which signal API, and how to wire shutdown to it.

  • Handle both SIGTERM and SIGINT and shut down gracefully on either. SIGTERM is what an orchestrator (Docker, Kubernetes, systemd, a process manager) sends to stop a process; SIGINT is Ctrl-C in a terminal. A process that ignores SIGTERM is killed with SIGKILL after the grace period (Docker's default is 10s), losing in-flight work.
  • SIGKILL (and SIGSTOP) cannot be caught — do not try. The whole point of handling SIGTERM is to finish cleanly before the orchestrator escalates to SIGKILL.
  • A graceful shutdown stops accepting new work (close listeners, stop pulling from the queue) and lets in-flight work drain within the grace period, then exits 0. Release external resources (connections, locks, temp files) on the way out.
  • For pull-based workers, make interruption safe rather than relying on a clean drain: the unit of work should be idempotent / re-runnable so that a process killed mid-task is simply retried (e.g. a job left "processing" is requeued by a reaper). Cooperative shutdown then reduces wasted work; it is not the only thing standing between you and corruption.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.