ce-clean-gone-branches
$
npx mdskill add EveryInc/compound-engineering-plugin/ce-clean-gone-branchesDelete local branches whose remote tracking branch has been deleted, including any associated worktrees.
SKILL.md
.github/skills/ce-clean-gone-branchesView on GitHub ↗
--- name: ce-clean-gone-branches description: 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. --- # 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 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), `request_user_input` in Codex, `ask_user` in Gemini, `ask_user` 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.
More from EveryInc/compound-engineering-plugin
- ce-agent-native-architectureBuild applications where agents are first-class citizens. Use this skill when designing autonomous agents, creating MCP tools, implementing self-modifying systems, or building apps where features are outcomes achieved by agents operating in a loop.
- ce-agent-native-auditRun comprehensive agent-native architecture review with scored principles
- ce-brainstormExplore requirements and approaches through collaborative dialogue, then write a right-sized requirements document. Use when the user says "let''s brainstorm", "what should we build", or "help me think through X", presents a vague or ambitious feature request, or seems unsure about scope or direction -- even without explicitly asking to brainstorm.
- ce-code-reviewStructured code review using tiered persona agents, confidence-gated findings, and a merge/dedup pipeline. In interactive mode it applies safe, verified fixes and commits them when the working tree is clean (it never pushes); in mode:agent it reports only and the caller applies. Use when reviewing code changes before creating a PR.
- ce-commitCreate a git commit with a clear, value-communicating message. Use when the user says "commit", "commit this", "save my changes", "create a commit", or wants to commit staged or unstaged work. Produces well-structured commit messages that follow repo conventions when they exist, and defaults to conventional commit format otherwise.
- ce-commit-push-prCommit, push, and open a PR with an adaptive, value-first description that scales in depth with the change. Use when the user says "commit and PR", "ship this", "create a PR", or "open a pull request". Also handles description-only flows ("write a PR description", "rewrite the PR body", "describe this PR") without committing or pushing.
- ce-compoundDocument a recently solved problem to compound your team's knowledge or CONCEPTS.md, the project's shared domain vocabulary.
- ce-compound-refreshRefresh stale learning and pattern docs under docs/solutions/ by reviewing them against the current codebase, then updating, consolidating, or deleting drifted ones. Use when the user asks to "refresh my learnings", "audit docs/solutions/", "clean up stale learnings", or "consolidate overlapping docs", or when ce-compound flags an older doc as superseded. Do not trigger for general refactor, debugging, or code-review work unless the user has explicitly pointed at docs/solutions/.
- ce-debugSystematically find root causes and fix bugs. Use when debugging errors, investigating test failures, reproducing bugs from issue trackers (GitHub, Linear, Jira), or when stuck on a problem after failed fix attempts. Also use when the user says ''debug this'', ''why is this failing'', ''fix this bug'', ''trace this error'', or pastes stack traces, error messages, or issue references.
- ce-demo-reelCapture a visual demo reel (GIF, terminal recording, screenshots) for PR descriptions. Use when shipping UI changes, CLI features, or any work with observable behavior that benefits from visual proof. Also use when asked to add a demo, record a GIF, screenshot a feature, show what changed visually, create a demo reel, capture evidence, add proof to a PR, or create a before/after comparison.