branch-rename

Renames auto-generated session branches to semantic slugs derived from the PR or branch diff.

Updated Nov 17, 2025
One-click install
npx skills add https://github.com/vzakharov/vovazakharov.com --skill branch-rename-vzakharov
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: branch-rename
Source: https://github.com/vzakharov/vovazakharov.com/tree/main/.claude/skills/branch-rename
Command: npx skills add https://github.com/vzakharov/vovazakharov.com --skill branch-rename-vzakharov

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Harness-assigned git branches like claude/relaxed-brown-EhDOB carry no meaning, making it hard to identify work in remote listings or PR queues. This Skill renames the current branch to a semantic claude/<task-slug>-<hash> name while preserving the original random suffix. ## Core Features & Use Cases - Semantic Re-slugging: Derives a short task slug from the current PR or branch diff and swaps it for the opaque adjective-noun portion of the branch name. - Idempotency Check: Detects branches that are already semantically named and stops, unless explicitly invoked with the force token to re-slug a drifted branch. - PR Lifecycle Handling: Detects an open PR before renaming, warns that renaming closes it, opens a replacement PR on the new branch, and closes the orphaned PR with a cross-linking comment. - Use Case: Mid-session on claude/relaxed-brown-EhDOB, invoke /branch-rename to rename it to something like claude/fix-auth-redirect-EhDOB before opening a PR, keeping the remote branch list readable. ## Quick Start Ask the assistant to run /branch-rename to rename the current auto-generated branch to a semantic name based on the current diff.

Frequently Asked Questions about branch-rename

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I rename an auto-generated claude branch to a semantic name?

Invoke /branch-rename with no arguments. It inspects the current branch, derives a short task slug from the PR or branch diff, and renames the branch to claude/<slug>-<hash> while keeping the original random suffix.

How do I rename a git branch that already has an open pull request?

Renaming a branch with an open PR closes that PR because GitHub does not retarget it. The skill checks for an existing PR first, opens a fresh PR on the renamed branch, and closes the old PR with a comment linking the replacement.

Can I force a rename of a branch that already has a semantic name?

Yes, but only by explicitly invoking /branch-rename force, optionally with a slug. A bare invocation on an already-semantic branch reports that no rename is needed and stops, preventing accidental re-slugging.

What happens if deleting the old remote branch fails after renaming?

If git push origin --delete fails, for example with an HTTP 403 in a sandboxed proxy, the old ref lingers and its PR stays open. The skill then explicitly closes the old PR via gh pr close or the GitHub MCP update_pull_request tool with a link to the replacement.

Does the branch rename skill ask for confirmation before renaming?

No. Invoking the skill is itself the authorization to rename, so it executes without prompting even when a PR is open or the session pinned the branch. It reports what it did afterward, including any closed PR numbers.