agentleFS
weselbenweselben/RooForge/skills/forge-cleanup/SKILL.md

forge-cleanup

Skill4 starsChanged 3 months agoApache-2.0View on GitHub

Load when the user wants to tidy up — 'clean up', 'remove stale stuff', after a merged PR, or when worktrees and scratch files pile up.

  • Deletes or force-pushes
  • Commits and pushes

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 4 are distinctive, and 1 is 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.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Only proceed on y or Y. Skip on anything else.

    line 49
  2. Distinctive:

    After all confirmed removals:

    line 65
  3. Distinctive:

    One candidate at a time: Never batch-confirm.

    line 81
  4. Distinctive:

    Current branch protected: Never offer to delete the branch the user is on.

    line 83
  5. Distinctive:

    Delete main, master, or the current branch

    line 94

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Forge Cleanup

One-shot maintenance. Removes stale forge development artefacts. Asks the user before every removal.

Steps

1. Detect candidates

Collect every stale artefact in the repo:

# 1. Scratch files (least destructive)
ls /tmp/pr-review-*.md /tmp/resolve-*.md /tmp/review-*.diff /tmp/forge-*.md /tmp/*.loop.out 2>/dev/null

# 2. Stale worktrees
# For each .worktrees/<slug>/ check: branch not merged to main AND branch not on origin
for d in .worktrees/*/; do
  [ -d "$d" ] || continue
  BRANCH=$(cd "$d" && git branch --show-current)
  git merge-base --is-ancestor "$BRANCH" main 2>/dev/null || git branch -r --contains "$BRANCH" 2>/dev/null | grep -q . || echo "$d"
done

# 3. Uncommitted changes (main repo)
git status --porcelain

# 4. Untracked files (main repo)
git ls-files --others --exclude-standard

# 5. Local branches (feat/*, fix/*, chore/*, hotfix/* with no upstream, excluding current)
git for-each-ref --format='%(refname:short) %(upstream:short)' refs/heads | awk '$2 == "" && $1 ~ /^(feat|fix|chore|hotfix)\// && $1 != "'"$(git branch --show-current)"'" {print $1}'

2. Ask per candidate (one at a time)

For each candidate, format and ask:

Found: <type> <path-or-name>
Remove it? [y/N] >

Only proceed on y or Y. Skip on anything else. Continue to next candidate.

3. Act on confirmed removals

TypeCommand
Scratch filerm -f <path>
Stale worktreegit worktree remove <path> --force (then git branch -D <branch> if branch still local)
Uncommitted changesgit checkout -- <path> (file-level) or git reset --hard HEAD (repo-level — ask again)
Untracked filerm -f <path>
Local branchgit branch -D <branch>

Log each action: Removed <type>: <path-or-name>.

4. Final pull

After all confirmed removals:

git checkout main
git pull

Report:

Cleanup complete.
Removed: N scratch, N worktrees, N uncommitted, N untracked, N branches
On main at <commit-sha>

Rules

  • One candidate at a time. Never batch-confirm.
  • Default is NO. Empty input = skip.
  • Current branch protected. Never offer to delete the branch the user is on.
  • Worktree branches — if the worktree branch isn't on origin, offer to delete it after removing the worktree.
  • Uncommitted changes — offer file-by-file first; if many, offer repo-level reset --hard as a second question.
  • No auto-confirm. Even --yes flag doesn't bypass; this skill is interactive by design.

Boundaries

Forge Cleanup does not:

  • Touch committed history (no git rebase, no git commit --amend)
  • Push anything (no git push)
  • Modify remote state
  • Delete main, master, or the current branch
  • Touch other users' worktrees

It only removes local stale artefacts the user explicitly confirms.

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.