# branch-finalization

branch-finalization verifies tests, presents four clear next steps, and handles merging, pull requests, or branch cleanup.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 131 installs · ★ 50 repo stars
- Author: qodex-ai
- License: LicenseRef-Proprietary · policy=link-only · description only; the file stays with the author
- Source: https://github.com/qodex-ai/ai-agent-skills/tree/HEAD/skills/branch-finalization/SKILL.md
- Updated: 2026-01-05
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/branch-finalization

## What it does

This skill establishes a strict protocol for closing out feature branches. It starts by running project tests with `npm test`, `pytest`, `cargo test`, or `go test`. If any test fails, execution halts immediately. Merging or opening a PR on broken code is blocked.

Once tests pass, it locates the base branch and offers exactly four choices: merge locally, push and submit a PR via `gh`, retain the branch, or discard changes. Discarding requires typing an exact confirmation word to prevent accidental loss. Without that confirmation, nothing is deleted.

Depending on the chosen path, the skill checks for an active `git worktree` and removes it when merging locally or discarding the branch.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add qodex-ai/ai-agent-skills --skill branch-finalization -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/branch-finalization/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/branch-finalization/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add qodex-ai/ai-agent-skills --skill branch-finalization -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/branch-finalization/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add qodex-ai/ai-agent-skills --skill branch-finalization -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/branch-finalization/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install qodex-ai/ai-agent-skills skills/branch-finalization
```

2. **Manually: put the files in place**
- File: `.github/skills/branch-finalization/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add qodex-ai/ai-agent-skills --skill branch-finalization -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/qodex-ai/ai-agent-skills --path skills/branch-finalization
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/branch-finalization/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add qodex-ai/ai-agent-skills --skill branch-finalization -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/qodex-ai/ai-agent-skills/tree/HEAD/skills/branch-finalization/SKILL.md

## When to use it
- merging untested commits into the base branch
- creating structured pull requests via gh CLI
- cleaning up temporary git worktrees after integration
- safely discarding abandoned feature branches with explicit confirmation

## Example prompts
- Finalize this branch and verify tests.
- Wrap up work on the current feature branch.
- Prepare this branch for merging into main.

## Similar
- [new-branch-and-pr](https://affpapa.org/en/nevibecode/skills/new-branch-and-pr.md) — skill · 2300 installs
- [prepare-branch-context](https://affpapa.org/en/nevibecode/skills/prepare-branch-context.md) — skill · 107 installs
- [workspace-branch](https://affpapa.org/en/nevibecode/skills/workspace-branch.md) — skill · ★ 44 repo stars
- [command-sync-branch](https://affpapa.org/en/nevibecode/plugins/command-sync-branch.md) — plugin · ★ 2707 repo stars
- [update-branch](https://affpapa.org/en/nevibecode/plugins/update-branch.md) — plugin · ★ 2858 repo stars
- [update-branch-name](https://affpapa.org/en/nevibecode/plugins/update-branch-name.md) — plugin · ★ 1013 repo stars

From the same set: [qodex-ai/ai-agent-skills](https://affpapa.org/en/nevibecode/by/qodex-ai/ai-agent-skills.md) — 42 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
