Skip to main content
command CX Codex

ship-deployment — Claude Code command: deploy, verify, roll back

The ship-deployment command completes the deployment half of /ship: it tracks Railway, Vercel or Netlify releases through dev checks and production, and reverts the merge if production fails.

MIT ★ 2,003 updated 2026-07-26

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add composio-community/awesome-claude-plugins
/plugin install ship@awesome-claude-plugins
Open on GitHub

What ship-deployment does

This command carries phases 7 through 10 of /ship. It watches the dev build on Railway, Vercel or Netlify until that build reports success, then validates the environment before touching production.

Polling loops repeat every 10 seconds and read status through the matching CLI, with jq doing the parsing. Validation means a curl request to /health, a count of error lines in recent logs, and the project's smoke-test script run against the deployed URL through SMOKE_TEST_URL. Production gets its own pass with smoke-test:prod.

Set WORKFLOW to single-branch and every one of those phases is skipped. The rollback is blunt: git reset --hard HEAD~1 plus git push --force-with-lease, which rewrites the production branch — a protected branch will reject that push.

What it helps with

  • wait out a Railway, Vercel or Netlify build instead of refreshing the dashboard
  • gate the production merge on a /health response from dev
  • stop a release when the log error count crosses the limit
  • run the project's own smoke-test script against the deployed URL
  • undo the production merge when post-deploy checks fail

Example prompts for the agent

  • Run /ship-deployment and take this release from dev all the way to production.
  • Hold the prod merge if /health on dev doesn't answer 200.
  • Roll production back with /ship-deployment, the smoke tests failed.

How to install ship-deployment

1Plugin marketplace

/plugin marketplace add composio-community/awesome-claude-plugins
/plugin install ship@awesome-claude-plugins

2Manually: put the files in place

.claude/commands/ship-deployment.md

Call it with /ship-deployment. For all projects use ~/.claude/commands/

Questions about ship-deployment

How do I install ship-deployment in Claude Code?

Add the marketplace with /plugin marketplace add composio-community/awesome-claude-plugins, then install the plugin: /plugin install ship@awesome-claude-plugins.

What does ship-deployment do?

It runs the release in stages: dev deploy, /health and log checks, merge into the production branch, production validation, and a rollback if anything fails.

What has to be installed for the checks to work?

The CLI for your platform (railway, vercel or netlify), plus jq, curl and git. Smoke tests only run when package.json defines a smoke-test script.

Source text

ship-deployment.md · MIT
# Phases 7-10: Deploy & Validate - Reference

This file contains platform-specific deployment and validation for `/ship`.

**Parent document**: `ship.md`

**Note**: Skip all phases if `WORKFLOW="single-branch"`.

## Phase 7: Deploy to Development

### Railway

```bash
if [ "$DEPLOYMENT" = "railway" ]; then
  echo "Waiting for Railway development deployment..."

  SERVICE_NAME=$(railway service list --json | jq -r '.[0].name')
  DEPLOY_ID=$(railway deployment list --service $SERVICE_NAME --json | jq -r '.[0].id')

  while true; do
    STATUS=$(railway deployment get $DEPLOY_ID --json | jq -r '.status')

    if [ "$STATUS" = "SUCCESS" ]; then
      DEV_URL=$(railway domain list --service $SERVICE_NAME --json | jq -r '.[0].domain')
      echo "[OK] Deployed to development: https://$DEV_URL"
      break
    elif [ "$STATUS" = "FAILED" ]; then
      echo "[ERROR] Development deployment failed"
      railway logs --deployment $DEPLOY_ID
      exit 1
    fi

    sleep 10
  done
fi
```

### Vercel

```bash
if [ "$DEPLOYMENT" = "vercel" ]; then
  echo "Waiting for Vercel development deployment..."

  DEPLOY_URL=$(vercel ls --json | jq -r '.[0].url')

  while true; do
    STATUS=$(vercel inspect $DEPLOY_URL --json | jq -r '.readyState')

    if [ "$STATUS" = "READY" ]; then
      echo "[OK] Deployed to development: https://$DEPLOY_URL"
      DEV_URL="https://$DEPLOY_URL"
      break
    elif [ "$STATUS" = "ERROR" ]; then
      echo "[ERROR] Development deployment failed"
      vercel logs $DEPLOY_URL
      exit 1
    fi

    sleep 10
  done
fi
```

### Netlify

