shell-process-patterns

Installation
SKILL.md

Shell Process Patterns

Start, supervise, and terminate shell processes safely -- background jobs, subshells, signal handlers, and cleanup. The dominant failure mode in this domain is silent state: a process that looks killed but still holds a port, a trap that looked fine but never fired on the child, a set -e script that kept running because || true swallowed the error. This skill picks the right pattern, implements it with the real PID (not the wrapper), and verifies the observable state afterward.

Pattern Use When Key Safety Bound
Background start Ad-hoc long-running child in a script or session Redirect fd 0/1/2, capture real PID, disown if parent exits
Daemonization Process must survive terminal close, become session leader setsid + fd redirect + write PID file atomically
PID resolution Need to kill / inspect the actual worker Re-query with ss/pgrep/lsof; $! is advisory, not authoritative
Signal discipline Graceful shutdown of a supervisor + children SIGTERM first with timeout, SIGKILL as last resort, propagate to process group
Trap + cleanup Script must leave no orphans, lock files, or temp dirs trap ... EXIT + verification (file gone, port free, PID dead)
Strict-mode scripts Any non-trivial bash script set -euo pipefail with understood `

Scope

Installs
7
GitHub Stars
416
First Seen
Apr 30, 2026
shell-process-patterns — notque/vexjoy-agent