/devops-pipeline:land-and-deploy [pr-number] [production-url]from devops-pipeline
Merges an existing PR after a readiness gate, waits for CI, verifies deployment, and runs a production health check.
Ships in devops-pipeline. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Complete landing pipeline: merge the PR, wait for CI, verify the deployment, run a health check.
Starts from an existing PR: merges it and verifies production. /ship is only a readiness checklist: it does not commit, push or create the PR.
Non-interactive by default. The user said "land it", so land it. Stop only for the readiness gate, hard blockers, and before pushing a revert.
# Verify GitHub CLI is authenticated
gh auth status
# Set PR once: the number from the arguments, otherwise the current branch's PR
PR="<pr-number from the arguments, or empty>"
[ -n "$PR" ] || PR=$(gh pr view --json number -q .number)
gh pr view "${PR:?no PR found}" --json number,state,title,url,mergeStateStatus,mergeable,baseRefName,headRefName,headRefOid
Shell variables do not persist between separate Bash calls: set PR to that number again in each later block. Keep the ${PR:?} guard, because gh pr merge without an argument selects the current branch's PR.
Staleness, tests and the docs diff run on the local checkout, so it must be the PR's head:
HEAD_OID=$(gh pr view "${PR:?}" --json headRefOid -q .headRefOid)
[ "$(git rev-parse HEAD)" = "$HEAD_OID" ] && [ -z "$(git status --porcelain)" ] || {
echo "BLOCKED: the checkout is not a clean copy of the head of PR #$PR"
exit 1
}
If blocked, stop and tell the user (gh pr checkout <number> switches to the PR branch).
Stop conditions:
gh auth login first"gh pr create)."# Check current CI status
gh pr checks "${PR:?}" --json name,state,bucket,workflow
# Check for merge conflicts
gh pr view "${PR:?}" --json mergeable -q .mergeable
Stop conditions:
mergeable is CONFLICTING → "PR has merge conflicts. Resolve them and push before landing."# Watch CI checks with 15-minute timeout
gh pr checks "${PR:?}" --watch --fail-fast
Record CI wait duration for the deploy report.
This is the one critical confirmation before an irreversible merge. Collect all evidence, then get explicit approval.
# How many commits since the last review in this branch?
git log --oneline $(git merge-base HEAD origin/main)..HEAD | wc -l
# What changed after any review was done?
git log --oneline -10
Staleness thresholds:
# Record this SHA as TESTED_SHA: Step 4 merges only this commit
git rev-parse HEAD
# Run tests now (fast tests only). One runner, picked from the project files:
# a failure must never fall through to another runner
if [ -f pnpm-lock.yaml ]; then pnpm test
elif [ -f yarn.lock ]; then yarn test
elif [ -f package.json ]; then npm test
elif [ -f go.mod ]; then go test ./...
elif [ -f pyproject.toml ] || [ -f pytest.ini ] || [ -f setup.py ]; then pytest --tb=short -q
else echo "No test runner detected"; false
fi
# Check exit code
echo "Tests exit code: $?"
In a repository with several test stacks, run each one separately: all must exit 0.
Failing tests = BLOCKER. Cannot merge with failing tests.
# Were CHANGELOG and docs updated on this branch?
git diff --name-only $(git merge-base HEAD origin/main)...HEAD -- \
README.md CHANGELOG.md ARCHITECTURE.md CONTRIBUTING.md CLAUDE.md VERSION
If CHANGELOG.md and VERSION were NOT modified and the diff includes new features → WARNING.
Present a summary and ask for explicit confirmation:
╔══════════════════════════════════════════════════════════╗
║ PRE-MERGE READINESS REPORT ║
╠══════════════════════════════════════════════════════════╣
║ PR: #NNN: [title] ║
║ Branch: feature-branch → main ║
║ ║
║ REVIEWS ║
║ Review: CURRENT / STALE (N commits) / NOT RUN ║
║ ║
║ TESTS ║
║ Fast tests: PASS / FAIL (blocker) ║
║ ║
║ DOCUMENTATION ║
║ CHANGELOG: Updated / NOT UPDATED (warning) ║
║ VERSION: Bumped / NOT BUMPED (warning) ║
║ ║
║ WARNINGS: N | BLOCKERS: N ║
╚══════════════════════════════════════════════════════════╝
Options:
A) Merge (all checks green)
B) Don't merge yet, address warnings first
C) Merge anyway (I understand the risks; warnings only, not offered with a blocker)
STOP. Wait for the user's answer. Run Step 4 only after an explicit A or C in the conversation.
If the user chooses B, list exactly what needs to be done and stop.
# Merge with an explicit method (non-interactive gh needs one unless a merge queue applies)
gh pr merge "${PR:?}" --squash --delete-branch --match-head-commit "${TESTED_SHA:?}"
# Alternatives: --merge or --rebase per repo policy; add --auto to merge once required checks pass
Record the merge commit SHA and timestamp (gh pr view "${PR:?}" --json mergeCommit,mergedAt). If the head moved since the tests, --match-head-commit rejects the merge: return to Step 1.
If merge fails with permission error → "You don't have merge permissions. Ask a maintainer to merge."
If merge queue is active, poll until merged:
# Poll every 30 seconds, timeout after 30 minutes
gh pr view "${PR:?}" --json state -q .state
Detect how this project deploys so we know what to verify.
# Detect platform from config files
[ -f fly.toml ] && echo "PLATFORM: fly"
[ -f render.yaml ] && echo "PLATFORM: render"
[ -f vercel.json ] || [ -d .vercel ] && echo "PLATFORM: vercel"
[ -f netlify.toml ] && echo "PLATFORM: netlify"
[ -f Procfile ] && echo "PLATFORM: heroku"
[ -f railway.toml ] && echo "PLATFORM: railway"
# Detect GitHub Actions deploy workflows
for f in .github/workflows/*.yml .github/workflows/*.yaml; do
[ -f "$f" ] && grep -qiE "deploy|release|production|cd" "$f" 2>/dev/null && echo "DEPLOY_WORKFLOW: $f"
done
# Classify diff scope (frontend / backend / docs / config)
# A file that matches no category counts as backend code, never as docs
gh pr diff "${PR:?}" --name-only | \
awk '{
m=0;
if (/\.(css|scss|tsx|jsx|html|svg)$/ || /components|pages|public\//) f=m=1;
if (/api\/|server\/|backend\/|\.(ts|js|mjs|cjs|go|py|rb|java|rs|php)$/) b=m=1;
if (/\.env|config\/|\.json$|\.toml$|\.ya?ml$/) c=m=1;
if (/\.md$|(^|\/)(README|CHANGELOG|LICENSE)$/) d=m=1;
if (!m) b=1;
} END {
if (f) print "SCOPE_FRONTEND=true";
if (b) print "SCOPE_BACKEND=true";
if (d) print "SCOPE_DOCS=true";
if (c) print "SCOPE_CONFIG=true";
}'
Decision tree:
SCOPE_DOCS is the only line printed) → skip deploy verification, go to Step 8gh pr diff failed → scope unknown, not docs-only: verify the deployGitHub Actions deploy workflow:
# Find the run triggered by the merge commit
gh run list --branch main --limit 10 --json databaseId,headSha,status,conclusion,workflowName
# Poll until complete (30s interval, 20 min timeout)
gh run view <run-id> --json status,conclusion
Platform-specific strategies:
| Platform | Detection | Wait strategy |
|---|---|---|
| Vercel / Netlify | Auto-deploy on push | Wait 60s for propagation, then check |
| Fly.io | fly.toml present | fly status --app <app>, check started status |
| Render | render.yaml present | Poll production URL until it responds with 200 |
| Heroku | Procfile present | heroku releases --app <app> -n 1 |
| Railway | railway.toml present | Poll production URL |
| GitHub Actions only | .github/workflows/ with deploy step | Poll gh run view |
If deploy fails → offer to investigate logs or create a revert commit.
Record deploy duration for the report.
Use diff scope (from Step 5) to determine check depth:
| Diff Scope | Canary Depth |
|---|---|
| Docs only | Already skipped in Step 5 |
| Config only | HTTP 200 smoke check only |
| Backend only | Status + response time check |
| Frontend (any) | Full: status + response time + content check |
| Mixed | Full check |
Full health check sequence:
# 1. Page loads (200 status)
curl -sf -o /dev/null -w "%{http_code}" "${PROD_URL}" 2>/dev/null
# 2. Response time check
curl -sf -o /dev/null -w "%{time_total}" "${PROD_URL}" 2>/dev/null
# 3. Health endpoint (if exists)
curl -sf "${PROD_URL}/health" 2>/dev/null || \
curl -sf "${PROD_URL}/api/health" 2>/dev/null
# 4. Content check: page is not blank
curl -sf "${PROD_URL}" 2>/dev/null | wc -c
Pass criteria:
If any check fails → offer to revert:
Post-deploy health check detected issues:
[finding, specific]
Options:
A) Investigate (this may be normal: cache warming, eventual consistency)
B) Rollback (revert the merge commit)
C) Continue (I'll monitor manually)
Run this step only when the user chooses to roll back.
BASE="<baseRefName from Step 1>"
MERGE_SHA="<merge commit SHA from Step 4>"
# Update the local base branch first; any failure stops the chain
git fetch origin "${BASE:?}" &&
git switch "$BASE" &&
git merge --ff-only "origin/$BASE" &&
git merge-base --is-ancestor "${MERGE_SHA:?}" HEAD &&
git revert "$MERGE_SHA" --no-edit && # add -m 1 if the PR was merged with --merge
git show --stat HEAD
STOP. If a command failed, report it and push nothing. Otherwise show the revert commit and ask the user to approve a direct push to the base branch. Run the next block only after an explicit yes in the conversation.
git push origin "${BASE:?}"
If conflicts → "Revert has conflicts. Run git revert <sha> manually to resolve."
If branch protections → "Create a revert PR: gh pr create --title 'revert: <title>'"
LAND & DEPLOY REPORT
═════════════════════════════════════════
PR: #NNN: [title]
Branch: feature-branch → main
Merged: [timestamp] (squash / merge)
Merge SHA: [short SHA]
Timing:
CI wait: [Xm Ys / skipped]
Deploy: [Xm Ys / no workflow detected]
Health: [Xs / skipped]
Total: [end-to-end duration]
CI: PASSED / FAILED / SKIPPED
Deploy: PASSED / FAILED / NO WORKFLOW
Production: HEALTHY / DEGRADED / SKIPPED / REVERTED
Status: [HTTP status code]
Response: [Xms]
VERDICT: DEPLOYED AND VERIFIED / DEPLOYED (UNVERIFIED) / REVERTED
═════════════════════════════════════════
After the deploy report, suggest relevant next steps:
/canary <url> for extended 10-minute monitoring."gh pr merge (it's safe)./canary.--delete-branch)./land-and-deploy, answers the readiness gate, and the next thing they see is the deploy report./land-and-deploy # Auto-detect PR, no canary URL
/land-and-deploy https://app.example.com # Auto-detect PR + verify this URL
/land-and-deploy 123 # Specific PR number
/land-and-deploy 123 https://app.example.com # PR number + verification URL
/ship: pre-deploy readiness checklist (does not create the PR)/canary: extended post-deploy monitoring loop/review-pr: review the PR before landing$ARGUMENTS
What SKILL.md sets; muted values are Claude Code's defaults
highThree short reads, in order
pr-merge, ci-wait, deploy-verify, health-check, landing-pipeline
npx claudepluginhub florianbruniaux/claude-code-plugins --plugin devops-pipeline13 skills in this plugin
/canaryPost-deploy monitoring: watch production after a deploy and alert on regressions/ci-allRun the local test suite and type check, push the current branch, and return the pipeline URL. Use before opening a PR./ci-pipelinePush current branch and return the pipeline tracking URL (GitLab or GitHub Actions)/ci-statusShow the CI pipeline status for the active branch (GitLab CI or GitHub Actions), or for a given MR or PR number. Use when asked whether CI passed, is running, or failed./ci-testsRun the test suite for the current repo, auto-detecting Python (pytest/uv), Node (vitest/pnpm), or Rust (cargo test)/commitGenerate a conventional commit message for staged changesOther plugins' skills for the same job