From flowstate
Guides finishing Git feature branches after tests pass: verifies tests, presents merge/PR/keep/discard options, executes choice, and cleans up.
How this skill is triggered — by the user, by Claude, or both
Slash command
/flowstate:finishing-a-branchThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Core principle:** Verify tests -> Present options -> Execute choice -> Clean up.
Core principle: Verify tests -> Present options -> Execute choice -> Clean up.
Invoke the flowstate:verification-before-completion skill. Run the full test suite. Read output. Confirm zero failures.
If tests fail: Stop. Report failures. Do NOT proceed to Step 2.
Use AskUserQuestion to present exactly these 4 options:
Implementation complete. All tests pass. 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?
Determine <base-branch> first:
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
git checkout <base-branch>
git pull
git merge <feature-branch>
# Verify tests on merged result
<test command>
# If tests pass
git branch -d <feature-branch>
See the requesting-code-review skill for what to include in the PR description.
git push -u origin <feature-branch>
gh pr create --title "<title>" --body "$(cat <<'EOF'
## Summary
<what was built and why>
## Testing
<tests added, pass evidence, coverage summary>
## Post-Deploy Monitoring
<what to monitor, healthy signals, rollback triggers>
EOF
)"
Report the PR URL.
Report: "Keeping branch <name>. Worktree preserved at <path>."
Do NOT clean up worktree or branch.
Require typed confirmation. Show what will be deleted (branch, commits, worktree). Wait for exact "discard" confirmation, then:
git checkout <base-branch>
git branch -D <feature-branch>
Option 3 preserves the worktree. For all others:
git worktree list # check if in a worktree
git worktree remove <worktree-path> # if applicable
For Option 2 (PR created), ask: "Delete local feature branch, or keep it?"
| Option | Merge | Push | Keep Worktree | Cleanup Branch |
|---|---|---|---|---|
| 1. Merge locally | yes | - | - | yes |
| 2. Create PR | - | yes | - | ask |
| 3. Keep as-is | - | - | yes | - |
| 4. Discard | - | - | - | yes (force) |
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub c-reichert/flowstate --plugin flowstate