Skip to content
Back to skills

Prune Merged

ASecurity

Use only on `/prune-merged` to delete already-merged branches (local + remote) safely, with 7-day tombstone recovery. Manual-only; nothing auto-triggers it.

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 5, 2026
ai-agentsgit

Works with

  • cli

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned November 24, 2026

npx -y skills add bravros/bravros --skill prune-merged --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Prune Merged?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Prune Merged
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/bravros-prune-merged/badge)](https://www.skillsdirectory.com/skills/bravros-prune-merged)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: prune-merged
core: true
description: Use only on `/prune-merged` to delete already-merged branches (local + remote) safely, with 7-day tombstone recovery. Manual-only; nothing auto-triggers it.
---

# Prune Merged Branches

Read [briefing.md](references/briefing.md) on demand for detailed context and instructions.

Safely delete branches already merged to the base branch. Dual-signal merge-truth, five safety guards, 7-day tombstone refs for recovery. Full safety contract: `references/safety.md`.

## Critical Rules

- **Manual-only.** Nothing auto-triggers this skill — `/finish` and `/promote` never prune (P-0185). The ONLY entry point is a user typing `/prune-merged`, and Step 2 user review is mandatory before any `--apply`.
- **Both local and remote refs deleted** on a successful prune.
- **Worktree safety.** A branch checked out in any worktree is OFF-LIMITS — skipped in both dry-run and `--apply`, **even when already merged to main**, reported as `SKIPPED-WORKTREE (<path>)`. Prune never removes a worktree or deletes a worktree-backed branch; worktree teardown is owned solely by `bravros worktree cleanup <path>`. Details + rationale: `references/safety.md` Guard 5.
- **Protected by design.** Hard blocklist: `main`, `homolog`, `master`, `staging`, `develop`, current HEAD, open-plan branches, GitHub branch-protection rules, `.bravros/config.json` `permanent_branches`.
- **Recoverable.** Pruned branches write 7-day tombstone refs (`feat/foo` → `refs/tombstones/feat-foo`, slashes become dashes) — rejected-PR branches included, same contract.
- **Closed-PR branches are pruned by default, in the CLI.** A branch whose every PR is `CLOSED` (none open, none merged) is deliberately rejected work: the CLI reports it as `[CANDIDATE] … source=rejected` and `--apply` deletes it under the same Step 2 approval. `--exclude-rejected` holds them back for the rare run where you want that.

## Flow

1. **Dry-run:** `bravros branch prune --base <detected-base>` — lists candidates with source attribution (git/pr/pr-verified/rejected). Dry-run is the default; only `--apply` deletes.
2. **User review — MANDATORY.** Show the full output — the `[CANDIDATE]` lines (`source=rejected` ones included, they are deletions too), every `SKIPPED-WORKTREE` line, and the skip reasons — then ask "Proceed with deletion?". Never continue without an explicit yes.
3. **Apply:** `bravros branch prune --apply --base <detected-base>`. Add `--exclude-rejected` only if the user asked to hold rejected-PR branches back.
4. **Report:** deleted count (the summary breaks out rejected-PR deletions), log location (`~/.agent_config/logs/branch-prune.log`), recovery instructions.

Files in this skill

  • SKILL.md2.6 KB
  • references/briefing.md4.2 KB
  • references/safety.md5.3 KB
  • skill.yaml2.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.