Agent Skill
2/7/2026

finishing-a-development-branch

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

W
withakay
0GitHub Stars
1Views
npx skills add withakay/ito

SKILL.md

Namefinishing-a-development-branch
DescriptionUse 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

name: ito-finish description: "Use when implementation is complete, all tests pass, and you need to decide how to integrate the work — presents structured options for merge, PR, or cleanup"

Finishing a Development Branch

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

Step 1: Verify Tests

Run the project's test suite before offering any options. If tests fail, stop — fix them first.

Step 2: Determine Base Branch

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

Or ask: "This branch split from main — is that correct?"

Step 3: Detect Ito Change

ito list --changes 2>/dev/null

If an Ito change is detected, include Option 5 (Archive).

Step 4: Present Options

Implementation complete. 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
5. Archive Ito change (integrates specs, marks complete)  [if Ito change detected]

Which option?

Keep options concise. Don't add explanation.

Step 5: Execute Choice

Option 1: Merge Locally

Important: If using worktrees, perform the merge from the main worktree, not the feature worktree.

# From the main worktree:
git merge <feature-branch>
<test command>          # verify on merged result
git branch -d <feature-branch>

Then: Cleanup (Step 6).

Option 2: Push and Create PR

git push -u origin <feature-branch>
gh pr create --title "<title>" --body "$(cat <<'EOF'
## Summary
<2-3 bullets>
EOF
)"

Then: Cleanup (Step 6). Keep worktree until PR merges if needed.

Option 3: Keep As-Is

Report: "Keeping branch <name>. Worktree preserved at <path>."

No cleanup.

Option 4: Discard

Require typed confirmation:

This will permanently delete branch <name> and all commits.
Type 'discard' to confirm.

After confirmation:

git branch -D <feature-branch>

Then: Cleanup (Step 6).

Option 5: Archive Ito Change

ito agent instruction archive --change <change-id>

Follow printed instructions. Then: Cleanup (Step 6).

Step 6: Cleanup Worktree

For Options 1, 4, 5 — remove the worktree if one exists:

git worktree remove <worktree-path> 2>/dev/null || true
git worktree prune

For Options 2 and 3 — keep the worktree.

Quick Reference

OptionMergePushArchiveKeep WorktreeDelete Branch
1. MergeYes--NoYes
2. PR-Yes-OptionalNo
3. Keep---YesNo
4. Discard---NoYes (force)
5. Archive--YesNoYes

Rules

  • Never proceed with failing tests
  • Never merge without verifying tests on the result
  • Never delete work without typed confirmation
  • Never force-push without explicit request
  • Always detect Ito changes and include the archive option
  • Always present structured options, not open-ended questions
Skills Info
Original Name:finishing-a-development-branchAuthor:withakay