Skip to content
Skills Library
Programming · Automation

clean-targets

/clean-targets

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.

Repository
socai ↗
Licence
Apache-2.0
Last repository change
27.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
1
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What to check before installing
  • 1 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: scripts/clean-targets.sh

What it does and when to use it

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.

Triggers from the description

cargo clean
Original author description

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.

How it works

  1. How to run
  2. What the script does
  3. Notes
Original SKILL.md headings · 42 lines, 280 words
SKILL.md preview
---
name: clean-targets
description: 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.
---

# 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
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.
Files in this package (2)
  • SKILL.md 2 KB
  • scripts/clean-targets.sh 3 KB

Versions

The database has no other skills named clean-targets.

Database snapshot: 13.11.2026 · package version 8895112593f9 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100cargo-steward
    Use when building, cleaning or maintaining Rust/Cargo workspaces on a machine with cargo-steward; when disk space is low or build output (target/, build dirs, incremental caches, *.rcgu.o) needs cleaning; when creating or retiring git worktrees of a Rust repository; when a Rust…
  • 86cleanup
    Free disk in a project by removing the git worktrees and Next.js cache folders nothing uses, keeping every worktree a session or process works in and every cache a running server holds. Use for /cleanup, \"clean up worktrees\", \"free disk space\", \"what's using my disk\",…
  • 81cleanup
    Free disk in a project by removing the git worktrees and Next.js cache folders nothing uses, keeping every worktree a session or process works in and every cache a running server holds. Use for /cleanup, \"clean up worktrees\", \"free disk space\", \"what's using my disk\",…
  • 100clean-dev-caches
    Free disk space on a developer machine by clearing regenerable caches (npm, Bun, Yarn, pnpm, Homebrew, pip, uv, Go, Gradle, CocoaPods, Xcode DerivedData, old Playwright/Puppeteer browsers, VS Code and JetBrains caches, Docker build cache), stale project build outputs (.next,…
  • 100disk-space-cleaner
    Reclaim disk by deleting regenerable build and dependency directories (target, node_modules, .next, build, .turbo, .venv), biggest first, skipping any whose owning directory shows a live process, a live tmux session, or a git worktree lock. Dry-run by default, and the dry-run…
  • 100cleanup
    Safely analyze and clean up Claude Code git worktrees with Bonsai. Use when the user asks to clean, prune, remove, audit, or reclaim disk space from Claude Code worktrees, stale agent worktrees, or .claude/worktrees directories.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.