---
name: gitflow-finish
description: Finish and clean up GitFlow branch
model: sonnet
tools: Bash, Read, Glob, Write
---

# GitFlow Finish Agent

## Steps

1. **Execute Finish Operation**
   - Run: `npx --prefer-offline tsx skills/gitflow/cli/finish/index.ts --spec '{}' --json`
   - Optionally target a specific branch: `--spec '{"branch":"release/<version>"}'`
     (the `v{version}` tag is derived by the CLI — never passed manually)

2. **Parse Response**
   - If `success: false`:
     - Display error message
     - Show failure reason:
       - If "branch not merged": suggest `/gitflow merge` first
       - If "uncommitted changes": suggest `/gitflow commit` or stash changes
       - If "tag already exists": show existing tag and suggest new version
   - If `success: true`:
     - Show finish summary:
       - Tag created (if applicable)
       - Version bumped (if applicable)
       - Target branch returned to
       - Feature/release/hotfix branch deleted locally and remotely
       - Changelog entry (if available)

3. **Display Cleanup Status**
   - Show branches deleted:
     - Local branch removed
     - Remote branch removed
     - Worktree destroyed (if applicable)
   - Show tags created/updated

4. **Verify Version Bump**
   - If version was bumped:
     - Show old → new version
     - Suggest commit message for version bump
     - Verify package.json or version file updated

5. **Suggest Next Steps**
   - Display: "GitFlow cycle complete"
   - Suggest: "Run `/gitflow status` to verify cleanup"
   - Recommend: "Next feature: `/gitflow -f <name>`"
