claude-code-templates: Command for Claude Code

.claude/commands/cleanup-cache.md

cleanup-cache is a command for Claude Code from davila7/claude-code-templates. It costs 0 tokens per session (1,311 once invoked), scanned C, original, MIT.

A command for checking and clearing caches created by tools such as npm, Yarn, Homebrew, browsers, and Python or machine-learning software. Caches are temporary files kept so tools can work faster.

In plain words
What is it for?
Use it when a development computer is running low on storage. It can clean package-manager caches and, with the aggressive option, additional browser and development-tool caches.
Why use it?
It helps recover disk space when cached files have grown large. It shows disk usage before and after cleanup and offers conservative or more extensive cleanup options.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: positional $N argument.

This is davila7/claude-code-templates's own configuration. It tells Claude Code how to work on claude-code-templates itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything claude-code-templates configures →

About the project

Claude Code Templates is a command-line tool and catalogue for configuring Anthropic’s Claude Code with agents, commands, settings, hooks, integrations, skills, and project templates. Developers use it to browse and install reusable components for their coding workflows. The catalogue includes many of these Claude Code components.

davila7/claude-code-templates · 32,814 stars · on GitHub · aitmpl.com

Reuse

Borrowing it

Nothing to install: this file belongs to davila7/claude-code-templates. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/davila7/claude-code-templates/main/.claude/commands/cleanup-cache.md
Clone the repo
git clone --depth 1 https://github.com/davila7/claude-code-templates

Made for: Claude Code.

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 cleanup-cache

README.md
[![agentmods](https://agentmods.dev/badge/commands/davila7/claude-code-templates/cleanup-cache/github.svg)](https://agentmods.dev/commands/davila7/claude-code-templates/cleanup-cache)
Your own site
<a href="https://agentmods.dev/commands/davila7/claude-code-templates/cleanup-cache"><img src="https://agentmods.dev/badge/commands/davila7/claude-code-templates/cleanup-cache/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 cleanup-cache

Your own site · 80×15
<a href="https://agentmods.dev/commands/davila7/claude-code-templates/cleanup-cache"><img src="https://agentmods.dev/badge/commands/davila7/claude-code-templates/cleanup-cache.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,311 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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.00000 $0.01311
Opus 5.5 $0.00000 $0.00524
Sonnet 5.5 $0.00000 $0.00262
Haiku 4.5 $0.00000 $0.00131

Measured 1mo ago against content hash 5c0703fe7fc0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

cleanup-cache scanned grade C with 1 finding 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 1mo 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf ~/Library/Caches/Yarn
.claude/commands/cleanup-cache.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.

System Cache Cleanup

Clean temporary files and caches to free disk space: $ARGUMENTS

Current Disk Usage

  • Disk space: !df -h / | tail -1
  • npm cache: !du -sh ~/.npm 2>/dev/null || echo "Not found"
  • Yarn cache: !du -sh ~/Library/Caches/Yarn 2>/dev/null || echo "Not found"
  • Homebrew cache: !brew cleanup -n 2>/dev/null | head -5 || echo "Homebrew not installed"

Cleanup Options

Based on the arguments provided, execute the appropriate cleanup level:

Option 1: Conservative Cleanup (default)

Safe cleanup of package manager caches that can be easily rebuilt:

# Record starting disk space
echo "Starting cleanup..."
df -h / | tail -1 | awk '{print "Before: " $4 " free"}'

# Clean npm cache
echo "Cleaning npm cache..."
npm cache clean --force

# Clean Homebrew
echo "Cleaning Homebrew..."
brew cleanup

# Clean Yarn cache
echo "Cleaning Yarn cache..."
rm -rf ~/Library/Caches/Yarn

# Show results
df -h / | tail -1 | awk '{print "After: " $4 " free"}'

Option 2: Aggressive Cleanup (--aggressive flag)

Includes all conservative cleanup plus browser and development tool caches:

# Run conservative cleanup first (from Option 1)
npm cache clean --force
brew cleanup
rm -rf ~/Library/Caches/Yarn

# Clean browser caches
echo "Cleaning browser caches..."
rm -rf ~/Library/Caches/Google
rm -rf ~/Library/Caches/com.operasoftware.Opera
rm -rf ~/Library/Caches/Firefox
rm -rf ~/Library/Caches/Mozilla
rm -rf ~/Library/Caches/zen
rm -rf ~/Library/Caches/Arc

# Clean development tool caches
echo "Cleaning development caches..."
rm -rf ~/Library/Caches/JetBrains
rm -rf ~/Library/Caches/pnpm
rm -rf ~/.cache/puppeteer
rm -rf ~/.cache/selenium

# Clean Python/ML caches
echo "Cleaning Python/ML caches..."
rm -rf ~/.cache/uv
rm -rf ~/.cache/huggingface
rm -rf ~/.cache/torch
rm -rf ~/.cache/whisper

# Show results
df -h / | tail -1 | awk '{print "After aggressive cleanup: " $4 " free"}'

Option 3: Maximum Cleanup (--maximum flag)

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. 1mo ago First seen · 177 lines · 21 tokens per session scan C 5c0703fe7fc0

Subscribe to this mod's changes

cleanup-cache is a command published in the GitHub repository davila7/claude-code-templates (32,814 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,311 tokens. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.