ship-it
Wrap up a finished round of work — verify README and CHANGELOG are current, cut a version if warranted, move completed task files into the completed/ folder, then create a feature branch if needed, commit, push, and open a PR. Run after `/fsad-harness:do-task` has marked one or more tasks done. Takes no arguments.
- License 许可
- MIT
- 最近更新
- 2026-10-12
- Stars
- ★ 4
- Forks
- 0
01 前言 Front Matter
- description
- Wrap up a finished round of work — verify README and CHANGELOG are current, cut a version if warranted, move completed task files into the completed/ folder, then create a feature branch if needed, commit, push, and open a PR. Run after `/fsad-harness:do-task` has marked one or more tasks done. Takes no arguments.
- allowed-tools
- Bash(git worktree:*), Bash(git -C:*), Bash(git merge:*), Bash(git merge-base:*), Bash(git add:*), Bash(git commit:*), Bash(git branch:*), Bash(git mv:*), Bash(git rev-parse:*), Bash(git checkout:*), Bash(git push:*), Bash(git pull:*), Bash(git status:*), Bash(git log:*), Bash(git remote:*), Bash(git ls-remote:*), Bash(gh pr create:*), Bash(gh pr view:*), Bash(gh pr list:*)
03 SKILL.md 正文
fsad-harness:ship-it — wrap up and ship
You run four sequential phases to close out a batch of completed work: worktree merge (Step 0.5), pre-flight audits — README/CHANGELOG/version/completed-task cleanup (Step 1), commit + push + PR (Step 2), and verify-shipped (Step 3). Do not skip phases or reorder them.
"Shipped" means all three of the following verifiable predicates hold — not that a phase list was walked:
- Remote-HEAD parity — the pushed branch's remote SHA (
git ls-remote) equals localHEAD. - PR existence —
gh pr viewconfirms a PR exists for this branch and targets the default branch. - Version-string consistency — every file in
cfg.version_filescarries the identical new version string (when a version was cut).
Step 3 (Verify shipped) checks all three explicitly before the skill reports success — see that step for details.
Step 0 — Detect the project
- Determine the current working directory.
- Read
~/.claude/commands/fsd/projects.yaml. - Match cwd against each project's
match_paths(expand~). Prefer the longest (most specific) match if multiple match. - If a project matches, refer to its entry as
cfgand the resolved project root asproject_root. Proceed. - If no project matches:
- Tell the user the project is not registered.
- Suggest running
/fsad-harness:add-taskfrom the project to register it. - Stop.
Step 0.5 — Merge pending worktrees
- Run
git worktree list --porcelainfromproject_root. Parse the output to get all worktrees (each block starts withworktree <path>). - Filter out the main worktree — the one whose path equals
project_root. - If no additional worktrees exist: skip this step entirely and proceed to Step 1.
- If additional worktrees exist:
- List them for the user: path and branch name (the
branchfield from the porcelain output), plus each branch's uncommitted-changes status (git -C <path> status --porcelain, summarized as "clean" or "N uncommitted files"). - Stop and ask for explicit confirmation before touching anything:
"About to merge {N} worktree branch(es) into
{project_root}: {list}. For each: commit any uncommitted changes,git merge --no-ff <branch>, verify the merge landed, then force-remove the worktree and delete the branch. Proceed? (y/n)" - If the user declines: stop here. Do not modify or remove any worktree. Report which worktrees remain pending.
- On confirmation, for each worktree in order:
a. Check for uncommitted changes:
git -C <path> status --porcelain. If any are present, commit them:git -C <path> add -A && git -C <path> commit -m "<branch-name>: parallel do-task changes". b. Merge the branch into the main worktree:git merge --no-ff <branch>. c. If the merge produces a conflict: stop immediately. Tell the user which file(s) conflict and provide these resolution steps:- Open each conflicting file and locate the conflict markers (
<<<<<<<,=======,>>>>>>>). - Edit the file to keep the correct content and remove all conflict markers.
- Stage each resolved file:
git add <file>. - Complete the merge commit:
git commit. - Re-run
fsad-harness:ship-itto continue from where it left off. Do not proceed to Step 1. Do not remove the worktree — it may still hold the only copy of unmerged work. d. Verify the merge landed before removing anything: rungit merge-base --is-ancestor <branch> HEAD. Exit code0means the branch tip is now reachable fromHEAD— the merge is confirmed in the main tree.
- If this check fails (non-zero exit): stop immediately. Do not remove the worktree or delete the branch — the merge did not land as expected and the worktree is the only safe copy of that work. Report the branch name and ask the user how to proceed.
- If this check passes: only now remove the worktree (
git worktree remove --force <path>) and delete the branch (git branch -d <branch>).
- Open each conflicting file and locate the conflict markers (
- List them for the user: path and branch name (the
- After all worktrees are merged, verified, and removed: tell the user "Worktrees merged." and proceed to Step 1.
Step 1 — Pre-flight audits (run concurrently)
These three checks are read-only and independent of each other — none needs another's output. Dispatch them as concurrent subagents (or, if subagents aren't available in the current context, run the three read passes back-to-back with no dependency ordering between them) rather than sequentially:
- Audit A — README ↔ skills-table consistency: List all subdirectories in
{project_root}/skills/(each is a skill). Read{project_root}/README.md. For every skill directory, check a corresponding row exists in the README skills table (match on directory name). Report any skills missing from the README. - Audit B — CHANGELOG/version derivation: Read
{project_root}/CHANGELOG.md. Find the## [Unreleased]section and collect everything between that heading and the next## [heading (the pending content). Readcfg.version_schemeandcfg.version_files; if set, read the first file in the list and extract the current version string (JSON"version"field, README version-table row, or HTML<title>). Report: pending CHANGELOG content (or "empty"), current version scheme, and current version string. - Audit C — completed-task cross-reference: Scan
{project_root}/{cfg.task_dir}/for files matching the task filename pattern (e.g.task-proj-NNN.md) not already insidecompleted/. For each, look up the corresponding identifier incfg.todo_file:- [x]→ candidate to move;- [ ]or not found → leave in place. Report the candidate list.
Once all three audits report back, apply their results serially (writes must stay serial even though the reads were concurrent):
1a — README check
- If Audit A found missing skills: tell the user which ones (e.g.
ship-it,next). Ask them to update the README before continuing. Stop — do not proceed until the user confirms it's done and re-invokes. - If clean: tell the user "README check passed." and proceed.
1b — CHANGELOG + version
- If Audit B's pending content is empty (no bullets/subsections):
- Tell the user: "The [Unreleased] section has no content — there may be nothing to release. Proceed anyway? (y/n)"
- No → stop. Yes → skip the version-bump sub-steps and go to 1c.
- If Audit B's pending content is non-empty:
- Show the user the pending content.
- Propose next version based on
cfg.version_scheme(from Audit B):semver: bump the patch component by default (e.g.,v3.2.0 → v3.2.1). Tell the user they can typeminorormajorfor a different bump level.integer: increment the integer suffix by 1 (e.g.,v36 → v37).calver: use today's date inYYYY.MM.DDformat.- No
version_schemeconfigured: ask "Cut a new version? If yes, what tag? (e.g. v4)" and use whatever they provide.
- Confirm: Present "Suggested version: [tag] — confirm, type a different tag, or type
noto skip."no/skip → proceed to 1c without modifying CHANGELOG or version files.minor/major(semver only) → recompute at that level and re-present.- Confirmed/different tag → use that tag and continue.
- Write version files: update every file in
cfg.version_fileswith the new version string, preserving each file's existing format (JSON"version"field, README table row, HTML<title>). - Update CHANGELOG: replace
## [Unreleased]with## [vN] — YYYY-MM-DD(today's date), insert a fresh empty## [Unreleased]block above it, write the file. Tell the user "CHANGELOG updated — [vN] cut."
1c — Move completed task files
- If Audit C found no candidates: tell the user "No completed task files to move." and proceed to Step 2.
- If candidates exist: tell the user "Moving these to
completed/:" followed by the list, thengit mveach file into{project_root}/{cfg.task_dir}/completed/.
Step 2 — Commit, push, PR
2.0 — Branch guard
- Run
git rev-parse --abbrev-ref HEADto get the current branch name. - If the branch is
mainormaster:- Propose a feature branch name:
- If a version was cut in Step 1: suggest
release/{version}(e.g.release/v4). - Otherwise: suggest
task/{task-ids}using any task IDs marked done during this session (e.g.task/proj-007), orship/{YYYY-MM-DD}if no IDs are in scope.
- If a version was cut in Step 1: suggest
- Ask the user: "Create and switch to
{branch}? (y/n or type a different name)" - On confirmation: run
git checkout -b {branch}.
- Propose a feature branch name:
- If already on a non-default branch:
- Tell the user "Already on branch
{branch}." - If a version was cut in Step 1 and the current branch matches the pattern
release/vX.Y.ZandvX.Y.Zdoes not equal the newly cut version:- Propose renaming: "Branch name
{branch}is stale — rename torelease/{version}? (y/n)" - If yes:
a.
git branch -m {branch} release/{version}— rename locally. b.git push origin release/{version}— push the new name. c.git push origin --delete {branch}— delete the old remote branch (ignore error if it didn't exist remotely). d.git branch -u origin/release/{version}— update tracking ref. e. Tell the user "Branch renamed torelease/{version}." - If no: continue on the current branch name.
- Propose renaming: "Branch name
- Otherwise: continue without renaming.
- Tell the user "Already on branch
2.1 — Independent pre-PR checklist verifier
Before committing, run one more fresh, independent read pass over the three Pre-PR Checklist items (README, CHANGELOG, version files — see CLAUDE.md's Pre-PR Checklist section if present). This pass must re-read the files from disk, not reuse conclusions from Step 1 — the point is to catch a mistake the same pass that wrote them could have missed:
- Re-read
{project_root}/CHANGELOG.md: confirm the change has an entry either under## [Unreleased]or in a freshly cut version block. - Re-read
{project_root}/README.md: confirm the version table's Current version and Date match what's being shipped (if a version was cut). - Re-read every file in
cfg.version_files: confirm all carry the identical new version string (if a version was cut). - If any mismatch is found: report it to the user and stop — do not commit with a known Pre-PR Checklist violation. Ask whether to fix it now or abort.
- If all three check out: tell the user "Pre-PR checklist verified independently." and proceed.
2.2 — Commit
- Run
git statusto see what's staged and unstaged. Stage all relevant changed files by name (do not usegit add -Aorgit add .):- Modified:
CHANGELOG.md,README.md, todo file, any other files changed during this work session. - Moved task files (already staged by
git mv).
- Modified:
- Run
git log --oneline -5to read recent commit message style. - Draft a commit message:
- If a version was cut in Step 1: use
release [vN] — <one-line summary of what's in the release>. - If no version was cut: summarize the batch of completed work in one line.
- Append
Co-Authored-By:with the current model's name and provider, derived at runtime from the executing session (e.g. the model identifying itself in this conversation) — never hardcode a specific model name/version in the skill file itself, since that goes stale every time the underlying model changes. - Pass via heredoc to avoid shell quoting issues.
- If a version was cut in Step 1: use
- Show the user the draft commit message and ask for confirmation before committing.
- On confirmation: create the commit.
2.3 — Push, with verify-and-retry
- Record the local HEAD SHA:
git rev-parse HEAD. - Push:
git push -u origin HEAD. - Verify the push landed:
git ls-remote origin {branch}and compare the remote SHA to the local HEAD SHA from step 1.- Match: push confirmed, continue to 2.4.
- Mismatch or push failed: retry, capped at 2–3 attempts:
a. If the remote moved ahead (someone else pushed):
git pull --rebasethen re-push. b. If the push was simply rejected/failed transiently: re-push directly. c. After each retry, re-checkgit ls-remoteagainst the (possibly updated) local HEAD. - If still mismatched after the retry cap: stop and ask the user how to proceed. Do not silently continue as if the push succeeded.
2.4 — Create PR, with verify-and-fallback
- Detect the default branch:
git remote show origin | grep 'HEAD branch' | awk '{print $NF}'(typicallymainormaster). - Create PR with
gh pr create:- Title: same one-liner used in the commit.
- Include
--base {default_branch}so the PR always targets the default branch. - Body (heredoc):
## Summary <CHANGELOG content for this version, or a bullet-list summary if no version was cut> ## Test plan - [ ] Skill files deployed and appear in `/fsad-harness:*` command list - [ ] README skills table is accurate - [ ] CHANGELOG entry is present and correctly formatted 🤖 Generated with [Claude Code](https://claude.com/claude-code)
- Verify the PR actually exists — do not trust
gh pr create's exit code alone: rungh pr view --json url,state,baseRefNamefor the current branch.- If it returns a PR with the expected base branch: confirmed. Record the URL.
- If
gh pr createreported failure because a PR already exists for this branch: rungh pr list --head {branch} --json url,state,baseRefNameto find the existing PR and report it instead of treating this as an error. - If neither check turns up a PR: stop and tell the user PR creation could not be confirmed — do not report a PR URL that wasn't actually verified.
- Proceed to Step 3 (Verify shipped) once the PR is confirmed.
Step 3 — Verify shipped
Confirm the three "shipped" predicates from the top of this document, using fresh checks (not assumptions carried over from Step 2):
- Remote-HEAD parity:
git ls-remote origin {branch}— the returned SHA must equalgit rev-parse HEAD. PASS/FAIL. - PR existence:
gh pr view --json url,state,baseRefName— must return a PR targeting the default branch. PASS/FAIL. - Version-string consistency (only if a version was cut in Step 1): re-read every file in
cfg.version_filesand confirm they all carry the identical new version string. PASS/FAIL.
Report all three verdicts to the user. If any predicate fails, say so explicitly — do not report the work as "shipped" on a partial result. Only report success when all applicable predicates pass.
04 同仓库更多 Skills
verify-ac
暂无简介
spec-review
暂无简介
ship
Short alias for /fsad-harness:ship-it. Wrap up finished work, cut a version, commit, push, and open a PR.
set-context
暂无简介
sec-review-team
暂无简介
sec-review-fixes
暂无简介