Ship

From eddiebelaval/squire · View interactive version

Ship is an AI agent skill from the GitHub repository eddiebelaval/squire. Full delivery pipeline — preflight, commit, push, PR, merge in one command

How to use this skill

Skill file

Ship — Full Delivery Pipeline

Stage, commit, push, PR, merge, and verify — end-to-end shipping in one command. Respects all CLAUDE.md rules (preflight, no squash, regular merges, branch protection).

Core Workflows

Workflow 1: Full Ship (Default)

  1. Detect context (project, branch, base)
  2. Run preflight checks (typecheck, build, lint, tests)
  3. Stage and commit changes
  4. Push to remote
  5. Create PR
  6. Merge (regular merge, no squash)
  7. Verify merge succeeded

Usage

/ship                          # Ship current branch changes with auto-generated commit message
/ship "feat: add auth flow"    # Ship with explicit commit message
/ship --no-merge               # Create PR but don't merge (for review)
/ship --base dev               # Target a specific base branch (default: main)
/ship --dry-run                # Show what would happen without doing anything

Instructions

Step 0: Detect Context

  1. Identify: project name, current branch, base branch (default: main).
  2. State: "Shipping [PROJECT] | Branch: [BRANCH] -> [BASE]"
  3. If on main — STOP. "Cannot ship from main. Create a feature branch first."
  4. If working tree is clean and no commits ahead of base — STOP. "Nothing to ship."

Step 1: Preflight Checks (MANDATORY)

Run ALL checks before proceeding. If any fail, fix them before continuing.

# 1. Type check (TypeScript projects)
npx tsc --noEmit 2>&1

# 2. Build
npm run build 2>&1

# 3. Lint (if available)
npm run lint 2>&1

# 4. Tests (if available)
npm test -- --passWithNoTests 2>&1

For Python projects, substitute:

python -m py_compile <changed_files>
pytest -x -q 2>&1

If any check fails:

If --dry-run: Show preflight results and exit.

Step 2: Stage and Commit

  1. Check git status for unstaged/untracked changes.
  2. Stage relevant files (prefer specific files over git add -A):
  1. If no commit message was provided in args:
  1. If a commit message WAS provided, use it exactly (still append Co-Authored-By).

Use HEREDOC for the commit message:

git commit -m "$(cat <<'EOF'
commit message here

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
EOF
)"

Step 3: Push

  1. Check if branch has an upstream: git rev-parse --abbrev-ref @{upstream} 2>/dev/null
  2. If no upstream: git push -u origin [BRANCH]
  3. If upstream exists: git push
  4. Verify push succeeded.

Step 4: Create PR

  1. Check if a PR already exists for this branch: gh pr list --head [BRANCH] --state open
  2. If PR exists: skip creation, show existing PR URL.
  3. If no PR:

```

## Summary

<1-3 bullet points from the diff>

## Verification

Generated with Claude Code

```

Step 5: Merge (unless --no-merge)

  1. Wait for CI checks if any are running: gh pr checks [PR_NUMBER] --watch
  1. NEVER squash merge. Always use: gh pr merge [PR_NUMBER] --merge
  2. If merge fails (conflicts, failed checks):

Step 6: Cleanup and Report

  1. After successful merge:
  1. Output final report:
Ship Complete
=============
Branch:  [BRANCH] -> [BASE]
Commit:  [SHORT_SHA] [message]
PR:      [URL]
Merged:  YES/NO
Build:   PASS
Tests:   PASS/SKIPPED

Cleanup: local branch deleted, remote branch deleted

If --no-merge:

PR Created (not merged)
=======================
Branch:  [BRANCH] -> [BASE]
Commit:  [SHORT_SHA] [message]
PR:      [URL]
Status:  Ready for review

Merge manually: gh pr merge [NUMBER] --merge

Rules

| Rule | Why |

|------|-----|

| NEVER ship from main | Branch protection — always use feature branches |

| NEVER squash merge | Preserves granular commit history (CLAUDE.md rule) |

| Preflight is mandatory | Build/test/lint must pass before push |

| Never stage secrets | .env, credentials, API keys stay local |

| Never force merge | If it conflicts, Eddie decides |

| Always use --merge flag | Regular merges, not squash or rebase |

| Report PR URL | Eddie needs the link for tracking |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.