```bash
if [ "$DEPLOYMENT" = "netlify" ]; then
  echo "Waiting for Netlify development deployment..."

  SITE_ID=$(netlify status --json | jq -r '.site_id')
  DEPLOY_ID=$(netlify api listSiteDeploys --data "{ \"site_id\": \"$SITE_ID\" }" | jq -r '.[0].id')

  while true; do
    STATUS=$(netlify api getDeploy --data "{ \"deploy_id\": \"$DEPLOY_ID\" }" | jq -r '.state')

    if [ "$STATUS" = "ready" ]; then
      DEV_URL=$(netlify api getDeploy --data "{ \"deploy_id\": \"$DEPLOY_ID\" }" | jq -r '.deploy_ssl_url')
      echo "[OK] Deployed to development: $DEV_URL"
      break
    elif [ "$STATUS" = "error" ]; then
      echo "[ERROR] Development deployment failed"
      exit 1
    fi

    sleep 10
  done
fi
```

### Generic / Unknown

```bash
if [ -z "$DEPLOYMENT" ] || [ "$DEPLOYMENT" = "null" ]; then
  echo "No deployment platform detected"
  echo "Assuming merge to $MAIN_BRANCH means deployment"
  DEV_URL="N/A"
fi
```

## Phase 8: Validate Development

### Health Check

```bash
echo "Running smoke tests on development..."

# Wait for deployment to stabilize
sleep 30

# Basic health check
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" $DEV_URL/health || echo "000")

if [ "$HTTP_STATUS" = "200" ] || [ "$HTTP_STATUS" = "301" ] || [ "$HTTP_STATUS" = "302" ]; then
  echo "[OK] Health check passed: $HTTP_STATUS"
else
  echo "[ERROR] Health check failed: $HTTP_STATUS"
  echo "Investigate deployment issues before proceeding to production"
  exit 1
fi
```

### Error Log Monitoring

```bash
echo "Checking logs for errors..."

if [ "$DEPLOYMENT" = "railway" ]; then
  ERROR_COUNT=$(railway logs --tail 100 | grep -iE "(error|exception|fatal)" | wc -l)
elif [ "$DEPLOYMENT" = "vercel" ]; then
  ERROR_COUNT=$(vercel logs $DEV_URL --since 5m | grep -iE "(error|exception|fatal)" | wc -l)
elif [ "$DEPLOYMENT" = "netlify" ]; then
  ERROR_COUNT=$(netlify logs --since 5m | grep -iE "(error|exception|fatal)" | wc -l)
else
  ERROR_COUNT=0
fi

if [ "$ERROR_COUNT" -gt 10 ]; then
  echo "[ERROR] High error rate detected: $ERROR_COUNT errors in last 5 minutes"
  echo "Review logs before proceeding to production"
  exit 1
else
  echo "[OK] Error rate acceptable: $ERROR_COUNT errors"
fi
```

### Project Smoke Tests

```bash
if jq -e '.scripts["smoke-test"]' package.json > /dev/null 2>&1; then
  echo "Running project smoke tests..."

  export SMOKE_TEST_URL=$DEV_URL
  $PACKAGE_MGR run smoke-test

  if [ $? -eq 0 ]; then
    echo "[OK] Smoke tests passed"
  else
    echo "[ERROR] Smoke tests failed"
    exit 1
  fi
fi
```

### Validation Summary

```markdown
## Development Validation [OK]

**URL**: ${DEV_URL}
**Health Check**: [OK] ${HTTP_STATUS}
**Error Rate**: [OK] ${ERROR_COUNT} errors
**Smoke Tests**: [OK] Passed

Proceeding to production...
```

## Phase 9: Deploy to Production

### Merge to Production Branch

```bash
echo "Merging $MAIN_BRANCH → $PROD_BRANCH..."

git checkout $PROD_BRANCH
git pull origin $PROD_BRANCH

git merge $MAIN_BRANCH --no-edit

if [ $? -ne 0 ]; then
  echo "[ERROR] Merge to production failed (conflicts)"
  git merge --abort
  exit 1
fi

git push origin $PROD_BRANCH

if [ $? -eq 0 ]; then
  PROD_SHA=$(git rev-parse HEAD)
  echo "[OK] Production branch at: $PROD_SHA"
else
  echo "[ERROR] Push to production failed"
  exit 1
fi
```

### Wait for Production Deployment

Same platform-specific logic as Phase 7, but targeting production environment.

```bash
echo "Waiting for production deployment..."

# Platform-specific deployment monitoring
# (Similar to Phase 7)

echo "[OK] Deployed to production: $PROD_URL"
```

## Phase 10: Validate Production

### Conservative Validation

