finishing-a-development-branch

Guides completion of development branches through structured merge, pull request, or cleanup options.

Updated Jul 15, 2026
One-click install
npx skills add https://github.com/em411/supercodex --skill finishing-a-development-branch-em411
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: finishing-a-development-branch
Source: https://github.com/em411/supercodex/tree/main/skills/finishing-a-development-branch
Command: npx skills add https://github.com/em411/supercodex --skill finishing-a-development-branch-em411

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When implementation work is done, developers often face an ambiguous decision point: merge locally, open a pull request, keep the branch, or discard it. This Skill removes that ambiguity by verifying tests first, detecting the git environment, and presenting a fixed set of structured options with safe execution and cleanup. ## Core Features & Use Cases - Test-Gated Completion: Runs the project's test suite before offering any options and refuses to proceed if tests fail. - Environment Detection: Distinguishes normal repositories, named-branch worktrees, and detached HEAD states to present the correct option menu and cleanup behavior. - Safe Worktree Cleanup: Removes only worktrees under .worktrees/ or worktrees/ that the workflow created, always from the main repo root, followed by git worktree prune. - Use Case: After finishing a feature in an isolated git worktree, invoke this Skill to verify tests pass, choose "Merge back to main locally", and have the merge, worktree removal, and branch deletion executed in the correct order. ## Quick Start Ask the assistant to finish the current development branch and present the available completion options.

Frequently Asked Questions about finishing-a-development-branch

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

FAQPage Schema
How do I safely merge a feature branch after implementation is complete?

Verify the test suite passes first, then checkout the base branch, pull, merge the feature branch, and re-run tests on the merged result. Only after the merge succeeds should you remove the worktree and delete the branch.

How do I clean up a git worktree after merging a branch?

Change directory to the main repository root, run git worktree remove with the worktree path, then run git worktree prune to clear stale registrations. Delete the branch only after the worktree is removed, since git branch -d fails while a worktree references it.

Why does git branch -d fail when a worktree still exists?

Git refuses to delete a branch that is checked out in a worktree. Remove the worktree first with git worktree remove from the main repo root, then delete the branch.

Should I delete the worktree after creating a pull request?

No. Keep the worktree alive after pushing and opening a pull request so you can iterate on review feedback. Worktree cleanup only applies to local merges or confirmed discards.

What happens to detached HEAD worktrees when finishing development work?

Detached HEAD worktrees are treated as externally managed, so the merge option is removed and no cleanup is performed. The available options are push as a new branch with a pull request, keep as-is, or discard.