ship
Original:🇺🇸 English
Translated
Use when implementation is complete, tests pass, and code needs to reach main — via PR with auto-merge (CI up) or local shallow-clone merge (CI down)
22installs
Sourcecamacho/ai-skills
Added on
NPX Install
npx skill4agent add camacho/ai-skills shipTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Ship
Get the branch onto main. Two paths: PR (CI up) or local merge (CI down).
Announce: "Using /ship to integrate this branch."
Prerequisites
- On a feature branch (not main).
- (Step 6) passed, or user explicitly approved.
/review - Worktree path is known (needed for cleanup).
If any prerequisite is missing, say which and stop.
Step 1: Validate
bash
pnpm validateIf validation fails, stop. Fix first.
Step 2: Determine base branch
bash
git -C <worktree> symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/origin/||'Default: . If ambiguous, ask.
mainStep 3: Present options
CI status comes from conversation context — if the user has said CI is down, frozen, or at billing cap, treat as down. No auto-detection.
CI up (default):
Ready to ship.
1. Open PR + auto-merge
2. Keep branch as-is
3. DiscardCI down:
Ready to ship (CI down — local merge with review gate).
1. Local merge to main
2. Keep branch as-is
3. DiscardOption 1a: PR + auto-merge (CI up)
bash
git -C <worktree> push -u origin <branch>
GH_REPO=<owner/repo> gh pr create \
--title "<conventional-commit-title>" \
--body "$(cat <<'EOF'
## Summary
<2-3 bullets>
## Test plan
- [ ] <verification steps>
EOF
)"
GH_REPO=<owner/repo> gh pr merge --auto --mergeReport the PR URL. Proceed to worktree cleanup.
If CI blocks or fails after PR is up: STOP. Ask the user. No self-rescue, no local merge fallback, no force-merge.
Option 1b: Local merge (CI down)
Dispatch the agent on the diff first — all autonomous code must be reviewed before merge:
code-reviewerbash
claude --agent code-reviewer "Review diff: git -C <worktree> diff main..HEAD"If reviewer returns P0/P1 findings, STOP. Fix before proceeding.
Merge via shallow clone into the session directory — never the primary worktree (multi-agent safety):
bash
SHIP_DIR="$CLAUDE_SESSION_DIR/ship-merge"
[ -d "$SHIP_DIR" ] && rm -rf "$SHIP_DIR"
git clone --depth 1 "$(git -C <worktree> remote get-url origin)" "$SHIP_DIR"
git -C "$SHIP_DIR" fetch origin <branch>
git -C "$SHIP_DIR" merge FETCH_HEAD -m "merge: <branch> into main
Co-Authored-By: Claude <model>"
git -C "$SHIP_DIR" pushOn non-fast-forward: then push. Max 3 retries. After 3, escalate to user.
git -C "$SHIP_DIR" pull --rebaseClean up the shallow clone after push:
rm -rf "$SHIP_DIR"Option 2: Keep as-is
Report: "Keeping branch . Worktree preserved at ."
<name><path>Do not clean up.
Option 3: Discard
Require typed "discard" confirmation. Show branch name, commit list, worktree path.
bash
git -C <primary> worktree remove <worktree-path>
git -C <primary> branch -D <branch>
git push origin --delete <branch> 2>/dev/null || trueWorktree Cleanup
After PR (1a) or local merge (1b):
bash
git -C <primary> worktree remove <worktree-path>| Path | Cleanup worktree? |
|---|---|
| PR + auto-merge | Yes |
| Local merge | Yes |
| Discard | Yes (in discard step) |
| Keep as-is | No |
Integration
Called by: /task (Step 8), /executing-plans, /subagent-driven-development
Pairs with: /isolate (cleans up worktree it created), /review (must pass before /ship)
Replaces: finishing-a-development-branch (superpowers)