Skip to content
Back to skills

Finishing Branch

ASecurity

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

  • 7 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentsbashgit

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add Hellblazer/nexus --skill finishing-branch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Finishing Branch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Finishing Branch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hellblazer-finishing-branch/badge)](https://www.skillsdirectory.com/skills/hellblazer-finishing-branch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: finishing-branch
description: 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
effort: medium
---

# Finishing a Development Branch

Verify tests → present options → execute choice → clean up.

## Step 1: Verify Tests

```bash
uv run pytest   # or project-appropriate command
```

If tests fail: **stop.** Fix before proceeding.

## Step 2: Determine Base Branch

```bash
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
```

## Step 3: Present Options

```
Implementation complete. Options:

1. Merge back to <base-branch> locally
2. Push and create a Pull Request
3. Keep the branch as-is
4. Discard this work
```

## Step 4: Execute

### Option 1 — Merge locally
```bash
git checkout <base-branch>
git pull
git merge <feature-branch>
# verify tests on merged result
git branch -d <feature-branch>
```

### Option 2 — Push + PR
```bash
git push -u origin <feature-branch>
gh pr create --title "<title>" --body "$(cat <<'EOF'
## Summary
<bullets>

## Test plan
- [ ] <steps>
EOF
)"
```

### Option 3 — Keep as-is
Report location. Don't clean up worktree.

### Option 4 — Discard
**Require user to type `discard` to confirm.** Do not accept "yes" or "ok".
```bash
git checkout <base-branch>
git branch -D <feature-branch>
```

## Step 5: Cleanup

Detect whether running in a worktree:
```bash
git worktree list | grep "$(pwd)"
```

| Option | Clean worktree? | Clean branch? |
|---|---|---|
| 1. Merge | Yes | Yes |
| 2. PR | Yes | No |
| 3. Keep | No | No |
| 4. Discard | Yes | Yes (force) |

If in a worktree (options 1, 2, 4), run `nx identity may-stop --kind worktree --ref "$(pwd -P)"`. Any nonzero exit: stop, do not remove. If unowned, confirm it is yours (branch, work); never remove one you cannot account for. Then:
```bash
cd <base-worktree>
git worktree remove <path> && nx identity work done --kind worktree --ref <path>
```

## Beads Integration

If beads are active, close related beads before or after merge:
```bash
bd close <bead-id> --reason="Merged to <base-branch>"
```

## Sync Beads

If beads are active, push state to remote after closing:
```bash
bd dolt push
```

**Pairs with:** `/conexus:git-worktrees` for initial workspace setup.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.