Environment Cleanup
Run the cleanup script to remove stale branches, worktrees, caches, and artifacts.
Usage
Invoke from the repo root:
# Preview what will be cleaned (no deletions)
bash .claude/skills/cleanup/cleanup.sh --dry-run
# Actually clean everything
bash .claude/skills/cleanup/cleanup.sh
What it cleans
- Git worktrees under
.claude/worktrees/ - Stale local branches (anything not
main) - Remote branches with no open PR — merged or abandoned (uses
ghCLI) - Git stashes (drops all)
- Stale remote-tracking refs (
git remote prune origin) - Coverage/test artifacts (
coverage*,playwright-report,test-results) - node_modules/.cache
- Claude temp files in
/tmp
Flags
| Flag | Description |
|---|---|
--dry-run |
Preview actions without making changes |
Notes
- Always skips
mainbranch - Always skips branches with open PRs on GitHub
- Idempotent: safe to run multiple times
- Requires
ghCLI to be authenticated for remote branch cleanup