Skip to content
Skills Library
Programming · Automation

branch-sync-gate

/branch-sync-gate

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.

Licence
MIT
Last repository change
06.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 06.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

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.

Original author description

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.

How it works

  1. The Rule
  2. When to Use
  3. The Gate (Run This First — Before Anything Else)
  4. Non-Negotiable
  5. Why This Exists
  6. Anti-Patterns
  7. Failure Modes
  8. Companion Skills
Original SKILL.md headings · 83 lines, 540 words
SKILL.md preview
---
name: branch-sync-gate
source: superpowers-plus
augment_menu: true
triggers:
  - /sp-sync
  - "continuing work on"
  - "resuming work on"
  - "picking up"
  - "let's continue"
  - "let's resume"
  - "review this PR"
  - "reviewing PR"
  - "work on this PR"
  - "working on this PR"
  - "do test"
  - "run test"
  - "next test"
  - "let's do test"
  - "start test"
anti_triggers:
  - "creating a branch"
  - "new branch"
  - "checkout -b"
description: "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."
summary: "Use when: about to do ANYTHING on an existing branch (write code, run tests, review). Pull first. Always."
coordination:
  group: session-start-gate
  order: 0
  requires: []
  enables:
    - pre-commit-gate
    - unified-commit-gate
    - finishing-a-development-branch
  escalates_to: []
  internal: false
composition:
  consumes: [existing-branch]
  produces: [synced-local-branch]
  capabilities: [gates-quality]
  priority: 100
---

> **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)

```bash
# 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. |

```bash
# Step 3: Pull if behind
git pull --rebase origin $(git branch --show-current)

# Step 4: Confirm baseline
git log --oneline -5
git status
```

## Non-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

Versions

The database has no other skills named branch-sync-gate.

Database snapshot: 13.11.2026 · package version 4baa0e2341b9 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 2 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100git-pr-sync-check
    Checks whether the current PR branch is still live and in sync (merged/behind/changes-requested). Use when continuing work on a PR branch before adding commits.
  • 100git-branch-sync
    Fetch the latest base branch and rebase the current branch onto it, surfacing conflicts clearly. Use when the user asks to sync, rebase, update from main, pull latest changes, or /git-branch-sync. Also trigger on "catch up with main", "rebase onto main", "update my branch", or…
  • 100git-branch-conventions
    Use when running git checkout -b, git switch -c, git worktree add -b, or any command that creates a new work branch — enforces semantic prefix naming.
  • 100git-sync
    Sync the current branch in one pass — commit the working tree as one commit per logical change (in the host repo's commit format, or the super-board writing standard), gate Supabase schema changes, merge-pull, resolve conflicts hunk by hunk, then push without force. Use when the…
  • 100git-flow
    Git branching, commit, and PR procedures. Use when creating branches, making commits, or opening pull requests. Enforces branch naming, commit message format, and PR rules.
  • 100git-sync-workspace
    Sync every git repo in a Cursor multi-root workspace to its remote default branch: discover roots, preflight each repo, fetch --all --prune, checkout default, pull --ff-only. Skips dirty or unsafe repos with a clear report. Use for "sync workspace", "update all repos", "back to…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.