safe-cleanup

safe-cleanup is a skill for Claude Code, Codex from saajunaid/caddis-plugin. It costs 54 tokens per session (1,717 once invoked), scanned A, original, MIT.

A safety procedure for checking folders, links, and environments before recursive deletion. It is especially concerned with Windows links that can point deletion at another location.

In plain words
What is it for?
Use it before removing directory trees, scratchpads, Git worktrees, generated folders, Python virtual environments, or node_modules.
Why use it?
It helps prevent cleanup commands from deleting the real target of a junction or symlink, and checks that important development environments survived.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents.

Good fit Use it before removing directory trees, scratchpads, Git worktrees, generated folders, Python virtual environments, or node_modules.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/saajunaid/caddis-plugin/safe-cleanup
Install

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.

Any agent
npx skills add saajunaid/caddis-plugin --skill safe-cleanup
Clone the repo
git clone --depth 1 https://github.com/saajunaid/caddis-plugin

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for safe-cleanup

README.md
[![agentmods](https://agentmods.dev/badge/skills/saajunaid/caddis-plugin/safe-cleanup/github.svg)](https://agentmods.dev/skills/saajunaid/caddis-plugin/safe-cleanup)
Your own site
<a href="https://agentmods.dev/skills/saajunaid/caddis-plugin/safe-cleanup"><img src="https://agentmods.dev/badge/skills/saajunaid/caddis-plugin/safe-cleanup/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.

agentmods 80×15 button for safe-cleanup

Your own site · 80×15
<a href="https://agentmods.dev/skills/saajunaid/caddis-plugin/safe-cleanup"><img src="https://agentmods.dev/badge/skills/saajunaid/caddis-plugin/safe-cleanup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,717 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00054 $0.01717
Opus 5.5 $0.00022 $0.00687
Sonnet 5.5 $0.00011 $0.00343
Haiku 4.5 $0.00005 $0.00172

Measured 19d ago against content hash 4282909a2873, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

safe-cleanup 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 19d 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.

.github/skills/devops/safe-cleanup/SKILL.md · 177 lines

How it starts

The opening of the file, as written. The whole thing — 177 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Safe Cleanup

Overview

Cleanup looks like the safest thing you do all day. It is the most destructive.

This skill exists because of a real incident: an agent created 31 directory junctions from throwaway worktrees into live repositories, unlinked them, saw "31 unlinked, 0 failed", then recursively deleted the parent. A junction it had never seen survived the scan, the delete followed it, and five repositories' development environments were destroyed. Every verification afterwards said "intact", because the verification was wrong too.

Two hours of repair. None of it would have happened with the rules below.

The one-paragraph version

On Windows, Remove-Item -Recurse follows junctions and deletes their targets. Enumerating with -ErrorAction SilentlyContinue hides the ones you cannot read. And after the damage, pip check, pip list and file counts all report success, because metadata survives while package files do not. So: never link into somewhere real, never recurse through a link, prefer rename over delete, and verify by using the thing rather than counting it.


RULE 1 - Prefer rename over delete

Rename is atomic. Recursive delete is not: it can fail half way and leave a directory that looks present and is unusable.

Rename-Item -Path $target -NewName ".broken-$(Get-Date -Format 'yyyyMMdd-HHmmss')"

In the incident, a venv holding _greenlet.cp314-win_amd64.pyd open refused to delete but renamed fine. Had the delete been retried or forced, it would have half-emptied the directory.

Rename first, build fresh alongside, delete the old copy later when nothing holds it. Disk is cheap. An environment nobody can recover is not.

RULE 2 - Never recurse a delete through a reparse point

Junctions and symlinks are transparent to Remove-Item -Recurse. Deleting a folder that contains a link to C:\live\thing deletes the contents of C:\live\thing.

Check first, and fail if the check itself cannot complete:

Read the full file on GitHub · 177 lines

Changes

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.

  1. 19d ago Changed · -29 tokens per session 4282909a2873
  2. 1mo ago First seen · 177 lines · 83 tokens per session scan A ba7dadd44e2b

Subscribe to this mod's changes

safe-cleanup is a skill published in the GitHub repository saajunaid/caddis-plugin (0 stars, last pushed 2d ago), licensed MIT. It adds 54 tokens to every session and 1,717 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.