finishing-a-development-branch

Guides merging, pushing, or preserving a completed development branch with test verification and worktree cleanup.

2|Updated Jul 11, 2026
One-click install
npx skills add https://github.com/MoofonLi/dev-ready --skill finishing-a-development-branch-moofonli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: finishing-a-development-branch
Source: https://github.com/MoofonLi/dev-ready/tree/main/src/dev_ready/templates/claude/skills/finishing-a-development-branch
Command: npx skills add https://github.com/MoofonLi/dev-ready --skill finishing-a-development-branch-moofonli

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When implementation work is done, developers face a risky decision point: how to integrate the branch without losing work, merging into the wrong base, or destroying uncommitted files. This Skill enforces a safe, structured completion workflow. ## Core Features & Use Cases - Test-Gated Integration: Runs the full test suite first and blocks any merge or push until the suite is green. - Environment-Aware Menus: Detects normal repos, named-branch worktrees, and detached HEAD states to present the correct integration options (merge locally, push and create PR, or keep as-is). - Safe Worktree Cleanup: Removes only self-created worktrees under .worktrees/, refuses to force-delete uncommitted files, and requires typed confirmation before discarding work. - Use Case: After finishing a feature branch in a git worktree, the Skill verifies tests pass, asks whether to merge into the base branch or open a pull request, then cleans up the worktree only after the merged result is verified green. ## Quick Start Ask the agent to finish the current development branch and decide how to integrate the completed work.

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?

Run the full test suite first, confirm the base branch the work forked from, then merge locally and re-run tests on the merged result. Only delete the feature branch after the merged tree is green.

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

Change to the main repo root, then run git worktree remove followed by git worktree prune. Only remove worktrees under .worktrees/ or worktrees/ directories; leave externally managed workspaces in place.

What should I do when git worktree remove is refused?

A refusal means the worktree contains modified or untracked files that exist nowhere else. List them with git status --porcelain -uall, then commit, move, or explicitly delete them before retrying removal. Never use --force on your own initiative.

Can I merge a branch when tests are failing?

No. The workflow stops when tests fail and reports the failures before presenting any integration options. A green test suite on the exact tree being integrated is a hard prerequisite.

What are the options for a detached HEAD worktree?

A detached HEAD workspace gets a reduced two-option menu: push as a new branch and create a pull request, or keep the workspace as-is. Local merging is not offered because the workspace is externally managed.