project-folder-cleanup
Skill11 starsChanged 3 months agoMITView on GitHub
Safely clean regenerable clutter from a project folder by scanning for build artifacts and caches, backing up every removed path into a timestamped archive with a BACKUP.md manifest, zipping the backup to save space, and only deleting originals after explicit confirmation. Use when the user asks to clean a project directory, remove node_modules, clear build output, reclaim disk space, or tidy a repo before archiving.
In this repository39 other files it gives its agents.
- agent-starter-packSkill
- agent-state-machineSkill
- local-ai-ollamaSkill
- apple-hig-command-paletteSkill
- apple-hig-empty-statesSkill
- apple-hig-feedback-statusSkill
- apple-hig-inspectorsSkill
- apple-hig-macos-window-layoutSkill
- apple-hig-search-filteringSkill
- apple-hig-settingsSkill
- apple-hig-sf-symbolsSkill
- apple-hig-sidebarsSkill
- apple-hig-toolbarsSkill
- apple-hig-typographySkill
- blog-post-publishingSkill
- social-post-kitSkill
- color-principlesSkill
- kika-design-systemSkill
- emergency-switch-appSkill
- product-hunt-polish-reviewSkill
- docs-updateSkill
- between-runs-auditSkill
- explain-new-projectSkill
- new-project-gateSkill
- old-project-auditSkill
- project-catch-upSkill
- project-workflowSkill
- project-worth-my-timeSkill
- butterfly-effectSkill
- spreadSkill
- tilSkill
- apple-app-intentsSkill
- macos-app-distribution-dmgSkill
- macos-clipboard-pasteboardSkill
- macos-global-shortcutsSkill
- macos-launch-at-loginSkill
- macos-menubar-swiftuiSkill
- macos-notificationsSkill
- macos-permissions-privacySkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
Remove regenerable clutter from a project folder without losing data.
- Distinctive: line 18
Do not use it for general file organization across the whole computer — that's out of scope for this skill.
- Distinctive: line 28
Read Safety Rules before every run.
- Very specific: line 88
Run without --dry-run. Omit --confirm on the first execution pass so originals stay in place until backup is verified:
- Distinctive: line 106
Only after the user verifies the archive:
- Very specific: line 112
If backup already exists from step 5, pass the same --targets file if used.
- Distinctive: line 167
If a cleanup run produces wrong targets, bad manifest text, or restore instructions that fail, update this skill (not just the one-off …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Project Folder Cleanup
Remove regenerable clutter from a project folder without losing data. Every targeted path is copied into a backup first, documented in BACKUP.md, compressed into a zip archive, and only then removed from the project when explicitly confirmed.
When to Use
- Clean
node_modules, build folders, caches, or logs from a project - Reclaim disk space before archiving or zipping a repo
- Reset a project to a fresh-build state
- Tidy a workspace after switching branches or experiments
Do not use it for general file organization across the whole computer — that's out of scope for this skill.
Core Rules
- Backup before delete — no exceptions
- Scan and confirm — show paths and sizes; get approval before destructive steps
- Dry-run first — always run with
--dry-rununtil the plan is approved - Zip the backup — keep disk use small; retain the
.zip, drop uncompressed folder by default - Document everything —
BACKUP.mdinside the backup explains what, why, and how to restore
Read Safety Rules before every run.
Workflow
Step 1: Choose the project
Confirm the project root path. Do not run from $HOME unless the user explicitly wants home-level cleanup.
Step 2: Scan candidates
node scripts/scan-cleanup-candidates.mjs /path/to/project --jsonOr human-readable:
node scripts/scan-cleanup-candidates.mjs /path/to/projectReview output with the user. Compare against Default Cleanup Targets. Add or remove paths based on user preference.
Step 3: Check git status
git -C /path/to/project status --shortWarn if targeted paths overlap with uncommitted work the user may care about.
Step 4: Dry-run backup + cleanup plan
node scripts/cleanup-with-backup.mjs --project /path/to/project --dry-runOptional custom manifest:
node scripts/cleanup-with-backup.mjs \
--project /path/to/project \
--targets /tmp/cleanup-targets.json \
--dry-runcleanup-targets.json example:
{
"items": [
{ "path": "node_modules", "category": "JavaScript deps", "reason": "npm install" },
{ "path": ".next", "category": "Next.js build", "reason": "npm run build" }
]
}Present the dry-run summary and wait for explicit approval.
Step 5: Execute backup + zip
Run without --dry-run. Omit --confirm on the first execution pass so originals stay in place until backup is verified:
node scripts/cleanup-with-backup.mjs --project /path/to/projectThis creates:
/path/to/project/.project-cleanup-backups/
2026-05-25T12-30-00-000Z-my-app.zip # contains BACKUP.md + files/
2026-05-25T12-30-00-000Z-my-app-SUMMARY.mdOpen the zip and confirm BACKUP.md lists every path correctly.
Step 6: Delete originals (confirmed)
Only after the user verifies the archive:
node scripts/cleanup-with-backup.mjs --project /path/to/project --confirmIf backup already exists from step 5, pass the same --targets file if used.
Step 7: Post-cleanup
- Suggest adding
.project-cleanup-backups/to.gitignoreif not already ignored - Tell the user where the zip lives and how to restore (see
BACKUP.mdin the archive) - Optionally run the project build/install to confirm everything regenerates
Scripts
- scan-cleanup-candidates.mjs — Find common cleanup targets and report sizes
- cleanup-with-backup.mjs — Backup, render manifest, zip, optionally delete
- render-backup-readme.mjs — Build
BACKUP.mdfrom template (do not paste template into chat)
References
- Default Cleanup Targets — What to remove, ask about, or never touch
- Safety Rules — Backup ordering, failure handling, git awareness
Assets
- backup-readme.template.md — Manifest template rendered by script
Backup layout
Inside the zip:
2026-05-25T...-project-name/
├── BACKUP.md # What was removed, why, restore commands
└── files/ # Mirror of removed paths relative to project root
├── node_modules/
└── .next/Options reference
| Flag | Purpose |
--dry-run | Show plan only |
--confirm | Delete originals after successful backup + zip |
--targets <json> | Custom manifest instead of default scan |
--backup-root <path> | Store backups outside the project |
--keep-uncompressed | Keep folder after zipping |
Edge cases
- Path already missing — skipped silently; noted in scan output
- Backup copy fails — stop immediately; do not delete anything
- Zip fails — keep uncompressed backup; do not delete originals
- User wants
.venvremoved — add to manifest explicitly; warn about reinstall time - Monorepo — scan from repo root; paths are relative to that root
After fixing skill output
If a cleanup run produces wrong targets, bad manifest text, or restore instructions that fail, update this skill (not just the one-off output) when the fix is general and durable.
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
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.

