daemon-development

Manage long-running background process lifecycles across macOS, Linux, and Windows.

2|Updated Feb 11, 2026
One-click install
npx skills add https://github.com/curiositech/port-daddy --skill daemon-development
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: daemon-development
Source: https://github.com/curiositech/port-daddy/tree/main/skills/daemon-development
Command: npx skills add https://github.com/curiositech/port-daddy --skill daemon-development

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Build and operate long-running background processes that start on boot, stay healthy, recover from crashes, and shut down gracefully across macOS, Linux, and Windows. This Skill addresses lifecycle management, process supervision, restart policies, logging and health endpoints, signal handling, and AI-specific concerns such as token-based LLM rate limiting and provider failover.

Core Features & Use Cases

  • Cross-platform init guidance: When to use launchd vs systemd vs Windows services and how to place unit/plist files correctly.
  • Resilience and restart policies: Recommendations for Restart, RestartSec, KeepAlive, throttling, and handling restart loops and zombie processes.
  • Graceful shutdown and state persistence: Signal handling patterns, draining in-flight work, checkpointing rate-limit state, and safe resource cleanup.
  • AI daemon patterns: Token-bucket rate limiting, per-provider circuit breakers, streaming handling, batching strategies, and saving token state on shutdown.
  • Use Case: Run an AI inference daemon that persists token-bucket state, gracefully drains in-flight LLM requests on SIGTERM, fails over to secondary providers on 5xx, and avoids restart-thrashing in production.

Quick Start

Create a systemd unit with Type=notify and Restart=on-failure, implement a token-bucket per LLM provider with persistent state on disk, and add a SIGTERM handler that stops accepting new requests, drains in-flight work, flushes rate-limit state, and exits.

Frequently Asked Questions about daemon-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle graceful shutdown for a background service receiving SIGTERM?

Graceful shutdown for a background service involves implementing a SIGTERM handler that stops accepting new requests, drains in-flight work, flushes rate-limit state to disk, and exits safely.

How do I configure a systemd unit file to prevent restart loops for a daemon?

To prevent restart loops in a systemd unit file, configure restart policies using Restart, RestartSec, and KeepAlive directives to add throttling delays between failures and manage zombie processes.

Can I persist token-bucket rate limiting state across restarts for an LLM daemon?

Yes, you can persist token-bucket rate limiting state for an LLM daemon by checkpointing the rate-limit state to disk during graceful shutdown and reloading it when the process restarts.

What is the best way to manage long-running daemons across macOS, Linux, and Windows?

The best way to manage cross-platform daemons is to target platform-specific init systems—launchd for macOS, systemd for Linux, and Windows services—using correct unit and plist file placements.

Why does my AI inference daemon need a circuit breaker for LLM provider failover?

An AI inference daemon needs per-provider circuit breakers to automatically fail over to secondary LLM providers on 5xx errors, preventing cascading failures and avoiding restart-thrashing in production.

How do I drain in-flight LLM requests during a daemon shutdown?

To drain in-flight LLM requests during daemon shutdown, implement signal handling that stops accepting new connections, waits for active streaming requests to complete, and then flushes state before exiting.