Delegate independent tasks to specialized agents working concurrently with isolated context.
Clean Gone Branches
clean-gone-branches
Clean up local git branches marked as [gone] (deleted on remote but still exist locally). Use when the user wants to clean up stale branches, remove gone branches, or delete branches that no longer exist on remote.
SKILL.md
Full skill instructions
Clean Gone Branches
Automatically clean up all local git branches that have been deleted from the remote repository (marked as [gone]).
Instructions
Step 1 - List Branches to Identify [gone] Status
Execute this command to see all local branches and their status:
git branch -v
What to look for:
- Branches marked with
[gone]have been deleted from the remote - Branches with a
+prefix have associated worktrees and will be skipped (must be cleaned up manually) - Branches without a
+prefix can be safely deleted - If no branches show
[gone], inform the user that no cleanup is needed and STOP
Step 2 - Delete [gone] Branches (Skip Those with Worktrees)
Execute this command to clean up [gone] branches without worktrees:
git branch -v | grep '\[gone\]' | while read line; do
if [[ $line =~ ^[+] ]]; then
branch=$(echo "$line" | awk '{print $1}' | sed 's/^+//')
echo "Skipping $branch (has worktree - remove worktree first)"
else
branch=$(echo "$line" | sed 's/^[* ]//' | awk '{print $1}')
echo "Deleting branch: $branch"
git branch -D "$branch"
fi
done
What this does:
- Finds all branches marked as
[gone] - For each branch:
- If it has a
+prefix (worktree exists), skip it and warn the user - Otherwise, delete the branch using
-D(force delete)
- If it has a
- Provides clear feedback about which branches were deleted and which were skipped
Step 3 - Report Results
After execution, inform the user:
- How many branches were deleted
- How many branches were skipped (with worktrees)
- If any branches were skipped, suggest they need manual worktree cleanup
- Confirmation that cleanup is complete
If no branches were marked as [gone], report that no cleanup was needed.
Important Rules
- DO NOT attempt to delete branches with worktrees - skip them and warn the user
- Use
git branch -D(force delete) because [gone] branches are already merged/deleted remotely - Show clear feedback for each operation (deleted vs skipped)
- Inform users that skipped branches require manual worktree cleanup first
Expected Output
Example with branches to clean:
Deleting branch: fix/obsolete-fix
Skipping feature/old-feature (has worktree - remove worktree first)
Deleting branch: chore/cleanup-task
Cleanup complete:
- Deleted 2 branches marked as [gone]
- Skipped 1 branch with worktree
Note: Branches with worktrees must be cleaned up manually using 'git worktree remove' before the branch can be deleted.
Example with no cleanup needed:
No branches marked as [gone] found. Your local repository is already clean.
Example with only worktree branches:
Skipping feature/old-feature (has worktree - remove worktree first)
Skipping fix/another-branch (has worktree - remove worktree first)
Cleanup complete:
- Deleted 0 branches marked as [gone]
- Skipped 2 branches with worktrees
Note: Branches with worktrees must be cleaned up manually using 'git worktree remove' before the branch can be deleted.
Error Handling
If any command fails:
- Show the error message to the user
- Explain what went wrong
- Continue processing other branches if possible
- Report which branches were successfully cleaned and which failed
More Other skills
brand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.
internal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).
Fundamental design principles for writing maintainable, testable Python code.
responsive-design
Modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first strategies.
Generate Playwright tests from scenarios using interactive browser exploration and validation.
Automated website exploration and test case generation using Playwright.
Modern React state management with Redux Toolkit, Zustand, Jotai, and React Query for every state category.
gdpr-data-handling
GDPR-compliant data handling with consent management, data subject rights, and privacy controls.
Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.
refactor-plan
Detailed multi-file refactor planning with safety checks and rollback guidance.
