ct-finishing-a-development-branch

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

1|Updated Sep 8, 2026
One-click install
npx skills add https://github.com/mercadona/control-tower --skill ct-finishing-a-development-branch-mercadona
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ct-finishing-a-development-branch
Source: https://github.com/mercadona/control-tower/tree/main/plugin/skills/ct-finishing-a-development-branch
Command: npx skills add https://github.com/mercadona/control-tower --skill ct-finishing-a-development-branch-mercadona

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When implementation work is done, developers 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, detecting the git environment, and presenting a fixed set of structured options with safe execution and cleanup. ## Core Features & Use Cases - Test-Gated Completion: Refuses to present merge or PR options until the project's test suite passes, preventing broken code from being integrated. - Environment-Aware Menus: Detects normal repositories, named-branch worktrees, and detached HEAD states, then presents the correct 4-option or 3-option menu. - Safe Worktree Cleanup: Uses provenance checks to only remove worktrees under .worktrees/ or worktrees/, always from the main repo root, followed by git worktree prune. - Control Tower Integration: Detects CT-governed dispatches via .agent/SLICE.md and follows a fixed push-PR-release-stop path, leaving merges as human decisions. - Use Case: After finishing a feature branch in a git worktree, invoke this Skill to verify tests, choose "Push and create a Pull Request", and keep the worktree alive for PR iteration. ## Quick Start Use the finishing-a-development-branch skill to complete my current branch now that all tests pass.

Frequently Asked Questions about ct-finishing-a-development-branch

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

FAQPage Schema
How do I finish a development branch after implementation is complete?

Verify the test suite passes first, then choose from four structured options: merge back to the base branch locally, push and create a pull request, keep the branch as-is, or discard the work. Each option has defined cleanup behavior for branches and worktrees.

How to safely remove a git worktree after merging a branch?

Merge and verify tests first, then cd to the main repository root before running git worktree remove, since running it from inside the worktree fails silently. Follow with git worktree prune to clean stale registrations, then delete the branch.

What happens when finishing a branch on a detached HEAD?

Detached HEAD indicates an externally managed workspace, so the merge option is removed. You get three options: push as a new branch and create a pull request, keep as-is, or discard, with no worktree cleanup performed.

Why does git branch -d fail after merging in a worktree?

The branch deletion fails because the worktree still references that branch. Remove the worktree first with git worktree remove from the main repo root, then run git branch -d to delete the branch.

When should I not clean up a git worktree after finishing work?

Never clean up when creating a pull request, since you need the worktree alive to iterate on review feedback. Also skip cleanup for worktrees outside .worktrees/ or worktrees/ paths, which are owned by the host environment or harness.