ship
Verify and publish changes — push, open PR, watch CI until green; land mode merges an existing PR and cleans up. Triggers "ship it", "create PR", "open PR", "ready to merge", "/pr", "/ship", "push and PR", "watch the PR", "babysit CI", "loop until green"; land mode "land it", "/ship land", "fix CI and merge", "merge it then clean the branches", "merge and clean up".
适合你,如果你经常需要发起 PR 并等到 CI 通过后合并代码。
npx oh-my-skill add darkroomengineering/cc-settings/shipcurl -fsSL https://oh-my-skill.com/install.sh | bash -s -- darkroomengineering/cc-settings/shipnpx oh-my-skill verify darkroomengineering/cc-settings/ship怎么用
商店整理自技能原文 · 版本 fa04efc · 表述以原文为准Claude会自动执行代码验证和发布流程:进行类型检查、构建、测试、lint、代码审查、提交、推送、创建PR并监控CI通过;对于已有PR,执行合并和清理。
当用户说出“ship it”、“create PR”、“open PR”等触发词,或要求land模式(如“land it”、“/ship land”)时触发。
技能原文 SKILL.md
Ship Pipeline
Before starting work, create a marker: mkdir -p ~/.claude/tmp && echo "ship" > ~/.claude/tmp/heavy-skill-active && date -u +"%Y-%m-%dT%H:%M:%SZ" >> ~/.claude/tmp/heavy-skill-active
You are in Maestro orchestration mode. Execute the shipping checklist in order.
Current State
- Branch: !
git branch --show-current 2>/dev/null || echo "unknown" - Working tree: !
git status --porcelain 2>/dev/null | head -20 - Recent commits: !
git log --oneline -5 2>/dev/null || echo "no commits"
Pipeline (All Steps Mandatory)
Step 0: Preflight
ssh-add -l
If no identities loaded: Unlock 1Password and retry — git signing will fail otherwise. Agent drops mid-flow are a recurring cause of failed pushes; catch it now, not after the commit.
Do not commit until Steps 1–4 (typecheck/build/test/lint) are green. Skipping ahead is where amend churn comes from — --amend to fix a lint error you would have caught in 30 seconds invalidates signatures and CI runs.
Step 1: Type Check
bunx tsc --noEmit
If errors: fix them. Do not proceed until clean.
Step 2: Build
bun run build
If errors: fix them. Do not proceed until clean.
Step 3: Test (if tests exist)
3a. Affected tests first (when tldr is available). Run only the tests touched by your changes, before the full suite. Fast feedback if you broke something obvious:
tldr change-impact --project . 2>/dev/null
If TLDR returns a list, run those tests first (bun test <file> or vitest run <file>). If they fail, fix before the full run — don't waste cycles on the rest.
3b. Full suite.
bun test || vitest run
If test runner is not configured, skip this step. If tests fail: fix them. Do not proceed until green.
Step 4: Lint
biome check .
If errors: fix or justify.
Step 5: Web Quality Gate
Quick sanity check before review:
- [ ] No
loading="lazy"on above-fold/LCP images - [ ] Images have explicit dimensions or
fillprop - [ ] No
console.logleft in production code - [ ] Meta tags present on new pages (
title,description,canonical) - [ ] Structured data valid on new content pages
If issues found: fix them before proceeding to review.
Step 6: Review Changes
Spawn reviewer agent:
Agent(reviewer, "Review all staged changes for quality, TypeScript strictness, a11y, and performance issues.")
When the Codex bridge is available, run a cross-model review in parallel — a different model family catches what Claude self-review misses, and this is right before a commit lands, the cheapest place to catch a Critical:
Agent(codex-verifier, "Cross-model review of the staged diff. Report findings by severity.")
If Claude and Codex disagree on a Critical/HIGH finding, surface it to the user as a gate before Step 7 — don't auto-commit through a cross-model disagreement. The bridge is gated and fails open: if Codex is unavailable, proceed with the Claude review alone.
If the codex-verifier spawn fails, or it reports that Bash was stripped (forked skill contexts), run bun "$HOME/.claude/src/scripts/codex-run.ts" review directly instead — never skip the cross-model pass.
Step 7: Commit (Bisectable)
Analyze the diff to decide commit strategy:
git diff --cached --stat | tail -1
Small diff (<50 lines changed across <4 files): Single commit.
git add <relevant files> git commit -m "<type>: <description>"
Larger diff: Split into ordered commits by dependency layer. Each commit must be independently valid — no broken imports, no forward references.
Commit order (skip layers with no changes):
- Infrastructure — config files, env changes, package.json, build config
- Types/interfaces — type definitions, schemas, shared interfaces
- Logic — utilities, hooks, services, lib code (group with their tests when small)
- UI — components, pages, styles (group with their tests when small)
- Tests — remaining test files not already grouped with their subjects
- Meta — docs, changelog, version bumps — always last commit
Per-commit validation: Each commit must independently pass:
npx tsc --noEmit && biome check .
If a commit would break either check in isolation, merge it with the next commit in the sequence.
Commit messages: Each gets a conventional prefix (feat:, fix:, refactor:, test:, chore:, docs:).
Step 8: Push and PR
git push origin HEAD
If gh is not available, provide the push command and instruct the user to create the PR manually.
Author the PR body — do NOT use --fill. --fill dumps the commit messages into the description, which reads as technical and over-engineered. Lead with a plain-English "What this does" (see rules/git.md "Signal, not spam"):
gh pr create --title "<type>: <concise, plain-English title>" --body "$(cat <<'EOF' ## What this does <2–3 plain sentences: what changed and why it matters — the real-world effect, not the mechanism. A teammate who didn't write it should get it on one read.> ## Summary - <technical bullet — the how> ## Test Plan - [ ] <how it was verified> EOF )"
Write "What this does" from the diff and its purpose, not by pasting commit subjects. If you can't explain it plainly, the change is unclear — say so, don't reach for bigger words.
Step 9: Watch CI Until Green (post-push)
After gh pr create, watch the PR-attached checks until all pass. Use gh pr checks as the source of truth — it covers all PR checks, not just GitHub Actions runs (which gh run list would miss).
gh pr checks --json name,bucket,state,workflow,link gh pr checks --watch --fail-fast
If a check fails:
- Identify the failing job and fetch logs (
gh run view RUN_ID --log-failedfor GHA; follow thelinkfor external services). - Reproduce the exact failing guard locally against the real built artifact before pushing a fix — run the same test script / check command CI ran, against the binary or output CI would see. A fix verified only by reasoning is a push-and-pray loop.
- Apply the smallest fix. Use the
fixskill's "Variant: Failing PR CI" if the failure is non-trivial. For version/metadata guards, use the repo's canonical script (bump-version.sh-style) — never hand-edit versioned fields; hand-bumps desync the sibling fields the script maintains. - Push, then re-read
gh pr checks— the check set can change between runs. - Repeat until green.
Guardrails:
- Scope each fix to a single failure cause.
- If failures are flaky, retry once and report flake evidence rather than chasing a phantom fix.
- If the failure is unrelated to the PR and already fixed on main, merge main into the branch instead of bloating the PR.
- Never take a watcher pipeline's exit code as the verdict — in
gh run watch ID; gh run view ID ...the shell reports the last command's exit, not the run's outcome. Read the conclusion explicitly:gh run view ID --json conclusion --jq .conclusion(orgh pr checks).
Land Mode (existing PR → merged → clean)
Invoked as /ship land or when the ask is "review/fix CI then merge then clean up" on a PR that already exists. Skip Steps 0–8; run:
- Capture the head you're validating:
gh pr view --json headRefOid,reviewDecision,mergeable. Everything below is checked against THISheadRefOid. gh pr checks— if red, run the Step 9 CI-fix loop until green. A CI fix that pushes a new commit moves the head: re-captureheadRefOidand re-check against it.- Confirm review state from step 1: if
reviewDecisionis CHANGES_REQUESTED ormergeableis CONFLICTING, stop and report — do not merge through either. - Re-validate immediately before merging —
gh pr view --json headRefOid,reviewDecision,mergeable. All three can drift while the CI loop ran (a new push movesheadRefOid; a late review flipsreviewDecisionto CHANGES_REQUESTED; a base-branch change flipsmergeable) — the head moving is not the only race. IfheadRefOiddiffers from the SHA you validated, STOP and re-run checks against the new head; ifreviewDecision/mergeableregressed, STOP and report. Don't merge stale-green. (A post-*merge* SHA check can't catch a moved head: a squash commit does not contain the PR head as an ancestor, so the guard has to run before merge. See thegh-merge-racelearning.) - Merge with the repo's preferred strategy (
gh pr merge --squash --delete-branchunless repo convention says otherwise). Branch protection / a merge queue, if enabled, is the atomic final gate. - Cleanup:
git checkout main && git pull, delete the local branch, prune remotes (git remote prune origin). Leave only main unless other branches have open PRs. - Report: PR link, merge commit, branches deleted.
Per the Autonomy Contract (CLAUDE-FULL.md): steps 5–7 are pre-approved once CI is green, the head is confirmed unchanged, and review is clean — report, don't ask. External-org repos: land mode is forbidden entirely.
Rules
- NEVER skip the type check or build step
- NEVER create a PR with failing tests
- Conventional commit messages only (
feat:,fix:,refactor:, etc.) - No AI attribution in commits or PR descriptions — see
rules/git.md. - Each bisectable commit must pass
tsc --noEmitANDbiome checkindependently - If total diff is small, single commit is fine -- don't over-split
Output
Return:
- Build status: Pass/Fail
- Test status: Pass/Fail (with count)
- Lint status: Pass/Fail
- Review status: Approved/Needs Changes
- Commits created: Count and summary of each
- PR link: URL if created