agentleFS
skyvanguardskyvanguard/infra-ops/skills/disk-cleanup/SKILL.md

disk-cleanup

Skill1 starsChanged 10 months agoMITView on GitHub

Use when disk space is low, the user wants to free space, or needs to find what's consuming storage. Safely identifies and removes unnecessary files.

  • Deletes or force-pushes

26 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use meta, codex and 3 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • demithrasSkill

    meta

    Strategic decision analysis using CLEAR META framework. Use for architecture decisions, technology selection, strategic trade-offs.

    Also in 3 projects that use this

  • engtySkill

    codex

    Use when the user asks to run Codex CLI (codex exec, codex resume) or references OpenAI Codex for code analysis, refactoring, or automated editing

    Also in 3 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 3 projects that use this

  • GoogleSkill

    tdd

    Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

    Also in 3 projects that use this

  • MicrosoftSkill

    release

    Use ONLY when the user explicitly asks to cut/publish a Huabu desktop release or tag a version. Performs an outward action — bumps the version in apps/desktop/package.json, commits + annotated-tags vX.Y.Z, and pushes the branch + tag. That tag push auto-builds the macOS/Windows installers and publishes a GitHub Release. Provides `status`, `bump`, `tag-push`, and a one-command `run` (bump → tag-push).

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 19 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Check each category and calculate reclaimable space:

    line 32
  2. Distinctive:

    Wait for user confirmation

    line 121
  3. Distinctive:

    After cleanup, re-run disk check and show comparison:

    line 139
  4. Distinctive:

    NEVER delete user documents, photos, videos, or project files

    line 152
  5. Distinctive:

    NEVER empty trash without asking (user might want something back)

    line 153
  6. Distinctive:

    ALWAYS show what will be deleted before acting

    line 154
  7. Distinctive:

    ALWAYS ask permission before each cleanup category

    line 155
  8. Distinctive:

    Start with zero-risk items (temp, caches) before anything else

    line 156
  9. Distinctive:

    If disk is >95% full, flag as CRITICAL and prioritize

    line 157
  10. Distinctive:

    Don't delete logs that might be needed for ongoing troubleshooting

    line 158

“Common” is measured: kept by at least 6 in 10 of the 19 edited versions of this file we could read. “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

Disk Cleanup

Overview

Identify disk space consumers and safely reclaim storage. Prioritizes safe, reversible cleanup actions and always shows what will be deleted before acting.

Process

Step 1: Assess Current Disk State

Overall disk usage:

PlatformCommand
WindowsGet-CimInstance Win32_LogicalDisk | Select DeviceID, @{N='Size(GB)';E={[math]::Round($_.Size/1GB,1)}}, @{N='Free(GB)';E={[math]::Round($_.FreeSpace/1GB,1)}}, @{N='Used%';E={[math]::Round(($_.Size-$_.FreeSpace)/$_.Size*100,1)}}
Linuxdf -h | grep -v tmpfs
macOSdf -h | grep -v devfs

Identify largest directories:

