safe-deploy
Safe Deploy
Core Rule
NEVER deploy to production without first verifying the branch includes all commits from origin/main.
This prevents the critical bug where a feature branch deploys older code that overwrites recently merged PRs.
Before Every Deploy
Run these checks in order:
-
Fetch latest main
git fetch origin main -
Check if branch is up-to-date
git merge-base --is-ancestor origin/main HEAD- Exit code 0 = safe to deploy
- Exit code 1 = STOP, branch is behind main
-
If behind, show missing commits
git log --oneline origin/main ^HEAD -
Merge before deploying
git merge origin/main -
Run tests after merge
npx vitest run -
Only then deploy
Automated Enforcement
Projects should have a predeploy npm script that runs scripts/pre-deploy-check.mjs automatically before npm run deploy. If the project has this script, always use npm run deploy instead of calling the deploy tool directly.
When This Applies
- Running
npm run deploy - Running
wrangler pages deploydirectly - Any command that pushes code to production
- When the user asks to "deploy", "push to production", or "ship it"
What To Do
- Always check branch status against
origin/mainfirst - If behind, inform the user and merge before proceeding
- Run tests after merge to catch conflicts
- Only deploy after tests pass
- Never skip this check, even if the user says "just deploy"
More from almeidamarcell/claude-code-skills
entire
Capture AI agent sessions in your git workflow. Use for setup, rewinding to checkpoints, exploring session history, and troubleshooting.
16breadboarding
Transform a workflow description into affordance tables showing UI and Code affordances with their wiring. Use to map existing systems or design new ones from shaped parts.
6cheap-model-testing
When working on any application that integrates with LLMs or pay-per-usage APIs, always use the cheapest available model during development and testing. Remind to upgrade to a production model before deployment.
6web-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.
6animejs
When writing JavaScript animations using anime.js v4, including DOM element animations, timelines, stagger effects, scroll-triggered animations, SVG animations, text animations, draggable elements, layout transitions, or any motion/transition effects on websites. Also use when the user says "animate," "animation library," "anime.js," "stagger," "timeline animation," "scroll animation," "text animation," "draggable," or "motion effects.
5shaping
Use this methodology when collaboratively shaping a solution with the user - iterating on problem definition (requirements) and solution options (shapes).
5