Prune

From drn/dots · View interactive version

Prune is an AI agent skill from the GitHub repository drn/dots. Clean up merged and stale git branches, prune old local and remote branches safely. Use for cleaning up old branches or pruning stale remotes.

How to use this skill

Skill file

Branch Cleanup

Delete merged and stale local branches safely, with preview and confirmation.

Arguments

Context

Instructions

Resolve the script path — use the first that exists:

  1. ~/.claude/skills/prune/scripts/prune.sh (deployed via symlink)
  2. agents/skills/prune/scripts/prune.sh (repo-relative, for development/workspaces)

Step 1: Preview branches

Run the preview command, forwarding any --stale-days argument:

bash <script-path> preview [--stale-days N]

Handle the exit code:

Format the preview output as:

## Branch Cleanup Preview

### Merged (safe to delete)
| Branch | Last Commit | Merged Into |
|--------|------------|-------------|
| <branch> | <date> | <default> |

### Stale (no commits in N days)
| Branch | Last Commit |
|--------|------------|
| <branch> | <date> |

### Skipped
| Branch | Reason |
|--------|--------|
| <branch> | <reason> |

Step 2: Confirm and delete

Ask the user which branches to delete. Accept "all", specific branch names, or "none".

For confirmed branches, run the delete command:

bash <script-path> delete [--remote] <branch1> [branch2 ...]

Include --remote only if the user passed it in $ARGUMENTS.

Handle the exit code:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.