nathanchase

branches-cleanup

0
0
# Install this skill:
npx skills add nathanchase/claude-code-starter --skill "branches-cleanup"

Install specific skill from multi-skill repository

# Description

Automatically clean up local git branches that have been merged into the base branch

# SKILL.md


name: branches-cleanup
description: Automatically clean up local git branches that have been merged into the base branch


Cleanup Merged Branches

Automatically clean up local git branches that have been merged into the base branch.

Instructions

When this skill is invoked manually, clean up merged branches:

  1. Run git branch --merged <base-branch> to find branches merged into the base branch
  2. Exclude protected branches: develop, main, master
  3. For each merged branch found:
  4. Check if it has an associated worktree with git worktree list
  5. If worktree exists, remove it with git worktree remove <path>
  6. Delete the local branch with git branch -d <branch>
  7. Report what was cleaned up

Protected Branches (NEVER delete)

  • develop
  • main
  • master

Automation

This skill automatically runs after git pull via the PostToolUse hook in .claude/settings.json.

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.