Commit, push, and create a PR in one step. Use when the user says ’ship’, ’ship it’, ’/ship’, ’提交PR’, ’发PR’, or wants to commit + push + create a pull request in a single action.
npx playbooks add skill qiaoshouqing/skills --skill ship
Ship your changes with a single command. Auto-generates commit messages, pushes to remote, and creates a pull request with a detailed description.
git --version || { echo "ERROR: git not found"; exit 1; }
gh --version || { echo "ERROR: gh CLI not found. Install: brew install gh"; exit 1; }
gh auth status || { echo "ERROR: gh not authenticated. Run: gh auth login"; exit 1; }
git rev-parse --is-inside-work-tree || { echo "ERROR: Not a git repository"; exit 1; }
git remote -v | grep -q origin || { echo "ERROR: No remote 'origin' configured"; exit 1; }
If any prerequisite fails, report the error with the fix command and stop.
Run the prerequisite checks above. If any fail, inform the user of the specific error and provide the fix command. Do NOT proceed until all pass.
# Check for changes
git status --short
# Get current branch
git branch --show-current
# Get diff stats for commit message generation
git diff --stat
git diff --cached --stat
# Check recent commit style
git log --oneline -5
If no changes exist (git status --short is empty AND no staged changes), inform the user "Nothing to ship - working tree is clean" and stop.
CURRENT_BRANCH=$(git branch --show-current)
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo "main")
If on main/master/default branch:
<type>/<short-slug>feat, fix, refactor, docs, chore, style, testgit checkout -b "<type>/<slug>"
If already on a feature branch: Continue on the current branch.
If on detached HEAD: Inform user and suggest creating a branch first. Stop.
git add -A
Generate a commit message by analyzing the staged diff:
git diff --cached to understand the changes| Changes Pattern | Type |
|----------------|------|
| New files/features added | feat |
| Bug fix patterns | fix |
| Restructuring without behavior change | refactor |
| Documentation/comments only | docs |
| Test files only | test |
| Config/build files | chore |
| CSS/styling only | style |
<type>(<scope>): <description> (subject line < 72 chars)# Commit with the generated message (use HEREDOC for multi-line)
git commit -m "$(cat <<'EOF'
<type>(<scope>): <subject>
<optional body>
EOF
)"
# Push with upstream tracking
git push -u origin "$(git branch --show-current)"
If push is rejected (non-fast-forward): Inform user and suggest git pull --rebase origin <branch>. Do NOT force push.
Detect draft mode: If user mentioned "draft", "--draft", or "草稿", add --draft flag.
# Determine base branch
BASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo "main")
# Check if PR already exists
EXISTING_PR=$(gh pr list --head "$(git branch --show-current)" --json url --jq '.[0].url' 2>/dev/null)
If PR already exists: Inform user and show the existing PR URL. Stop.
Otherwise, create the PR:
gh pr create \
--base "$BASE_BRANCH" \
--title "<PR title>" \
--body "$(cat <<'EOF'
## Summary
<1-3 sentence overview of what this PR does and why>
## Changes
| File | Change |
|------|--------|
| `path/to/file` | Description of change |
| ... | ... |
## Impact Analysis
- **Scope**: <What areas are affected>
- **Risk**: <Low/Medium/High>
- **Breaking changes**: <None or description>
- **Dependencies**: <New deps added, if any>
## Test Plan
- [ ] <Specific test step>
- [ ] Verify no regressions
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)" [--draft]
PR body generation rules:
Display the final result:
✅ Shipped!
Branch: <branch-name>
Commit: <short-hash> - <commit subject>
PR: <pr-url> [draft]
Files: <n> changed (+<additions>, -<deletions>)
| Error | Cause | Solution |
|-------|-------|----------|
| git: command not found | Git not installed | brew install git or xcode-select --install |
| gh: command not found | GitHub CLI not installed | brew install gh |
| gh auth status fails | Not authenticated | gh auth login |
| not a git repository | Not in a repo | Navigate to a git repository |
| No remote 'origin' | No remote configured | git remote add origin <url> |
| rejected - non-fast-forward | Remote has new changes | git pull --rebase origin <branch> then retry |
| gh pr create 422 error | PR already exists | Show existing PR URL |
| permission denied | No write access | Check repo permissions |
| branch already exists on remote | Name conflict | Append suffix: feat/slug-2 |
| Detached HEAD | Not on a branch | git checkout -b <branch-name> first |
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.