agentleFS
socai-iosocai-io/socai/.claude/skills/clean-targets/SKILL.md

clean-targets

Skill257 starsChanged 50 days agoApache-2.0View on GitHub

Reclaim disk space by deleting cargo target/ build directories across the main checkout and every git worktree of this repo. Use whenever the user wants to clean up build artifacts, free disk space, run "cargo clean" everywhere, prune worktree build caches, or complains that the repo or its worktrees are eating gigabytes of disk. Safely skips any target dir that a running build or dev session (cargo, rustc, tauri dev) is using.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Delete cargo target/ directories across every checkout of this repo — the main checkout and all git worktrees — in one pass.

    line 8
  2. Very specific:

    Run with --dry-run first and show the user what would be deleted and what is being kept (and why).

    line 21

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

clean-targets

Delete cargo target/ directories across every checkout of this repo — the main checkout and all git worktrees — in one pass. Deleting target/ is exactly what cargo clean does; the difference is this covers every checkout at once and refuses to touch a target that a live build is writing to.

How to run

From anywhere inside any checkout of the repo:

bash "$(git rev-parse --show-toplevel)/.claude/skills/clean-targets/scripts/clean-targets.sh" --dry-run

Run with --dry-run first and show the user what would be deleted and what is being kept (and why). If the plan looks as expected, run it again without the flag to actually delete. Report the total freed at the end, plus current free disk (df -h /).

What the script does

  • Discovers all checkouts with git worktree list --porcelain — nothing is hardcoded, so it works on any machine and any worktree layout.
  • Detects target dirs by cargo's CACHEDIR.TAG marker file, not by directory name, so unrelated directories that happen to be called target are never touched.
  • Skips any target whose path appears in a running process's command line (active rustc/cargo compile, a dev binary running out of target/debug, a tauri dev session). Tell the user which ones were kept and that they can re-run after stopping those sessions.

Notes

  • A skipped "in use" target usually means an active pnpm exec tauri dev in that worktree. Never work around the skip by killing the process yourself — surface it and let the user decide.
  • Everything deleted is a rebuildable cache; the next cargo build in that checkout just starts cold. No source files, git state, or node_modules are touched.

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.