delete-branch

delete-branch is a command for Claude Code from danielraffel/generous-corp-marketplace. It costs 10 tokens per session (692 once invoked), scanned A, original, MIT.

A command for deleting a Git branch, either locally or optionally from a remote repository shared with other copies of the project.

In plain words
What is it for?
Use it to delete a local branch, optionally delete its remote copy, select a remote such as origin, or force deletion after reviewing the warning.
Why use it?
It removes branches you no longer need while checking for uncommitted or unmerged work. Force deletion can remove a branch that is not fully merged.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the worktree-manager plugin — 8 commands shipped together

Good fit Use it to delete a local branch, optionally delete its remote copy, select a remote such as origin, or force deletion after reviewing the warning.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/danielraffel/generous-corp-marketplace/delete-branch
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/danielraffel/generous-corp-marketplace

Made for: Claude Code.

Or install worktree-manager, the plugin that ships this one along with the rest of its 8 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for delete-branch

README.md
[![agentmods](https://agentmods.dev/badge/commands/danielraffel/generous-corp-marketplace/delete-branch/github.svg)](https://agentmods.dev/commands/danielraffel/generous-corp-marketplace/delete-branch)
Your own site
<a href="https://agentmods.dev/commands/danielraffel/generous-corp-marketplace/delete-branch"><img src="https://agentmods.dev/badge/commands/danielraffel/generous-corp-marketplace/delete-branch/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for delete-branch

Your own site · 80×15
<a href="https://agentmods.dev/commands/danielraffel/generous-corp-marketplace/delete-branch"><img src="https://agentmods.dev/badge/commands/danielraffel/generous-corp-marketplace/delete-branch.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 692 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00010 $0.00692
Opus 5 $0.00005 $0.00346
Sonnet 5 $0.00002 $0.00138
Haiku 4.5 $0.00001 $0.00069

Measured 10d ago against content hash 5aa8671e81c2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

delete-branch scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/worktree-manager/commands/delete-branch.md · 96 lines

How it starts

The opening of the file, as written. The whole thing — 96 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Worktree Delete Branch Command

Delete a git branch with safety checks for uncommitted work.

Usage

/worktree-manager:delete-branch <branch-name> [options]

Options

  • --force - Force delete even if branch not fully merged
  • --delete-remote - Also delete the branch from remote repository
  • --remote=<name> - Specify remote name (default: origin)

Instructions for Claude

When user invokes this command:

  1. Parse arguments:

    • Extract branch name (required)
    • Check for --force flag → force: true
    • Check for --delete-remote flag → delete_remote: true
    • Extract --remote=<name>remote_name: "<name>"
  2. Safety warnings:

    • If --force is used, warn user about potential data loss
    • If --delete-remote is used, mention this is permanent
  3. Call MCP tool:

    • Use mcp__worktree__worktree_delete_branch
    • Pass branch_name and all options
  4. Display results:

    • Show deletion status:
      • ✅ Local branch deleted:
      • ✅ Remote branch deleted from (if applicable)
    • Show any warnings if remote deletion failed
  5. Error handling:

    • Branch doesn't exist → suggest using /worktree-manager:list
    • Not fully merged → suggest --force or merge first
    • Currently checked out → need to switch branches first
    • Remote deletion failed → show warning but report local success

Examples

Delete local branch:

User: /worktree-manager:delete-branch feature/old-feature
Claude: ✅ Local branch deleted: feature/old-feature

Delete with remote:

User: /worktree-manager:delete-branch feature/done --delete-remote
Claude: ✅ Local branch deleted: feature/done
        ✅ Remote branch deleted from origin

Force delete unmerged:

User: /worktree-manager:delete-branch feature/experiment --force
Claude: ⚠️  Force mode - bypassing merge checks
        ✅ Local branch deleted: feature/experiment

Custom remote:

User: /worktree-manager:delete-branch feature/test --delete-remote --remote=upstream
Claude: ✅ Local branch deleted: feature/test
        ✅ Remote branch deleted from upstream

Read the full file on GitHub · 96 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 96 lines · 10 tokens per session scan A 5aa8671e81c2

Subscribe to this mod's changes

delete-branch is a command published in the GitHub repository danielraffel/generous-corp-marketplace (11 stars, last pushed 11d ago), licensed MIT. It adds 10 tokens to every session and 692 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.