clear-cache
Skill2 starsChanged 5 days agoMITView on GitHub
Measure and clear this machine's dev caches (npm, pnpm, uv, pip, Homebrew, extra Puppeteer/Playwright browsers, Docker build cache) to win back internal disk space. `/clear-cache report` measures only; `/clear-cache deep` also offers the costlier cleanups.
- Deletes or force-pushes
1 other project uses a version of this.
Adopted by
Most recently taken up by
- yusufalikync/ccstheir own version, first seen Nov 1, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- yusufalikync/ccs★ 4same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository24 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- 1passwordSkill
- brainSkill
- brainstormSkill
- bridgeSkill
- claude-switcherSkill
- commitSkill
- cross-artifactSkill
- ctoSkill
- diskSkill
- killSkill
- lookSkill
- parseSkill
- pbarSkill
- planSkill
- pruneSkill
- pushSkill
- reportSkill
- researchSkill
- swarmSkill
- vibe-auditSkill
- video-editorSkill
- webSkill
- wikiSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 0 are distinctive, and 6 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.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 102
Every Puppeteer release pins its own Chrome build and downloads it on npm install, so each upgrade used to leave another ~500 MB copy in …
- Very specific: line 112
If it says there is no shared Chrome yet, delete nothing.
- Very specific: line 209
Never
sudo: Every cache here belongs to the user. - Very specific: line 210
External drives: if a cache or project root is on an unmounted volume, skip it and say so.
- Very specific: line 211
Never create a folder under /Volumes/, because it would sit on the internal drive where the missing volume should be mounted.
- Very specific: line 219
If .claude/kit.json has a rules."clear-cache" entry, read it and apply it as an additional instruction for this skill.
≈ “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.
Files
Clear Dev Caches
Package managers and browser-automation tools keep a cache: a local copy of everything they ever downloaded, so the next install is instant and works offline. None of it is your work. All of it can be downloaded again. But nothing ever removes old entries, so on a small internal drive the caches slowly outgrow the code.
This skill works on the whole machine, not just the project it runs from. Caches live in your home folder and every project shares them.
| Argument | What happens |
| (none) | Measure, clear the safe tier, measure again, report. No questions asked. |
report | Measure and report only. Changes nothing. |
deep | The safe tier, then list the deep tier with sizes and ask which items to clear. |
Configuration
Optional, in .claude/kit.json:
{
"clearCache": {
"projectRoots": ["~/dev", "/Volumes/External/dev"],
"staleDays": 30
}
}projectRoots: where your projects live. The deep tier looks there for stalenode_modules./disk setupkeeps one list for the whole machine (projectRootsin~/.config/claude-kit/disk.json), which wins over this one. Default is~/dev.staleDays: a project whose files haven't changed in this many days counts as stale. Default 30.
The shell is zsh. It aborts on a glob that matches nothing and doesn't word-split variables. Every block below runs under
bashfor that reason. Keep it that way.
Procedure
1. Measure (every mode)
bash <<'SH'
shopt -s nullglob
# "-" when the path is missing or unreadable (the Trash needs Full Disk Access).
sz() { local s; s=$(du -sh "$1" 2>/dev/null | cut -f1); echo "${s:--}"; }
echo "Internal drive free: $(df -h /System/Volumes/Data | awk 'NR==2{print $4}')"
printf '%-34s %s\n' \
"npm cache (~/.npm/_cacache)" "$(sz ~/.npm/_cacache)" \
"npx packages (~/.npm/_npx)" "$(sz ~/.npm/_npx)" \
"pnpm metadata (Library/Caches)" "$(sz ~/Library/Caches/pnpm)" \
"pnpm store ($(pnpm store path 2>/dev/null || echo n/a))" "$(sz "$(pnpm store path 2>/dev/null)")" \
"uv (~/.cache/uv)" "$(sz ~/.cache/uv)" \
"pip (Library/Caches/pip)" "$(sz ~/Library/Caches/pip)" \
"Homebrew downloads" "$(sz "$(brew --cache 2>/dev/null)")" \
"Puppeteer browsers" "$(sz ~/.cache/puppeteer)" \
"Playwright browsers" "$(sz ~/Library/Caches/ms-playwright)" \
"Hugging Face models (report only)" "$(sz ~/.cache/huggingface)" \
"Trash (report only)" "$(sz ~/.Trash)"
SHIn report mode, also run the find halves of steps 3 and 4 (never the delete halves) so the
report shows what those tiers would free. Then stop.
2. Safe tier: clear without asking
Everything here re-downloads the next time something needs it. Nothing a project is using right now gets removed.
bash <<'SH'
# npm: the download cache. Refills itself on the next install.
command -v npm >/dev/null && npm cache clean --force 2>/dev/null && echo "npm cache cleared"
# pnpm: prune only removes packages that no project links to any more.
# Skip it when the store sits on an external drive that isn't mounted.
if command -v pnpm >/dev/null; then
store=$(pnpm store path 2>/dev/null)
if [ -d "$store" ]; then pnpm store prune && echo "pnpm store pruned"
else echo "pnpm store not reachable ($store) - skipped"; fi
rm -rf ~/Library/Caches/pnpm && echo "pnpm metadata cache cleared"
fi
# uv: prune drops entries nothing uses. `uv cache clean` (everything) is deep tier.
command -v uv >/dev/null && uv cache prune && echo "uv cache pruned"
command -v pip3 >/dev/null && pip3 cache purge 2>/dev/null && echo "pip cache purged"
# Homebrew: old formula versions and downloaded bottles.
command -v brew >/dev/null && brew cleanup --prune=all && echo "Homebrew cleaned"
SH3. Safe tier: extra copies of Chrome
Every Puppeteer release pins its own Chrome build and downloads it on npm install, so each
upgrade used to leave another ~500 MB copy in ~/.cache/puppeteer. The kit now shares one
Chrome across every project (/look, and every project skill that starts
scripts/puppeteer-server.cjs), managed by ~/.claude-kit/scripts/kit-chrome. Anything else in
that folder is a leftover.
~/.claude-kit/scripts/kit-chrome prune # in `report` mode: ~/.claude-kit/scripts/kit-chrome (status only)If it says there is no shared Chrome yet, delete nothing. Tell the user to run
~/.claude-kit/scripts/kit-chrome update once. It installs the shared Chrome, turns off
Puppeteer's downloads in ~/.zshenv, and removes the other copies.
Playwright keeps its browsers in ~/Library/Caches/ms-playwright, one folder per build
(chromium-1228, chromium-1234). Unlike Puppeteer, each Playwright version needs its exact
build and never downloads a missing one on its own, so a test run fails outright until someone
runs npx playwright install. Keep every build any project's Playwright pins, plus the newest of
each type, and delete only the rest. Playwright MCP servers also keep profiles there
(mcp-chrome-*); never touch those.
bash <<'SH'
shopt -s nullglob
# Project roots: the machine config (/disk setup), else this project's kit.json, else ~/dev.
roots=$(jq -r '.projectRoots[]?' "${CLAUDE_KIT_DISK_CONFIG:-$HOME/.config/claude-kit/disk.json}" 2>/dev/null)
[ -z "$roots" ] && roots=$(jq -r '.clearCache.projectRoots[]?' .claude/kit.json 2>/dev/null)
[ -z "$roots" ] && roots="~/dev"
# Every build a project pins, from each installed playwright-core (npm and pnpm layouts).
# -L follows links, so a project linked into ~/dev from another drive is seen too.
pinned=$(echo "$roots" | while IFS= read -r r; do
r="${r/#\~/$HOME}"; [ -d "$r" ] || continue
find -L "$r" -maxdepth 8 -path '*playwright-core/browsers.json' -not -path '*/.git/*' 2>/dev/null
done | sort -u | while IFS= read -r f; do
jq -r '.browsers[] | "\(.name | gsub("-"; "_"))-\(.revision)"' "$f" 2>/dev/null
done | sort -u)
cd ~/Library/Caches/ms-playwright 2>/dev/null || exit 0
for d in *-[0-9]*; do
case "$d" in mcp-*) continue ;; esac
type=${d%-*}
newest=$(ls -d "$type"-[0-9]* | sort -t- -k2 -n | tail -1)
[ "$d" = "$newest" ] && continue
echo "$pinned" | grep -qx "$d" && { echo "keep $d (a project pins it)"; continue; }
echo "remove $d ($(du -sh "$d" | cut -f1))"
rm -rf "$d" # in `report` mode: print only, skip this line
done
SHA project on an external drive that isn't linked into a project root is invisible to this scan,
so list it in projectRoots (/disk setup, or clearCache.projectRoots). If a test later reports a missing browser, run
npx playwright install chromium in that project.
Playwright's installer removes browsers too. After installing, it deletes every build that no registered Playwright needs. A Playwright registers only by running
playwright installitself (the list is inms-playwright/.links). So restoring one project's build can delete another's. After restoring, runplaywright install chromiumin each project that uses Playwright, so all of them are registered and the next install keeps every build.
4. Deep tier: list, then ask (only with deep)
Each of these costs something you'd notice: a slow first run, a re-download, or a reinstall. Measure each one, show a numbered list with sizes and the cost, then clear only what the user picks.
| Item | How to find it | How to clear it | What it costs |
npx packages ~/.npm/_npx | size | rm -rf ~/.npm/_npx | MCP servers started with npx download again on their next start. Close other Claude sessions first, since their servers run from this folder. |
| Whole uv cache | size of ~/.cache/uv | uv cache clean | Every Python tool and venv rebuilds from the network. |
| Docker build cache and dangling images | docker system df (skip if no daemon answers) | docker builder prune -f && docker image prune -f | The next image build starts cold. Never prune volumes (--volumes, system prune -a), because volumes hold databases. |
Stale node_modules | see below | rm -rf <path> | npm install / pnpm install in that project before using it again. |
Rust target/ in stale projects | same scan, target beside a Cargo.toml | cargo clean in that folder | A full rebuild next time. |
Finding stale dependency folders:
bash <<'SH'
days=$(jq -r '.clearCache.staleDays // 30' .claude/kit.json 2>/dev/null); [ -z "$days" ] && days=30
# Project roots: the machine config (/disk setup), else this project's kit.json, else ~/dev.
roots=$(jq -r '.projectRoots[]?' "${CLAUDE_KIT_DISK_CONFIG:-$HOME/.config/claude-kit/disk.json}" 2>/dev/null)
[ -z "$roots" ] && roots=$(jq -r '.clearCache.projectRoots[]?' .claude/kit.json 2>/dev/null)
[ -z "$roots" ] && roots="~/dev"
echo "$roots" | while IFS= read -r r; do
r="${r/#\~/$HOME}"; [ -d "$r" ] || continue
find "$r" -maxdepth 4 \( -name node_modules -o -name target \) -type d -prune 2>/dev/null |
while IFS= read -r d; do
proj=$(dirname "$d")
[ "$(basename "$d")" = target ] && [ ! -f "$proj/Cargo.toml" ] && continue
# Stale = no file in the project (outside dependency/build folders) changed within $days days.
recent=$(find "$proj" -maxdepth 3 \( -name node_modules -o -name target -o -name .git \) -prune \
-o -type f -mtime -"$days" -print -quit 2>/dev/null)
[ -z "$recent" ] && echo "$(du -sh "$d" | cut -f1) $d"
done
done | sort -rh
SH5. Report
Measure again with step 1's block, then give a short before/after table: each cache, its size before and after, the total freed, and internal free space before and after. Call out anything skipped and why (store not mounted, Docker not running, tool not installed).
Rules
- Never touch these, in any mode: the Trash,
~/.cache/huggingface(models are big and slow to download again), Docker volumes, Playwrightmcp-chrome-*profiles, anything inside a project except the stalenode_modules/targetfolders the user picked indeep. - Never
sudo. Every cache here belongs to the user. - External drives: if a cache or project root is on an unmounted volume, skip it and say so.
Never create a folder under
/Volumes/, because it would sit on the internal drive where the missing volume should be mounted. reportchanges nothing.
Project overrides
If .claude/kit.json has a rules."clear-cache" entry, read it and apply it as an additional
instruction for this skill. Absent file or key means no overrides — that is the normal case.
jq -r '.rules."clear-cache" // empty' .claude/kit.json 2>/dev/nullDoes 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
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.

