skills/cleanup-old-files/SKILL.md
Autonomous registry cleanup — detects and archives stale, outdated, or duplicate files across local, iCloud, and GitHub repos so no AI agent picks up the wrong version. NEVER deletes — always archives with clear markers. Fires automatically at session start in project repos, or on-demand when agent confusion is diagnosed.
npx skillsauth add nhouseholder/nicks-claude-code-superpowers cleanup-old-filesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
When code evolves, old files accumulate. Future agents see both old and new versions and pick the wrong one — often the old one, because it has more history, more comments, or a familiar name.
Real catastrophic example: UFC project had 6+ copies of the algorithm scattered across directories:
UFC Algs/ root: 20+ old algorithm versions (v2_19 through v3.5)ufc-predict/ufc-predict/ — nested duplicateufc-predict/ufc-predict-1/ — another nested duplicateufc-predict-2/ — yet another old copy.worktrees/Result: agents ran the 25-event backtester instead of the 71-event one, reported wrong numbers, wasted hours.
At the beginning of any session in a project repo, do a quick staleness scan:
*_old.*, *_backup.*, *_v1.*, * 2.*, *_copy.*.worktrees/ or .claude/worktrees/If found: flag to user with a one-line summary. Don't auto-archive without permission.
When user says "clean up", "archive old files", "there's confusion about which file to use", or when an agent picks the wrong file version.
Stale files can hide in THREE places. Check all three:
| Location | Path Pattern | Git-Managed |
|----------|-------------|-------------|
| Local project | ~/Projects/<project>/ or iCloud path | Yes |
| iCloud sync | ~/Library/Mobile Documents/com~apple~CloudDocs/ | Sometimes |
| GitHub | Remote via /tmp/ clone | Yes |
.icloud placeholder extensionsgit push from iCloud directories — clone to /tmp/ first# Find duplicates and old versions
find . -maxdepth 3 -name "*_old.*" -o -name "*_backup.*" -o -name "* 2.*" -o -name "*_copy.*" 2>/dev/null
# Find files with ARCHIVED marker already (verify they have headers)
grep -rl "ARCHIVED" --include="*.py" . 2>/dev/null
# Find nested repo duplicates
find . -maxdepth 3 -type d -name ".git" 2>/dev/null
# Find stale worktrees
ls -la .worktrees/ .claude/worktrees/ 2>/dev/null
# Count files that match the canonical file's purpose
# Example: how many backtesters exist?
find . -name "*backtest*" -o -name "*UFC_Alg*" 2>/dev/null | grep -v archive | grep -v ARCHIVED
Before archiving, verify genuinely orphaned:
# Check nothing imports or calls it
grep -r "old_filename" --include="*.py" --include="*.js" --include="*.ts" .
# Check git for recent modifications
git log --oneline -3 -- <suspect_file>
If anything imports it: STOP. Flag to user.
| Situation | Action |
|-----------|--------|
| Clearly replaced | Rename to <name>.ARCHIVED.py + add header |
| Has unique logic not ported | Move to archive/ + deprecation header |
| Entire directory is stale | Rename dir to <name>.ARCHIVED/ |
| Unclear | Add # DEPRECATED header, ask user |
Archive header template:
# ============================================================
# ARCHIVED — <date>
# Superseded by: <new_file>
# Reason: <brief explanation>
# Do NOT run this file. Do NOT import from this file.
# Kept for historical reference only.
# ============================================================
After local cleanup:
cd /tmp && git clone <repo_url> cleanup-push
# Copy archived files and deletions
cd cleanup-push && git add -A
git commit -m "Archive stale files: <list>"
git push origin main
Update the project's canonical file list in CLAUDE.md or BACKTESTER_README.md:
Canonical files (ONLY use these):
- UFC_Alg_v4_fast_2026.py — THE backtester
- track_results.py — live event scorer
- verify_registry.py — registry validator
Everything else is archived or utility.
# Confirm no unarchived duplicates
find . -name "*UFC_Alg*" -not -name "*.ARCHIVED*" -not -path "*/archive/*"
# Confirm canonical files are present
ls -la UFC_Alg_v4_fast_2026.py track_results.py verify_registry.py
These 8 Python files are THE canonical set. Everything else should be archived:
| File | Role |
|------|------|
| UFC_Alg_v4_fast_2026.py | THE backtester — walk-forward, 71+ events, all 5 bet types |
| track_results.py | Live event scorer — updates registry after real events |
| ufc_betting_systems.py | Value betting overlay systems |
| prediction_cache.py | Prediction caching utility |
| backtest_cache.py | Backtest data caching utility |
| firestore_upload.py | Firestore data uploader |
| verify_registry.py | Registry validator — checks all 12 scoring rules |
| rescore_registry.py | Re-applies scoring rules to existing registry |
repo/repo/ directories from botched clonesRegistry cleanup complete:
- ARCHIVED: 7 old algorithm files → archive/ (v2_19 through v3.5)
- ARCHIVED: 2 nested duplicate directories → .ARCHIVED/
- REMOVED: 3 iCloud " 2" duplicates (empty/identical to originals)
- FLAGGED: old_features.py — has unique logic, added DEPRECATED header
Canonical files verified: 8 Python, 17 JSON. No duplicates remain.
tools
Unified context management and session continuity skill. Combines total-recall, strategic-compact, /ledger, and session continuity. Runs in background to preserve critical context across compaction and sessions.
tools
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
tools
Suggest /ultraplan for complex planning tasks on Claude Code CLI (2.1.91+ only). Research preview.
tools
UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 9 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient. Integrations: shadcn/ui MCP for component search and examples.