Ship

From BuilderIO/agent-native · View interactive version

Ship is an AI agent skill from the GitHub repository BuilderIO/agent-native. Commit and push the current work, open a ready PR, babysit it through CI and review, and admin-merge it once it's green and clean, then rotate the worktree to a fresh branch once the flow is done. Use when the user asks to ship, publish, or hand off local changes. Merging to main deploys beta automa

How to use this skill

Skill file

Ship

/ship means: get the requested work merged to main. That covers

committing, pushing, opening a ready PR, fixing CI and review feedback,

merging, and leaving the worktree ready for the next task. Don't stop at

"PR opened" or "CI green", and don't ask for approval of routine steps along

the way. The request to ship already authorized them.

In a dry run (see review-latest-feedback's "Dry run"), don't ship: no PR,

merge, or close-out.

Ownership

every review thread, and admin-merge when the gate below passes. Replying on

your own PR's review threads is always expected.

that exact PR and that exact action. Permission to push is not permission to

merge. Leave bot PRs (Dependabot and the like) alone.

Co-Authored-By, "codex", or agent labels to commits, branches, or PRs.

1. Preflight

git fetch origin --quiet
git status --short
git rev-list --count HEAD..origin/main

using /new-branch's naming. If HEAD is behind origin/main and has no

commits of its own, branch from fresh origin/main and carry the dirty

changes over. Otherwise branch at HEAD.

make a task-owned worktree from fresh origin/main (or from the PR's live

head when updating an existing PR), and carry only this task's changes.

the report.

node scripts/merge-main-into-pr.ts <n>, which refuses unless GitHub reports

CONFLICTING/DIRTY; if a required check needs a fix that exists only on

main, stop and report blocked instead of syncing. Never rebase. Exit 1 means

conflicts to resolve; 2 precondition failed, 3 no conflict, 4 merge failed

without conflicts, 5 GitHub query failed are not conflicts.

2. Validate and push

Run the focused checks for what changed (formatter, tests, typecheck, and the

guards pnpm guards selects). Batch every known fix into one push, because

each push restarts CI.

corepack pnpm ship:push -m "<subject naming the actual behavior change>"

The helper refuses vague subjects. For an existing PR whose head isn't this

branch on origin, push to the verified head repo and ref instead (see

babysit-pr).

3. Open the PR

A whole demo flow or batch of rows is one branch and one PR, with one commit

per change. If an open PR you own already covers the same flow, app, or area,

push to its branch instead of opening a second PR; a second PR for the same

flow waits until the first merges. Someone else's PR follows Ownership above.

Open one ready (not draft) PR right after the first push, with a factual title

and body: what changed, why, and how it was verified. Keep source checks, CI

state, merge, and deployment as separate claims. Don't add unrelated comments,

tags, assignees, or mentions.

4. Babysit to merge

Run /babysit-pr <number> in this same task. It's a step inside /ship, not

a handoff, so keep going until the merge. Every tick:

push). Fix real issues, reply to each thread with the fix or your reasoning,

and push one batched update.

cancelled runs, and missing secrets before touching code.

whose endpoint is "merged, in origin/main, worktree rotated", plus one

same-thread heartbeat (about every 5 minutes, backing off to 30 after three

unchanged wakes) so CI waits resume on their own. The heartbeat stays silent

unless something changed, and you delete it after the merge. In Claude Code,

keep working in the foreground.

5. Merge gate

Merge when all of these have held on the unchanged head for 10 minutes:

REVIEW_REQUIRED alone doesn't block your own PR. Re-check the gate right

before merging, then:

gh pr merge <number> --squash --admin --match-head-commit <head-oid-you-just-checked>

Write the checked OID into the transcript as ship_merge_head_oid before

running the merge. /new-branch's post-merge rotation uses it. If the head

changed, restart the 10 minutes. Never enable auto-merge.

If the user said to leave the PR open, or you only have permission to push to

someone else's PR, stop at a green, review-clean, mergeable PR, and don't

rotate.

6. After merge

5 ("Close the loop") for exactly those threads. That step owns the reply

format, the skip rules, and the no-duplicate check. Never reply on threads

that aren't listed.

origin/main (/new-branch), provided nothing is unpushed or dirty. This is

the only rotation point: between changes of one flow, keep committing on the

same branch. Leave a shared checkout's branch alone.

~/.codex/worktrees) isn't rotated; it is left for

pnpm worktrees:prune --apply from the main checkout, which removes agent

worktrees that are clean, pushed or merged, idle, and not in use. Never

leave one dirty or unpushed on purpose.

Merging to main publishes beta automatically

(deploy-beta-sites-prebuilt.yml), so "it'll be on beta shortly" is accurate

after a merge. Docs on main publish to production automatically. All other

production promotion is manual. Don't claim beta or production is live

without checking; use /ship-and-monitor when the user wants that proof.

Report

Give the PR link, the merge commit, the checks run, the branch disposition,

and anything left for a person, each in a line or two.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.