code/git-cleanup/SKILL.md
Identifies and removes stale git branches, orphaned remote branches, and unused worktrees. Cross-references with Linear (or other integrations) to check issue status before deleting. Use when your repos have accumulated stale branches and you want to tidy up.
npx skillsauth add mostafa-drz/claude-skills git-cleanupInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Intelligently identify and remove stale branches, orphaned remotes, and unused worktrees — with confirmation at every step.
Before starting, use the Read tool to read ~/.claude/skills/git-cleanup/preferences.md. If the file does not exist, treat as "no preferences set".
On startup, use Bash to detect: working directory, git repos in cwd (directories with .git), and current git branch. Skip any that fail.
Check $ARGUMENTS:
help → display help then stopconfig → interactive setup then stopreset → delete ~/.claude/skills/git-cleanup/preferences.md, confirm, stopGit Cleanup — Smart cleanup of stale branches, remotes, and worktrees
Usage:
/git-cleanup Auto-detect repos, clean everything
/git-cleanup ai-assemble Clean a specific repo
/git-cleanup just local branches Natural language — local only
/git-cleanup dry run Show what would be deleted
/git-cleanup skip linear Skip Linear issue checks
/git-cleanup ai-assemble remote only Clean only remote branches
/git-cleanup config Set preferences
/git-cleanup reset Clear preferences
/git-cleanup help This help
Smart detection:
- If inside a git repo, uses that repo
- If in a parent directory, scans for git repos and lets you pick
- If one repo found, uses it automatically
Current preferences:
(shown above under Preferences)
Use AskUserQuestion to collect:
main, all-demos, develop)AIS-\d+)Save to ~/.claude/skills/git-cleanup/preferences.md.
Delete ~/.claude/skills/git-cleanup/preferences.md and confirm: "Preferences cleared. Using defaults."
If no preferences file exists, show:
First time using /git-cleanup? Run
/git-cleanup configto set defaults, or just continue with sensible defaults.
Then proceed with defaults:
main, all-demos, developAIS-\d+Parse $ARGUMENTS as natural language. Extract:
Smart repo detection:
$ARGUMENTS contains a path or directory name → use it.git exists) → use current directory.git
For each repo, collect:
# Protected branches (from prefs or defaults)
PROTECTED="main|all-demos|develop"
# Local branches and their merge status
git branch --format='%(refname:short) %(upstream:track)'
git branch --merged main
git branch --merged all-demos
# Remote branches
git branch -r --format='%(refname:short)'
# Worktrees
git worktree list
# Stale remote tracking
git remote prune origin --dry-run
Sort every branch into one of these categories:
Safe to delete (green):
[gone] upstream (remote deleted)Probably safe (yellow):
Needs review (red):
For branches matching the ticket pattern (e.g., mostafa/ais-921-... → AIS-921):
mcp__claude_ai_Linear__get_issue to fetch issue statusPresent the Linear context alongside each branch.
Show a categorized summary:
Git Cleanup Plan — ai-assemble
SAFE TO DELETE (merged/gone):
Local:
- feature/old-thing (merged into main)
- fix/typo (remote gone)
Remote:
- origin/feature/old-thing (no local, no PR)
PROBABLY SAFE (closed tickets):
Local:
- mostafa/ais-800-old-task (AIS-800: Done ✓)
Worktrees:
- .pilot-worktree (branch deleted)
NEEDS REVIEW:
- mostafa/ais-922-refactor (AIS-922: In Progress)
PROTECTED (never touched):
- main, all-demos, develop
If --dry-run / "dry run" was specified, show this plan and stop.
Use AskUserQuestion to confirm each category:
Q1: "Delete N safe-to-delete branches?" → Yes all / Pick individually / Skip Q2: "Delete N probably-safe branches?" → Yes all / Pick individually / Skip Q3: "Any needs-review branches to delete?" → Pick individually / Skip all
For each confirmed deletion:
git branch -d <branch> (safe delete) or git branch -D <branch> if neededgit push origin --delete <branch>git worktree remove <path>git remote prune originReport each deletion as it happens.
Git Cleanup Complete — ai-assemble
Local branches deleted: 3
Remote branches deleted: 2
Worktrees removed: 1
Stale remotes pruned: yes
Skipped (needs review): 2
Protected: 3
The skill is designed to work with any ticketing integration. The core pattern is:
To add a new integration:
allowed-toolsdevelopment
--- name: triage-board description: >- Generates a structured triage artifact from the current conversation's findings — a self-contained Desktop folder with a JSON Schema, schema-conformant report.json, prose markdown, and a single-file HTML viewer. Viewer ships with MD / CSV / JSON download buttons in the header and a per-finding "Copy as Markdown" action that produces a GitHub/Linear/Notion-ready ticket block. Stateless — triage state lives in the user's ticket system, not in the
development
Runs a beginner-mind end-to-end UI audit of any running app — local dev server, staging, production, or a specific URL. Drives Chrome through every interactive element on the target surface, collects structured findings (severity, category, where, symptom, impact, repro, triage), and hands the result off to `/triage-board` which produces the Desktop folder (schema + JSON + Markdown + single-file HTML viewer with MD/CSV/JSON exports and a per-finding Copy as Markdown button). Use when you want fresh-eyes verification of a feature, page, modal, flow, branch, or whole app — before shipping, before review, before a demo, or any time the UI deserves a careful poke.
development
Reviews the user's past Claude Code conversations from a wellbeing perspective — sentiment, tone, emotional arc, recurring patterns — and generates a supportive, science-grounded report in both Markdown and HTML. Default lookback is 48 hours across all projects. Uses recognised emotion frameworks (Plutchik, Ekman, Russell's circumplex, Pennebaker linguistic markers) and cites the science behind every observation. Learns the user's baseline tone over time so future reports flag genuine shifts, not noise. Use when the user asks for an emotional/wellbeing recap, mood check, sentiment review, or wants to understand their own ups and downs across recent work sessions.
development
--- name: workflow-advisor description: >- Analyzes recent Claude Code conversations and local Claude state (skills, settings, memory files, CLAUDE.md), researches the latest Claude Code features and best practices online, and suggests one workflow improvement at a time with reasoning and a concrete action item. Can save accepted suggestions to memory for tracking. Use when you want to discover underused Claude Code features, improve your development workflow, stay current with the lat