AgentSkillsCN

shipping-worktree

交付工作树:审阅变更,按逻辑分组提交,创建 PR,合并代码,清理工作树与分支。当用户需要“交付工作树”“落地工作树”“ship-worktree”,或在 Git 工作树中完成收尾工作时,可使用此功能。若仅需提交变更,则可改用 committing-changes。

SKILL.md
--- frontmatter
name: shipping-worktree
description: >-
  Ships a worktree: reviews changes, commits in logical groups, creates PR,
  merges, cleans up worktree+branch. Use when "ship worktree", "land worktree",
  "ship-worktree", or finishing work in a git worktree. For commits only,
  use committing-changes instead.
invoke_with:
- /ship-worktree
allowed-tools: Bash(git *), Read, Write, Edit, Grep, Glob

Current State

!git status 2>/dev/null !git diff --stat 2>/dev/null !git log --oneline -5 2>/dev/null

<role> WHO: Worktree landing controller ATTITUDE: Ship clean or don't ship. No orphaned worktrees. </role> <purpose> Your job is to land a worktree's work — from dirty working tree to merged PR to deleted worktree — with user confirmation at every gate. </purpose> <workflow>

Phase 0: Detect Worktree

Read and follow steps/detect-worktree.md.

Phase 1: Review Changes

Read and follow steps/review-changes.md.

Phase 2: Commit Uncommitted Work

Read and follow steps/commit.md.

Phase 3: Create PR

Read and follow steps/create-pr.md.

Phase 4: Merge and Cleanup

Read and follow steps/merge-cleanup.md.


Checkpoint

xml
<checkpoint>
  <verify>Worktree detected and validated? [YES/NO]</verify>
  <verify>All changes committed with user approval? [YES/NO]</verify>
  <verify>PR created with user-approved title/body? [YES/NO]</verify>
  <verify>Merge + cleanup completed? [YES/NO]</verify>
  <conclusion>{PR URL} merged. Worktree {path} removed.</conclusion>
</checkpoint>
</workflow> <rules> - Never commit, create PR, merge, or delete without explicit user confirmation. - Never force-push. Never force-delete without showing what's being deleted. - If CWD is not a worktree, stop immediately. Don't guess paths. - Squash merge is default. Clean history on main. - cd back to main repo BEFORE removing the worktree — otherwise the shell breaks. - If merge conflicts: show the error, don't attempt auto-resolution. User decides. - Commit messages use conventional commits (feat:, fix:, refactor:, etc.). - PR title matches the primary commit or summarizes the branch's work. </rules>