skills/mp-ship/SKILL.md
Ship finished work: sync base, commit, push, PR, wait for CI green, merge. Use when: "ship it", "ship and merge", "ship this"
npx skillsauth add MartinoPolo/mpx-claude-code mp-shipInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Full workflow from finished execution to merged PR. $ARGUMENTS
gh pr checks --watch (do NOT merge yet)gh pr merge --squash only after CI is fully green⚠️ Never
gh pr merge --autoas the gate.--autoonly waits if the base branch has required status checks configured. If it doesn't (common), GitHub merges immediately — before CI finishes and regardless of pass/fail. This skill therefore explicitly watches CI green first, then merges (Steps 5→7), which is correct whether or not branch protection exists.--automay only be used as a convenience after confirming required checks are configured (see Step 7).
Detect current state and determine entry point:
git status --porcelain
git log origin/<current>..HEAD --oneline 2>/dev/null
gh pr list --head <current-branch> --json number,state,url --jq '.[0]'
| State | Entry point | |-------|-------------| | Uncommitted changes | Step 2 (sync) | | Committed but not pushed | Step 3 (push only) | | Pushed, no PR | Step 4 (create PR) | | PR exists, CI pending/failed | Step 5 (watch CI) | | PR merged | Step 8 (post-merge) |
Determine target branch: use $ARGUMENTS if provided, otherwise run node $HOME/.claude/scripts/detect-base-branch.js.
Spawn a Sonnet general-purpose sub-agent with sync-base instructions:
Task: Merge origin/<target> into current branch.
git fetch origin <target>git log HEAD..origin/<target> --oneline— if empty, report "already synced" and stopgit merge origin/<target>- If conflicts: list conflicted files (
git diff --name-only --diff-filter=U), read each, resolve simple conflicts (non-overlapping, clear intent) with Edit tool +git add. For complex/ambiguous conflicts, show both sides and ask the user.- After all resolved:
git commit(accept default merge message)- Report: commits merged, conflicts resolved (if any)
If the Sonnet agent cannot resolve conflicts (complex overlapping logic): take over at Opus level, resolve manually, then continue.
Spawn mp-git-committer sub-agent (Haiku):
push: true commit_hint: $ARGUMENTS or summary of changes from git diff --stat
Handle result:
4a. Find linked issue:
Fast-path: node $HOME/.claude/scripts/extract-branch-issue.js
If no number extracted, spawn mp-issue-finder sub-agent (Haiku) with repo, branch, commits, diff summary.
4b. Create PR:
Spawn mp-pr-manager sub-agent (Haiku):
issue_number: (from 4a, if found) description_hint: summary of changes
Handle result:
Wait for the PR's checks to complete. This blocks until all checks finish:
gh pr checks <pr_number> --watch
If the PR has no checks at all (gh pr checks exits non-zero with "no checks reported"), there is no CI to gate on — note this to the user and proceed to Step 7 (merge).
Do not merge here. The merge happens only in Step 7, after green.
On CI failure:
gh run list --branch <branch> --limit 1 --json databaseId,conclusion --jq '.[0]'
gh run view <run_id> --log-failed
Analyze failure logs. Classify:
waitFor timeouts) rather than blindly rerunning; a green rerun of a flaky test is not a fix.gh run rerun <run_id> --failedFor code fixes:
mp-git-committer sub-agent (Haiku) with push: true, commit_hint: "fix: CI failure — <summary>"For flaky/infra reruns:
gh run rerun <run_id> --failedAfter 3 fix attempts: report full failure summary to user and stop. Do not merge.
Only reached once Step 5 reports all checks green (or confirmed no checks exist).
Detect repo merge strategy:
gh repo view --json squashMergeAllowed,mergeCommitAllowed,rebaseMergeAllowed --jq '.'
Prefer squash > merge > rebase (use first allowed).
Merge explicitly (not --auto) so the merge is gated by the green CI you just confirmed, independent of whether branch protection exists:
gh pr merge <pr_number> --squash
(Replace --squash with the detected strategy if squash is not allowed.)
Confirm the merge landed:
gh pr view <pr_number> --json state,mergeCommit --jq '{state, mergeCommit: .mergeCommit.oid}'
--autoexception: if the base branch already has required status checks configured (gh api repos/{owner}/{repo}/branches/{base}/protection/required_status_checksreturns a non-emptycontexts/checks),gh pr merge <pr> --squash --autois equally safe and may be used instead — GitHub will then genuinely wait for those checks. When in doubt, use the explicit green-then-merge flow above.
Compose summary: what shipped, tests added, files changed, CI run URL. Write to temp file and post:
gh pr comment <pr_number> --body-file <temp_file>
Detect worktree context:
git rev-parse --git-common-dir
.git → not in worktree, run git pull on current repoworktrees/ → pull into main repo:MAIN_REPO=$(dirname "$(cd "$(git rev-parse --git-common-dir)" && pwd)")
git -C "$MAIN_REPO" pull
git checkout <original-branch>
(Only if the pull in 8b switched context. In worktree mode this is unnecessary.)
After completion, display:
tools
Show current project progress. Displays phase status and next steps. Use when: "show status", "project progress", "what's done"
data-ai
Unified project setup. Auto-detects state and orchestrates mpx skills/agents for init, conversion, or restructure.
testing
Track bugs/issues in .mpx/ phase system. Parses reports, finds related phases, adds fix tasks or creates bugfix phases. Use when: "track this bug", "add issue to project", "log this bug", "add bug to checklist"
development
Project workflow guidance for spec-driven development. Background knowledge auto-loaded when relevant.