branch-sync-gate
Skill8 starsChanged 6 months agoMITView on GitHub
Pull gate — MANDATORY before any work on an existing shared branch. git fetch + status check before touching code, running tests, or making changes. Fires whenever resuming, continuing, or reviewing work on a branch that exists on a remote.
In this repository129 other files it gives its agents.
- AGENTS.mdAGENTS.md
- guidance/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- guidance/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- blast-radius-checkSkill
- brainstormingSkill
- branch-flow-gateSkill
- codebase-reconSkill
- codeowners-drift-auditSkill
- code-review-batterySkill
- cognitive-complexity-refactoringSkill
- debateSkill
- debug-conductorSkill
- dispatching-parallel-agentsSkill
- domain-buildSkill
- evidence-adjudicatorSkill
- executing-plansSkill
- external-cli-auditSkill
- feature-developmentSkill
- field-rename-verificationSkill
- finishing-a-development-branchSkill
- git-branch-conventionsSkill
- gitlab-cliSkill
- hotfix-charterSkill
- implementation-trackerSkill
- incident-revert-reviewSkill
- infra-config-investigatorSkill
- investigation-stateSkill
- kernel-splitSkill
- llm-behavior-investigatorSkill
- llm-skill-reviewSkill
- merge-authorization-gateSkill
- micro-harsh-reviewSkill
- output-verificationSkill
- pre-commit-gateSkill
- progressive-code-review-gateSkill
- progressive-harsh-reviewSkill
- providing-code-reviewSkill
- pr-triage-gateSkill
- push-authorization-gateSkill
- receiving-code-reviewSkill
- reproduction-experiment-investigatorSkill
- requesting-code-reviewSkill
- requirements-validation-pmSkill
- requirements-validationSkill
- scope-tripwireSkill
- session-handoffSkill
- skills-hierarchy-tuningSkill
- sp-bughuntSkill
- state-consistency-investigatorSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- timeline-trace-investigatorSkill
- token-estimationSkill
- unified-commit-gateSkill
- using-git-worktreesSkill
- using-superpowersSkill
- verification-before-completionSkill
- The first 60 shown.
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 58
Run tests on an existing branch
- Distinctive: line 59
Write code on an existing branch
- Distinctive: line 61
Add commits to a branch shared with other developers
- Distinctive: line 94
If you find yourself already mid-work and realize you haven't pulled — stop, pull, verify the state hasn't changed under you, then continue.
- Very specific: line 100
Root cause: No skill enforced sync at session start.
- Distinctive: line 122
git-branch-conventions: Use when creating a brand-new branch
≈ “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
Wrong skill? Starting a brand-new branch →
using-git-worktrees. About to commit →unified-commit-gate. Branch work is done →finishing-a-development-branch.
Branch Sync Gate
The Rule
Before touching any existing shared branch — pull first.
This is not optional. It is not skippable. It applies even if you were just working on the branch 5 minutes ago.
When to Use
Any time you are about to:
- Resume or continue work on a branch that exists on a remote
- Run tests on an existing branch
- Write code on an existing branch
- Review a PR branch locally
- Add commits to a branch shared with other developers
The Gate (Run This First — Before Anything Else)
# Step 1: Where are we?
git branch --show-current
git remote -v
# Step 2: Fetch and check for remote changes
git fetch origin
git log HEAD..origin/$(git branch --show-current) --oneline 2>/dev/null| Remote has commits not in local? | Action |
| Yes | git pull --rebase origin $(git branch --show-current) — then verify |
| No | Proceed — you are in sync |
| Unsure | Fetch and check. Never assume. |
# Step 3: Pull if behind
git pull --rebase origin $(git branch --show-current)
# Step 4: Confirm baseline
git log --oneline -5
git statusNon-Negotiable
Do not start work, run tests, or write a single line of code until this gate passes.
If you find yourself already mid-work and realize you haven't pulled — stop, pull, verify the state hasn't changed under you, then continue.
Why This Exists
Incident 2026-04-23: Agent began writing tests on an active PR branch without pulling first. A teammate had pushed two commits in the interim. The agent iterated tests against stale code, created a merge conflict on push, resolved it by discarding its own changes, then pushed a broken build (failing assertion + TypeScript error). Required multiple extra fix commits on a PR that was otherwise ready to merge.
Root cause: No skill enforced sync at session start. Every existing gate (sp-commit, sp-finish, pre-commit-gate) fires at commit time or later — zero enforcement at the moment work begins.
Anti-Patterns
| Wrong | Right |
| Assume local is up to date because you just worked on it | git fetch and check |
| Pull after writing code | Pull before writing code |
| Merge conflicts on push | Prevented by pulling first |
| Re-fixing what a teammate already fixed | Prevented by pulling first |
Failure Modes
| Symptom | Fix |
git fetch hangs | Check network / VPN; run git remote -v to verify remote URL |
| Merge conflict after pull | git status to identify conflicts; resolve, then git rebase --continue |
| Branch doesn't exist on remote | Verify with git branch -r; may be a new local-only branch |
| Remote HEAD diverged too far | Consider git fetch origin && git log --oneline origin/branch before rebasing |
Companion Skills
- git-branch-conventions: Use when creating a brand-new branch
- unified-commit-gate: Fires at commit time (this fires at session start)
- finishing-a-development-branch: Fires when branch work is complete
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.