PlatformCommand
WindowsGet-ChildItem C:\ -Directory -ErrorAction SilentlyContinue | ForEach-Object { $size = (Get-ChildItem $_.FullName -Recurse -File -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum; [PSCustomObject]@{Path=$_.FullName; 'Size(GB)'=[math]::Round($size/1GB,2)} } | Sort 'Size(GB)' -Descending | Select -First 10
Linuxdu -sh /* 2>/dev/null | sort -rh | head -15
macOSdu -sh /* 2>/dev/null | sort -rh | head -15

Step 2: Identify Cleanup Candidates

Check each category and calculate reclaimable space:

Temporary files:

PlatformLocationCommand
WindowsUser temp(Get-ChildItem $env:TEMP -Recurse -File -ErrorAction SilentlyContinue | Measure-Object Length -Sum).Sum / 1MB
WindowsSystem temp(Get-ChildItem C:\Windows\Temp -Recurse -File -ErrorAction SilentlyContinue | Measure-Object Length -Sum).Sum / 1MB
Linux/tmpdu -sh /tmp
Linux/var/tmpdu -sh /var/tmp
macOSUser cachesdu -sh ~/Library/Caches

Package manager caches:

PlatformCommand to checkCommand to clean
Windows (Chocolatey)du -sh C:\ProgramData\chocolatey\cache 2>/dev/nullchoco cache remove
npmnpm cache ls 2>/dev/null || du -sh ~/.npm/_cacachenpm cache clean --force
pippip cache info 2>/dev/nullpip cache purge
aptdu -sh /var/cache/apt/archivesapt clean
yum/dnfdu -sh /var/cache/yum 2>/dev/null || du -sh /var/cache/dnfyum clean all
Homebrewdu -sh $(brew --cache)brew cleanup
Composercomposer clearcache --dry-run 2>/dev/nullcomposer clearcache

Container/Docker waste:

# Docker disk usage
docker system df 2>/dev/null

# Dangling images
docker images -f "dangling=true" -q 2>/dev/null | wc -l

# Stopped containers
docker ps -a -f "status=exited" -q 2>/dev/null | wc -l

# Unused volumes
docker volume ls -f "dangling=true" -q 2>/dev/null | wc -l

Log files:

PlatformCommand
WindowsGet-ChildItem C:\ -Recurse -Include *.log -File -ErrorAction SilentlyContinue | Where-Object {$_.Length -gt 100MB} | Select FullName, @{N='Size(MB)';E={[math]::Round($_.Length/1MB)}}
Linuxfind /var/log -type f -size +100M -exec ls -lh {} \; 2>/dev/null
Linuxjournalctl --disk-usage

Old downloads:

PlatformCommand
WindowsGet-ChildItem $env:USERPROFILE\Downloads -File | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-30)} | Measure-Object Length -Sum | Select @{N='Size(MB)';E={[math]::Round($_.Sum/1MB)}}
Linux/Macfind ~/Downloads -type f -mtime +30 -exec du -ch {} + 2>/dev/null | tail -1

Trash/Recycle Bin:

PlatformCommand
Windows(New-Object -ComObject Shell.Application).NameSpace(0x0a).Items() | Measure-Object -Property Size -Sum | Select @{N='Size(MB)';E={[math]::Round($_.Sum/1MB)}}
Linuxdu -sh ~/.local/share/Trash 2>/dev/null
macOSdu -sh ~/.Trash 2>/dev/null

Step 3: Present Cleanup Plan

## Disk Cleanup Plan

### Current State
- Drive [X]: [used]GB / [total]GB ([percent]% used)
- Status: [OK / WARNING / CRITICAL]

### Reclaimable Space
| Category | Size | Risk | Action |
|----------|------|------|--------|
| Temp files | [X] MB | None | Delete all |
| Package caches | [X] MB | None | Clear cache |
| Docker unused | [X] MB | Low | Prune dangling |
| Old logs | [X] MB | Low | Rotate/truncate |
| Old downloads (>30d) | [X] MB | Medium | Review first |
| Trash/Recycle | [X] MB | Medium | Empty |
| [Other] | [X] MB | [risk] | [action] |
| **Total reclaimable** | **[X] GB** | | |

### Recommended Order
1. [Safest first - temp, caches]
2. [Low risk - docker, logs]
3. [Medium risk - ask user]

Step 4: Execute Cleanup (with permission)

For each approved action:

  1. Show exactly what will be deleted
  2. Show the command
  3. Wait for user confirmation
  4. Execute
  5. Report space recovered

Safe cleanup commands:

ActionWindowsLinux/macOS
User tempRemove-Item $env:TEMP\* -Recurse -Force -ErrorAction SilentlyContinuerm -rf /tmp/* 2>/dev/null
System tempRemove-Item C:\Windows\Temp\* -Recurse -Force -ErrorAction SilentlyContinueN/A
npm cachenpm cache clean --forcenpm cache clean --force
pip cachepip cache purgepip cache purge
apt cacheN/Asudo apt clean
Docker prunedocker system prune -fdocker system prune -f
Journal logsN/Asudo journalctl --vacuum-size=100M

Step 5: Verify Results

After cleanup, re-run disk check and show comparison:

### Cleanup Results
| Metric | Before | After | Recovered |
|--------|--------|-------|-----------|
| Used space | [X] GB | [Y] GB | [Z] GB |
| Free space | [X] GB | [Y] GB | +[Z] GB |
| Usage % | [X]% | [Y]% | -[Z]% |

Rules

  • NEVER delete user documents, photos, videos, or project files
  • NEVER empty trash without asking (user might want something back)
  • ALWAYS show what will be deleted before acting
  • ALWAYS ask permission before each cleanup category
  • Start with zero-risk items (temp, caches) before anything else
  • If disk is >95% full, flag as CRITICAL and prioritize
  • Don't delete logs that might be needed for ongoing troubleshooting
  • Warn before deleting Docker volumes (may contain data)

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.