Clean Branches

Remove stale local and remote git branches that have been merged into main. Detects regular merges and squash merges. Cleans up fork remote branches and prunes tracking refs. Use when the user asks to clean up branches, remove merged branches, or tidy up git.

49 stars 102 forksGit & Code Review

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add hw-native-sys/simpler --skill clean-branches
Manual install
git clone --depth 1 https://github.com/hw-native-sys/simpler.git /tmp/simpler
mkdir -p ~/.claude/skills
cp -r /tmp/simpler/.claude/skills/clean-branches ~/.claude/skills/clean-branches

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Clean Merged Git Branches

## Overview

Identifies and removes branches whose work is already in main — both local branches and remote branches on the fork. Detects squash-merged branches that `git branch --merged` cannot detect. Never touches the upstream repo.

## Step 1: Identify Remotes

```bash
git remote -v
```

Determine which remote is the **fork** (typically `origin`) and which is **upstream**. Store the fork remote name as `<fork>` for use in subsequent steps. Only fork remote branches are candidates for deletion.

## Step 2: Gather Branch Information

Run in parallel:

```bash
# Local: regular merges
git branch --merged main | grep -v '^\*' | grep -vx '  main'

# Local: all branches (excluding current and main)
git branch | grep -v '^\*' | grep -vx '  main'

# Remote: all fork branches (exclude main/HEAD)
git fetch <fork>
git branch -r --list '<fork>/*' | grep -vw '<fork>/main' | grep -vw '<fork>/HEAD'

# Stale remote tracking refs
git remote prune <fork> --dry-run
```

**If no local or remote branches exist besides main**: Inform user and exit.

## Step 3: Detect Squash-Merged Branches

For each branch (local or remote-only) NOT in the `--merged` list, check GitHub:

```bash
gh pr list --head "<branch-name>" --state merged --json number,title,headRefOid --limit 1
```

For remote branches, strip the `<fork>/` prefix before querying.
Read the full skill on GitHub

Details

Skill name
clean-branches
Path
.claude/skills/clean-branches/SKILL.md
Repo updated
18 November 2026

FAQ

What does the Clean Branches skill do?

Remove stale local and remote git branches that have been merged into main. Detects regular merges and squash merges. Cleans up fork remote branches and prunes tracking refs. Use when the user asks to clean up branches, remove merged branches, or tidy up git.

How do I install the Clean Branches skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add hw-native-sys/simpler --skill clean-branches. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Clean Branches popular?

It lives in hw-native-sys/simpler, which has 49 GitHub stars and 102 forks.

Related skills

Benchmark

49

hw-native-sys/simpler

Benchmark runtime performance on hardware. If the current branch has commits ahead of upstream/main or uncommitted changes, compares against the fork point (merge-base). Otherwise benchmarks current state only. Use when the user asks to benchmark, measure performance, or compare latency.

Git & Code Review102

Checkout PR

49

hw-native-sys/simpler

Add a remote for a given PR's head repository and checkout a local pr-xxx-work branch. Use when the user wants to work on someone else's PR locally.

Git & Code Review102

Core Swimlane

49

hw-native-sys/simpler

Produce a Core swimlane (the L0/intra-core AICore pipeline) for one task — a single kernel or a mix — via the dump-driven `simpler_setup.tools.core_swimlane` tool. Use when the user asks to "run/produce a core swimlane", "trace a task's intra-core pipeline", profile why one AICore task is slow inside the core(s), or needs help choosing the tool's manual flags (`--func-id`, `--restore-arg`, `--set-arg`, `--spmd-block-num`, `--case`). The tool captures real per-task args from an args dump and auto-generates the `msprof op simulator` replay — no hand-authored workspace. For a hand-authored single

Productivity & Notes102

Create Issue

49

hw-native-sys/simpler

Create a GitHub issue following the project's issue templates. Classifies the issue type, fills required fields per template, and creates it via gh CLI. Use when the user wants to file a bug, request a feature, or create any GitHub issue.

Git & Code Review102

Dispatch

49

lllyys/vreader

Parallel lane dispatch — the ONLY sanctioned multi-item fan-out (feature #130, rule 55). Use when the user asks to fix several bugs at once ('fix #a #b #c'), implement independent feature WIs in parallel, or run a dispatch batch. Orchestrates worktree-isolated implementer lanes on leased simulators, validates HANDOFFs, and runs the serial integration tail (rebase → re-test → tracker/docs → version-at-slot → PR → merge-from-worktree → tag). A single item degrades to the inline /fix-issue or /feature-workflow flow.

Git & Code Review21

Dsv41 Scheduler Benchmark

49

hw-native-sys/simpler

Run and compare DeepSeek V4.1 Flash decode scheduler benchmarks on Ascend A5. Use for pypto-lib dev branches or daily CI performance cases, Simpler tests/fdwic/dsv41_scheduler, A5 HBG no-graph baselines, runtime A/B or stacked-PR comparisons, and L1/L3 traces for these cases.

Git & Code Review102

Browse the most popular Claude skills, all git & code review skills, or write your own with the skills generator.