lucking7/compound-engineering-skills · Archived

ce-clean-gone-branches

Clean up local branches whose remote tracking branch is gone.

First seen Jun 23, 2026

Installation

$ npx skills add lucking7/compound-engineering-skills --skill ce-clean-gone-branches

Summary

  • Clean up local branches whose remote tracking branch is gone.
  • Use when the user says "clean up branches", "delete gone branches", "prune local branches", "clean gone", or wants to remove stale local branches that no longer exist on the remote.
  • Also handles removing associated worktrees for branches that have them.

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from lucking7/compound-engineering-skills · top by installs.

npx skills add lucking7/compound-engineering-skills

Browse all from lucking7/compound-engineering-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Declared
Cursor Not declared
Codex Declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Also listed on

Alternate registries and mirrors of this skill.

Repository health

License LICENSE
Default branch main
Open issues 0
Status Archived

Skill metadata

Parsed from SKILL.md frontmatter.

Declared agents claude-code codex

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,462 B
  • docs SUMMARY.md 345 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

Clean Gone Branches

Delete local branches whose remote tracking branch has been deleted, including any associated worktrees.

Workflow

Step 1: Discover gone branches

Run the discovery script to fetch the latest remote state and identify gone branches:

bash scripts/clean-gone

[scripts/clean-gone](./scripts/clean-gone)

The script runs git fetch --prune first, then parses git branch -vv for branches marked : gone].

If the script outputs NONE, report that no stale branches were found and stop.

Step 2: Present branches and ask for confirmation

Show the user the list of branches that will be deleted. Format as a simple list:

These local branches have been deleted from the remote:

  - feature/old-thing
  - bugfix/resolved-issue
  - experiment/abandoned

Delete all of them? (y/n)

Wait for the user's answer using the platform's blocking question tool: AskUserQuestion in Claude Code (call ToolSearch with select:AskUserQuestion first if its schema isn't loaded), requestuserinput in Codex, askuser in Gemini, askuser in Pi (requires the pi-ask-user extension). Fall back to presenting the list in chat only when no blocking tool exists in the harness or the call errors (e.g., Codex edit modes) — not because a schema load is required. Never silently skip the question.

This is a yes-or-no decision on the entire list -- do not offer multi-selection or per-branch choices.

Step 3: Delete confirmed branches

If the user confirms, delete each branch. For each branch:

  1. Check if it has an associated worktree (git worktree list | grep "\\[$branch\\]")
  2. If a worktree exists and is not the main repo root, remove it first: git worktree remove --force "$worktree_path"
  3. Delete the branch: git branch -D "$branch"

Report results as you go:

Removed worktree: .worktrees/feature/old-thing
Deleted branch: feature/old-thing
Deleted branch: bugfix/resolved-issue
Deleted branch: experiment/abandoned

Cleaned up 3 branches.

If the user declines, acknowledge and stop without deleting anything.