Repo Maintenance
Audit and clean up repositories: prune bloated CLAUDE.md files, find stub/empty tests, identify CI cost optimizations, and create PRs for all changes.
How It Works
- Maintain repo(s): One repo path or --all across ~/Documents/Dev
- Prune CLAUDE.md to <= 200 lines: Keep conventions + invariants; move narrative to tier-2 files
- Audit tests & dead code: Delete stub/expect(true) tests; grep exports with no consumer
- Trim deps & optimize CI: Remove unimported packages; cache deps, drop double push+PR triggers
- Verify before opening PR: wc -l <= 200, no stub-test grep hits, suite passes
- Open maintenance PR: One PR per repo — changes + what was kept and why
Invocation Triggers
/repo-maintenanceclean up repoprune CLAUDE.mdrepo cleanupUse Cases
- Clean up a repo that has accumulated tech debt over time
- Prune an oversized CLAUDE.md to the 200-line limit
- Find and fix stub/empty tests that are polluting coverage
The Problem
Every repo accumulates rot you stop noticing. The CLAUDE.md grows to 400 lines of narrative nobody reads. Test files sit there with expect(true).toBe(true) and pass for green checks they never earned. CI runs the full suite on every push AND every PR, burning minutes for zero extra coverage. None of it screams — it just quietly taxes every session and every build until someone goes looking.
What It Does
- 1Audit and prune CLAUDE.md
Runs wc -l on the file. If it is over 200 lines, it strips narrative explanations and context derivable from the code, keeps conventions and invariants and commands, and moves detail to tier-2 files.
- 2Hunt stub and empty tests
Greps every test file for real assertions. Files with fewer than 3 real test functions, expect(true).toBe(true) padding, or TODO/skip markers get real tests or get deleted.
- 3Scan for dead code and unused deps
Finds exported functions and types with no consumer anywhere in the codebase, including test files. Lists packages that are installed but imported nowhere. Removes only what has no remaining reference.
- 4Find CI cost wins
Reviews the workflows for double-triggering on push and PR, missing dependency caching, and redundant jobs. Moves tests to PR-only and adds caching where it is missing.
- 5Verify, then open the PR
Runs the test suite to confirm nothing broke, then opens a PR per repo with a before/after line count, the removed stubs and dead code, and an explicit list of what was kept and why.
What You Get / What It Doesn't Do
- A PR per repo with the full diff and a what-changed summary
- CLAUDE.md under 200 lines, with detail moved to tier-2 files
- Stub tests removed or replaced with real behavior tests
- A CI config that runs on PR only and caches dependencies
- An explicit list of what was deliberately kept and why
- Rewrite business logic or refactor working code
- Delete an export it cannot prove is unused
- Merge its own PRs — you review the diff first
- Run git-filter-repo on you — it flags large binaries, you decide
Tips
Run a single path before --all. You want to see what its pruning judgment looks like on a repo you know cold before you let it loose on the whole Dev directory.
The PR lists what it refused to touch and why. That section is where you catch a too-aggressive dead-code call or a CLAUDE.md line that should have stayed.
If everything in CLAUDE.md feels load-bearing, that is context inflation, not a complex project. The fix is tier-2 files, not an exception to the limit.
Get the Skill
Unlock the full Repo Maintenance SKILL.md — drop it into ~/.claude/skills/ and trigger it by name.
- A PR per repo with the full diff and a what-changed summary
- CLAUDE.md under 200 lines, with detail moved to tier-2 files
- Stub tests removed or replaced with real behavior tests
- A CI config that runs on PR only and caches dependencies
29 more production skills ready to install.