deploy-guard
Skill0 starsChanged 4 months agoMITView on GitHub
Production deploy guard — runs a git sync-check BEFORE any production deploy and BLOCKS if the working copy is behind or divergent from the canonical branch (stale). Use when the user says "deploy", "production deploy", "ship it", "push to prod", "vercel --prod", or runs any prod deploy command. Prevents the classic stale-branch production incident.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Abdox-menara/guard-skillstheir own version, first seen Aug 24, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- Abdox-menara/guard-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository4 other files it gives its agents.
- agent-incentive-auditSkill
- judgmentSkill
- link-to-skillSkill
- option-spaceSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
When the user asks for any of the following, pass through this gate BEFORE running the deploy command:
- Distinctive: line 21
Not mandatory for preview deploys — but running it is harmless.
- Very specific: line 27
If the project keeps a registry or a Canonical branch: line in its CLAUDE.md/AGENTS.md, read it.
- Distinctive: line 51
If ff-only fails (true divergence) → report to the user, leave the rebase/merge decision to them.
- Distinctive: line 60
If the sync-check is clean, run the requested prod deploy command in the project folder.
- Distinctive: line 66
Not a git repo / no git → the deploy target is suspicious.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Deploy Guard — Stale-Branch Production Deploy Preventer
Why this exists
The classic incident: the working folder sits on a stale branch (origin/main is dozens of commits ahead), a production deploy runs from it by accident → old content goes live. This skill puts that sync-check in front of EVERY production deploy as a mandatory gate.
When it is MANDATORY (triggers)
When the user asks for any of the following, pass through this gate BEFORE running the deploy command:
vercel --prod,vercel deploy --prod, or the platform equivalent (netlify deploy --prod,flyctl deploy, …)- "deploy", "production deploy", "prod deploy", "ship it", "push it live"
Not mandatory for preview deploys — but running it is harmless.
Steps
1. Determine the project's canonical folder and branch
If the project keeps a registry or a Canonical branch: line in its CLAUDE.md/AGENTS.md, read it.
Otherwise use the folder being deployed and default the canonical branch to main
(if unsure, ask the user — don't guess on a prod deploy).
2. Run the sync-check (MANDATORY before deploy)
git -C <ABS_PROJECT_PATH> fetch -q origin <canonical_branch> && \
git -C <ABS_PROJECT_PATH> branch --show-current && \
git -C <ABS_PROJECT_PATH> rev-list --left-right --count origin/<canonical_branch>...HEAD && \
git -C <ABS_PROJECT_PATH> status --porcelain | wc -lOutput to read: current branch, behind ahead counts against origin, and the number of uncommitted changes.
3. Interpret the output and DECIDE
- behind=0, branch=canonical, clean tree → deploy is allowed. Continue (step 4).
- behind>0 or divergent → DEPLOY FORBIDDEN. STOP.
Flag to the user: "Working copy is N commits behind/divergent from origin/
<branch>— deploying prod from a stale branch repeats the classic incident. NOT deploying." Sync first, don't deploy:
If ff-only fails (true divergence) → report to the user, leave the rebase/merge decision to them. NEVER deploy autonomously over divergence.git -C <ABS_PROJECT_PATH> pull --ff-only origin <canonical_branch> - Mirror branch (behind=0 but branch name differs from canonical, in sync with origin/
<branch>) → even on success, leave the user a one-line note ("branch is<cur>, canonical is<branch>— in sync with origin, deploy is safe"). If it looks risky, ask for approval. - Uncommitted changes > 0 → clean the working tree before deploying (commit/stash) or report to the user; deploying prod from a dirty tree violates the precondition.
4. Run the deploy only if CLEAN
If the sync-check is clean, run the requested prod deploy command in the project folder. Because a production deploy has real-world impact, a final explicit user approval still applies: even after the gate passes, confirm with the user before executing.
Fallback
- Not a git repo / no git → the deploy target is suspicious; ask the user.
Principles behind the gate
- A project has ONE canonical branch; deploy preconditions are
0 behind/ahead+ clean tree. - "The model says it deployed" ≠ evidence; verification = the sync-check, run now, not quoted from memory.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

