- Home
- Skills
- DevOps & Cloud
- Deletion Safety Gate — Fail-Closed Check Before rm -rf
Deletion Safety Gate — Fail-Closed Check Before rm -rf
A fully pushed checkout can still be the working directory an hourly job launches from.
$5
Works with the AI Agents you already use
Deletion Safety Gate — Fail-Closed Check Before rm -rf
Example session with this skill installed
My disk is almost full. Before deleting these old worktrees, run deletion-safety-gate on each path and only delete the ones it reports SAFE:
~/code/worktrees/checkout-redesign
~/code/worktrees/nightly-report
~/code/worktrees/old-spike
- Read your context and instructions
- Compiled the deletion safety gate
deletion-safety-gate — 3 candidates, checked one at a time (read-only)
-
~/code/worktrees/checkout-redesign
spellings: $HOME/code/worktrees/checkout-redesign | ~/code/worktrees/checkout-redesign | /worktrees/checkout-redesign
loaded jobs: 0 | job files: 0 | crontab: 0 | config/scripts: 0 | processes: 0 | shared git store: not a hub
→ SAFE (git clean, 0 unpushed, recovery ref saved: refs/archive/checkout-redesign) -
~/code/worktrees/nightly-report
loaded jobs: 1 HIT — com.dev.nightly-report (WorkingDirectory=/worktrees/nightly-report, matched bare spelling)
job files: 1 HIT — ~/Library/LaunchAgents/com.dev.nightly-report.plist.bak
config/scripts: 1 HIT — ~/bin/run-report.sh:4
→ REFUSE (referenced by a live scheduled job; git status was clean, which is exactly why this check exists) -
~/code/worktrees/old-spike
config/scripts: could not read ~/.config/tooling/state.db (permission denied)
→ REFUSE (screen incomplete — fail closed)
Deleted: 1 (checkout-redesign). Kept: 2.
Next steps: retarget or unload com.dev.nightly-report before deleting #2; fix read access and re-run for #3.
Not screened: open file descriptors, remote CI definitions, paths built at runtime.
Connects securely to your tools. The creator never sees your data.
About this skill
What it does
Clean git history proves a folder's history is safe to lose — not that nothing still uses the path. A fully pushed checkout can still be the working directory an hourly job launches from. Deletion Safety Gate makes your coding agent prove a path is unreferenced before it deletes it.
It searches every place a path can be referenced, in three spellings (absolute, ~/-relative, and bare /<parent>/<basename>), across five screens:
- Loaded scheduled jobs — the live state, which can differ from the file on disk
- Job definitions on disk — crontab, timer/service units, and their backups
- Config and scripts — JSON/YAML/TOML/shell files that hold the path as a string
- Running processes — argv, including processes running from deleted files
- Shared object stores — git "hub" checkouts other worktrees depend on
The verdict is strictly SAFE or REFUSE. Any hit, any screen that can't finish, a nonexistent path, your home dir or root, or a protected folder is REFUSE. "I couldn't tell" never becomes SAFE. The skill itself never deletes, moves or writes anything.
It also has an audit mode that finds config paths already pointing at nothing, ranked by how live the consumer is (loaded job first, doc rot last), and it names its own blind spots (open file descriptors, remote CI, runtime-assembled paths).
When to use it
- Before deleting, pruning or reclaiming disk from worktrees, clones, caches or "stale" build dirs
- Before a bulk cleanup across many candidate folders (one path at a time, never batch-SAFE)
- As a periodic audit for config paths that no longer exist
What's inside
SKILL.md— the method, the five screens, the fail-closed contract, a stdlib-only Python reference sketch (spellings, process screen, config-surface screen, gate), a per-path shell loop, audit-mode ranking, declared gaps, and install/invoke examples. Works with Claude Code and any agent that loads SKILL.md skills.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for DevOps & Cloud.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 19 days ago
- Software
Git