Skip to content
Skill

Repo cleanup loop

Runs a weekly, evidence-gated sweep that classifies and tidies branches, PRs and worktrees

Repo cleanup loop is an open-source agent skill for developer tools. It is available on Claude Code.

Scripts
None
Platforms
Claude Code
GitHub stars
12
Last commit
License
MIT
Listing updated

Similar skills

About Repo cleanup loop

Repo Cleanup Loop is a recurring hygiene routine for a git repository. Each pass scans local and remote branches, open pull requests, commit trails and worktrees, then assigns every item to a classification that starts as unreviewed until evidence confirms it. Valuable work that sits outside the default branch is recovered first, for example by saving it under a recovery ref and logging where it went, and only then becomes eligible for removal. Each pass removes one class of safely removable items, then re-scans the whole state.

The skill is built on the loop-controller guardrails and delegates the post-merge branch and worktree cleanup to the git-post-merge-cleanup skill rather than reimplementing it. It keeps an inventory file, a recovery log and a pass cap, and it stops for a human on ambiguous items such as squash-merged branches that show as unmerged or worktrees with uncommitted changes. It never force-deletes unmerged work.

It expects a git repository and the gh command-line tool for pull request listing. It is meant to be triggered deliberately with a weekly schedule or a direct command, and it is intended for Claude Code.

When your agent uses it

Weekly repo hygiene: classify every branch, PR and worktree, recover valuable work first, then remove one class of stale items with evidence. HITL on anything ambiguous; never force-deletes unmerged work. Broader and recurring; one-off post-merge cleanup is git-post-merge-cleanup. Trigger on "weekly repo hygiene", "clean up the repo weekly", "scheduled repo cleanup".

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 2 files (19 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the skill-madness plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add ivy00johns/Skill-Madness
/plugin install skill-madness@skill-madness

Or copy only this skill to ~/.claude/skills/repo-cleanup-loop:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ivy00johns/Skill-Madness.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/repo-cleanup-loop &&
cp -R "$tmp/skills/loops/repo-cleanup-loop" ~/.claude/skills/repo-cleanup-loop &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/repo-cleanup-loop inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/repo-cleanup-loop to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ivy00johns/Skill-Madness.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/repo-cleanup-loop &&
cp -R "$tmp/skills/loops/repo-cleanup-loop" ~/.agents/skills/repo-cleanup-loop &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/repo-cleanup-loop inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/repo-cleanup-loop to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ivy00johns/Skill-Madness.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/repo-cleanup-loop &&
cp -R "$tmp/skills/loops/repo-cleanup-loop" ~/.cursor/skills/repo-cleanup-loop &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/repo-cleanup-loop inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/ivy00johns/Skill-Madness.git --path skills/loops/repo-cleanup-loop

Or copy the folder to ~/.gemini/skills/repo-cleanup-loop yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/repo-cleanup-loop:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ivy00johns/Skill-Madness.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/repo-cleanup-loop &&
cp -R "$tmp/skills/loops/repo-cleanup-loop" ~/.copilot/skills/repo-cleanup-loop &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/repo-cleanup-loop inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/ivy00johns/Skill-Madness.git

Then copy Skill-Madness/skills/loops/repo-cleanup-loop into your agent's skills folder as repo-cleanup-loop. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Whole-repo inventory
Classifies every branch, open pull request and worktree into a per-item record that starts unreviewed.
Recover before delete
Salvages commits that exist only on unmerged branches and logs where they were saved before any removal.
One class per pass
Removes a single category of safely removable items each pass, then re-scans the full repository state.
Delegated post-merge cleanup
Hands merged-branch, gone-ref and stale-worktree handling to the git-post-merge-cleanup skill.
Human checkpoints
Pauses on ambiguous items such as stale PRs with local work, long-lived shared branches and dirty worktrees.
Loop safety caps
Applies pass limits, no-progress detection and budget ceilings to keep scheduled runs bounded.

Good for

  • Run a weekly cleanup of merged and stale branches across the repository
  • Check which open pull requests have no recent activity and flag them for review
  • Find worktrees with uncommitted changes and list them without deleting anything
  • Save unmerged branch commits to a recovery ref before pruning old branches
  • Set up a scheduled repository hygiene check that reports what it changed

Repo cleanup loop FAQ

Does Repo cleanup loop delete unmerged work?

No. It never force-deletes unmerged work, does not use force pushes or forced worktree removal on unmerged work, and recovers valuable commits before any removal.

Is Repo cleanup loop the same as git-post-merge-cleanup?

No. The post-merge skill is a one-off tidy after merges. This skill is a recurring, whole-repository loop that covers pull requests and commit trails too, and it delegates the branch and worktree cases to the post-merge skill.

How is Repo cleanup loop triggered?

It is user-driven and disables automatic model invocation. You run it weekly with a loop or schedule command, or invoke it directly by name.

What does Repo cleanup loop need to run?

It uses Read, Edit, Bash, Grep and Glob tools, the git command line, and gh for listing pull requests. It requires Claude Code and a starter plan or higher.

How do I install Repo cleanup loop in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/repo-cleanup-loop to use it in all your projects, or to .claude/skills/repo-cleanup-loop in one project. Or install the skill-madness plugin, which includes it: /plugin marketplace add ivy00johns/Skill-Madness, then /plugin install skill-madness@skill-madness.

Does Repo cleanup loop run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Repo cleanup loop?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

What are the best alternatives to Repo cleanup loop?

The closest alternatives to Repo cleanup loop are Git post merge cleanup, Self healing loop, Git branch cleanup, Git clean worktrees and Review workflow.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from ivy00johns/Skill-Madness

  1. Finds merged and stale git branches, then deletes them only after your confirmation

    • Open source
    • 12 GitHub stars
    • Developer tools
  2. Finds and removes git worktrees whose changes are already merged into main

    • Open source
    • 12 GitHub stars
    • Developer tools
  3. Bulk-scans a skill ecosystem for consistency, quality gaps and ownership conflicts

    • Open source
    • 12 GitHub stars
    • Developer tools
  4. Runs a single-skill quality review covering structure, triggering and output checks

    • Open source
    • 12 GitHub stars
    • Developer tools
  5. Turns skill review or audit reports into a prioritized list of concrete SKILL.md fixes

    • Open source
    • 12 GitHub stars
    • Developer tools
  6. Applies planned edits to SKILL.md files, validates them, and offers to sync

    • Open source
    • 12 GitHub stars
    • Developer tools