prune-stale-branches

Prune stale Git branches with safety checks for protected branches.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/TrevorPLam/agency --skill prune-stale-branches-trevorplam
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: prune-stale-branches
Source: https://github.com/TrevorPLam/agency/tree/main/.windsurf/skills/prune-stale-branches
Command: npx skills add https://github.com/TrevorPLam/agency --skill prune-stale-branches-trevorplam

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Keeps repositories clean by removing stale or merged branches that clutter history and complicate workflows.

Core Features & Use Cases

  • Stale branch detection: identifies branches older than a threshold (e.g., 90 days) and merged vs. unmerged.
  • Safety checks: avoids deleting main/develop/release branches or protected branches.
  • Automation-ready: supports scheduled maintenance and manual invocations to prune branches.

Quick Start

Run the prune-stale-branches workflow to remove merged or abandoned branches in the repository.

Frequently Asked Questions about prune-stale-branches

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prune stale Git branches without deleting active branches?▼

You can prune stale Git branches safely by applying safety checks that avoid deleting main, develop, or release patterns. The process cross-references merged status and last activity to select candidates, ensuring active branches remain untouched.

What is the best way to identify merged vs unmerged Git branches for cleanup?▼

Identify merged vs unmerged Git branches by analyzing branch age against a threshold, such as 90 days, and checking their merge status. This detection mechanism separates active branches from stale or abandoned ones suitable for repository cleanup.

Does Git branch pruning support dry-run mode to preview deletions?▼

Yes, Git branch pruning supports dry-run mode to preview deletions safely. This mode allows you to see which stale or merged branches are selected as candidates before any actual deletion occurs in the repository.

Can I automate scheduled maintenance to clean up stale branches?▼

Yes, you can automate scheduled maintenance to clean up stale branches. The workflow is automation-ready and supports scheduled maintenance or manual invocations to prune merged and abandoned branches consistently.

When should I not use automated Git branch deletion?▼

You should not use automated Git branch deletion when working outside protected branch patterns like main, develop, or release. Always use dry-run mode first to verify candidates if you anticipate edge cases with unmerged or recently active branches.

What problems does removing stale branches solve for Git repository maintenance?▼

Removing stale branches solves the problem of cluttered history and complicated workflows in Git repository maintenance. By pruning merged or abandoned branches older than a threshold, you keep the repository clean and maintain clear project organization.