Finishing a Development Branch — Integration Protocol
Ensures work is integrated or preserved according to explicit user choice. A mandatory test verification gate is enforced before any options are presented, preventing promotion of broken or unverified code to the base branch.
The Completion Protocol
2. DETERMINE BASE BRANCH
- The split point is identified (e.g.,
git merge-base HEAD main). - The base branch is confirmed with the user if ambiguity exists.
3. PRESENT STRUCTURED OPTIONS
- Exactly these four options are presented without modification:
- Merge back to [base] locally
- Push and create a Pull Request
- Keep the branch as-is (Handle later)
- Discard this work
4. EXECUTE CHOICE
- Option 1: Base is checked out, latest is pulled, branch is merged, tests are re-verified, and the feature branch is deleted.
- Option 2: Branch is pushed to origin and a PR is created using the
ghCLI. - Option 4: Explicit typed confirmation ("discard") is required before destructive deletion.
5. CLEANUP
- For Options 1, 2, and 4: The associated git worktree is removed to maintain repository hygiene.
Completion Patterns
Red Flags — STOP
- "I'll merge now and fix the tests later." → STOP. Integration of failing code is a SEV-0 failure.
- "What should I do next?" → STOP. Present the four structured options defined in the protocol.
- "Deleting worktree automatically." → STOP. Option 3 requires worktree preservation.
Rationalization Table
Reference Files
sk-worktree-safety/SKILL.md— Worktree management.verification-before-completion/SKILL.md— Final evidence gate.running-a-pipeline/SKILL.md— Integration point for pipeline completion.