```bash
echo "Validating production deployment..."

# Wait longer for production to stabilize
sleep 60

# Health check
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" $PROD_URL/health || echo "000")

if [ "$HTTP_STATUS" = "200" ] || [ "$HTTP_STATUS" = "301" ] || [ "$HTTP_STATUS" = "302" ]; then
  echo "[OK] Production health check: $HTTP_STATUS"
else
  echo "[ERROR] Production health check failed: $HTTP_STATUS"
  rollback_production
fi
```

### Production Error Monitoring

```bash
echo "Monitoring production logs..."

if [ "$DEPLOYMENT" = "railway" ]; then
  ERROR_COUNT=$(railway logs --tail 100 | grep -iE "(error|exception|fatal)" | wc -l)
elif [ "$DEPLOYMENT" = "vercel" ]; then
  ERROR_COUNT=$(vercel logs $PROD_URL --since 5m | grep -iE "(error|exception|fatal)" | wc -l)
fi

if [ "$ERROR_COUNT" -gt 20 ]; then
  echo "[ERROR] CRITICAL: High error rate in production: $ERROR_COUNT errors"
  rollback_production
else
  echo "[OK] Production error rate acceptable: $ERROR_COUNT errors"
fi
```

### Production Smoke Tests

```bash
if jq -e '.scripts["smoke-test:prod"]' package.json > /dev/null 2>&1; then
  echo "Running production smoke tests..."

  export SMOKE_TEST_URL=$PROD_URL
  $PACKAGE_MGR run smoke-test:prod

  if [ $? -ne 0 ]; then
    echo "[ERROR] Production smoke tests failed"
    rollback_production
  fi
fi
```

## Rollback Mechanism

**Triggered automatically on any production validation failure.**

```bash
rollback_production() {
  echo "========================================"
  echo "ROLLBACK INITIATED"
  echo "========================================"
  echo "WARNING: Force pushing to $PROD_BRANCH to revert"

  git checkout $PROD_BRANCH
  git reset --hard HEAD~1

  # Use --force-with-lease for safety
  if ! git push --force-with-lease origin $PROD_BRANCH; then
    echo "[ERROR] Force push failed - remote may have unexpected changes"
    echo "Manual intervention required"
    exit 1
  fi

  echo "[OK] Rolled back production to previous deployment"
  echo "Previous version will redeploy automatically"

  # Wait for rollback deployment
  sleep 30

  # Verify rollback succeeded
  HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" $PROD_URL/health || echo "000")
  if [ "$HTTP_STATUS" = "200" ]; then
    echo "[OK] Rollback successful, production is healthy"
  else
    echo "[WARN] Rollback deployed but health check unclear"
    echo "Manual investigation required"
  fi

  exit 1
}
```

## Platform Detection Reference

The `detect-platform.js` script returns:

```json
{
  "ci": "github-actions|gitlab-ci|circleci|jenkins|travis|null",
  "deployment": "railway|vercel|netlify|heroku|null",
  "branchStrategy": "single-branch|multi-branch",
  "mainBranch": "main|master",
  "projectType": "nodejs|python|rust|go",
  "packageManager": "npm|yarn|pnpm|pip|cargo"
}
```

Use these values to adapt deployment monitoring to your specific platform.

© Community · MIT · composio-community/awesome-claude-plugins

Similar slash commands

All slash commands for DevOps and infrastructure →

From the same set68

The whole set →
ship-error-handling The ship-error-handling command documents how to recover /ship from CI failures, merge conflicts, deployment errors, and other shipping problems. CX Codex +1 ★ 2,003repo stars backend-architect backend-architect — a subagent for designing APIs, server-side logic, databases, and scalable backend systems. CX Codex ★ 2,003repo stars frontend-developer The frontend-developer subagent for Claude Code builds responsive components in React, Vue, or Angular and tunes frontend rendering performance. CX Codex ★ 2,003repo stars add-sub add-sub creates a skill-event subscription, so context lands before or after a skill runs, gated on files, git branch or environment variables. CX Codex +1 ★ 2,003repo stars test-writer-fixer test-writer-fixer creates missing test suites, runs test runners after code changes, and updates failing checks. It keeps your test suite aligned with refactored logic. CX Codex ★ 2,003repo stars audit-project audit-project is a Claude Code command that reviews projects with specialized agents and can apply fixes before rechecking changed files. It helps find issues in code and tests. CX Codex +1 ★ 2,003repo stars help help prints skill-bus status plus its slash-command list. Add advanced to get the longer reference on settings and conditions. CX Codex +1 ★ 2,003repo stars onboard The onboard command for Claude Code configures skill-bus by discovering repository documents, routing them to skills through subscriptions, and enabling local telemetry. CX Codex +1 ★ 2,003repo stars

Project sponsors

Companies that keep this analytics open