finishing-a-development-branch
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
About this skill
This skill guides an AI agent through the critical final steps of a development cycle. When an implementation is complete and all tests have successfully passed, the agent utilizes this skill to present a clear, structured set of options for integrating the work. It automates the verification of test suites (e.g., `npm test`, `cargo test`, `pytest`) and then offers choices for merging directly, creating a pull request for review, or simply cleaning up the branch. The core principle is to verify, present options, execute the chosen workflow, and facilitate necessary cleanup, ensuring a robust and efficient development hand-off process within a developer's workflow.
Best use case
To provide a standardized, automated procedure for an AI agent to finalize a completed development branch, ensuring all quality checks (like passing tests) are met before integration into the main codebase or cleanup.
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Confirmation that all tests on the development branch have passed. A clear presentation of integration options (merge, pull request, cleanup) to the user or AI decision-making layer. Successful execution of the chosen option, resulting in either a merged branch, a created pull request, or a cleaned-up (deleted) branch. A report detailing the final action taken and any relevant Git output.
Practical example
Example input
The feature branch `feature/new-login-flow` is ready for completion. Please finalize it.
Example output
I'm using the finishing-a-development-branch skill to complete this work. Step 1: Verifying tests on 'feature/new-login-flow'... [Output of `npm test` or similar, showing 'All tests passed.'] Tests passed successfully. Step 2: Please choose an integration option for 'feature/new-login-flow': 1. Merge directly into `main` (fast-forward if possible). 2. Create a Pull Request (PR) for review. 3. Clean up (delete the branch locally and remotely). Your choice: 2 Step 3: Creating a Pull Request for 'feature/new-login-flow'... [Output of PR creation command, e.g., 'Pull Request #123 created: "Add new login flow feature". Link: [GitHub PR URL]'] Branch 'feature/new-login-flow' successfully prepared for review via Pull Request.
When to use this skill
- When a specific feature or bug fix implementation on a development branch is complete.
- When all associated tests for the development branch are passing successfully.
- When the next step is to integrate the work into a main branch or prepare it for review.
- When the development branch is no longer needed and needs to be safely removed.
When not to use this skill
- If the development work is not yet fully implemented or considered complete.
- If the branch's test suite is failing or tests have not yet been run.
- If there are outstanding changes or dependencies that need to be addressed before integration.
- If the AI agent lacks the necessary permissions to perform Git operations (merge, PR, delete branch).
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/finishing-a-development-branch/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How finishing-a-development-branch Compares
| Feature / Agent | finishing-a-development-branch | Standard Approach |
|---|---|---|
| Platform Support | Claude | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | easy | N/A |
Frequently Asked Questions
What does this skill do?
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Which AI agents support this skill?
This skill is designed for Claude.
How difficult is it to install?
The installation complexity is rated as easy. You can find the installation instructions above.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# Finishing a Development Branch ## Overview Guide completion of development work by presenting clear options and handling chosen workflow. **Core principle:** Verify tests → Present options → Execute choice → Clean up. **Announce at start:** "I'm using the finishing-a-development-branch skill to complete this work." ## The Process ### Step 1: Verify Tests **Before presenting options, verify tests pass:** ```bash # Run project's test suite npm test / cargo test / pytest / go test ./... ``` **If tests fail:** ``` Tests failing (<N> failures). Must fix before completing: [Show failures] Cannot proceed with merge/PR until tests pass. ``` Stop. Don't proceed to Step 2. **If tests pass:** Continue to Step 2. ### Step 2: Determine Base Branch ```bash # Try common base branches git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null ``` Or ask: "This branch split from main - is that correct?" ### Step 3: Present Options Present exactly these 4 options: ``` Implementation complete. What would you like to do? 1. Merge back to <base-branch> locally 2. Push and create a Pull Request 3. Keep the branch as-is (I'll handle it later) 4. Discard this work Which option? ``` **Don't add explanation** - keep options concise. ### Step 4: Execute Choice #### Option 1: Merge Locally ```bash # Switch to base branch git checkout <base-branch> # Pull latest git pull # Merge feature branch git merge <feature-branch> # Verify tests on merged result <test command> # If tests pass git branch -d <feature-branch> ``` Then: Cleanup worktree (Step 5) #### Option 2: Push and Create PR ```bash # Push branch git push -u origin <feature-branch> # Create PR gh pr create --title "<title>" --body "$(cat <<'EOF' ## Summary <2-3 bullets of what changed> ## Test Plan - [ ] <verification steps> EOF )" ``` Then: Cleanup worktree (Step 5) #### Option 3: Keep As-Is Report: "Keeping branch <name>. Worktree preserved at <path>." **Don't cleanup worktree.** #### Option 4: Discard **Confirm first:** ``` This will permanently delete: - Branch <name> - All commits: <commit-list> - Worktree at <path> Type 'discard' to confirm. ``` Wait for exact confirmation. If confirmed: ```bash git checkout <base-branch> git branch -D <feature-branch> ``` Then: Cleanup worktree (Step 5) ### Step 5: Cleanup Worktree **For Options 1, 2, 4:** Check if in worktree: ```bash git worktree list | grep $(git branch --show-current) ``` If yes: ```bash git worktree remove <worktree-path> ``` **For Option 3:** Keep worktree. ## Quick Reference | Option | Merge | Push | Keep Worktree | Cleanup Branch | |--------|-------|------|---------------|----------------| | 1. Merge locally | ✓ | - | - | ✓ | | 2. Create PR | - | ✓ | ✓ | - | | 3. Keep as-is | - | - | ✓ | - | | 4. Discard | - | - | - | ✓ (force) | ## Common Mistakes **Skipping test verification** - **Problem:** Merge broken code, create failing PR - **Fix:** Always verify tests before offering options **Open-ended questions** - **Problem:** "What should I do next?" → ambiguous - **Fix:** Present exactly 4 structured options **Automatic worktree cleanup** - **Problem:** Remove worktree when might need it (Option 2, 3) - **Fix:** Only cleanup for Options 1 and 4 **No confirmation for discard** - **Problem:** Accidentally delete work - **Fix:** Require typed "discard" confirmation ## Red Flags **Never:** - Proceed with failing tests - Merge without verifying tests on result - Delete work without confirmation - Force-push without explicit request **Always:** - Verify tests before offering options - Present exactly 4 options - Get typed confirmation for Option 4 - Clean up worktree for Options 1 & 4 only ## Integration **Called by:** - **subagent-driven-development** (Step 7) - After all tasks complete - **executing-plans** (Step 5) - After all batches complete **Pairs with:** - **using-git-worktrees** - Cleans up worktree created by that skill ## When to Use This skill is applicable to execute the workflow or actions described in the overview.
Related Skills
moodle-external-api-development
This skill guides you through creating custom external web service APIs for Moodle LMS, following Moodle's external API framework and coding standards.
game-development
Game development orchestrator. Routes to platform-specific skills based on project needs.
frontend-mobile-development-component-scaffold
You are a React component architecture expert specializing in scaffolding production-ready, accessible, and performant components. Generate complete component implementations with TypeScript, tests, s
electron-development
Master Electron desktop app development with secure IPC, contextIsolation, preload scripts, multi-process architecture, electron-builder packaging, code signing, and auto-update.
create-branch
Create a git branch following Sentry naming conventions. Use when asked to "create a branch", "new branch", "start a branch", "make a branch", "switch to a new branch", or when starting new work on the default branch.
context-driven-development
Guide for implementing and maintaining context as a managed artifact alongside code, enabling consistent AI interactions and team alignment through structured project documentation.
bun-development
Fast, modern JavaScript/TypeScript development with the Bun runtime, inspired by [oven-sh/bun](https://github.com/oven-sh/bun).
backend-development-feature-development
Orchestrate end-to-end backend feature development from requirements to deployment. Use when coordinating multi-phase feature delivery across teams and services.
nft-standards
Master ERC-721 and ERC-1155 NFT standards, metadata best practices, and advanced NFT features.
nextjs-app-router-patterns
Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.
new-rails-project
Create a new Rails project
networkx
NetworkX is a Python package for creating, manipulating, and analyzing complex networks and graphs.