github-sync
Skill1 starsChanged 5 months agoMITView on GitHub
Syncs working tree with GitHub remote. Detects whether to pull, push, or both from git state and acts accordingly. Invoke with /github-sync or when user says "commit", "push", "pull", or "sync to GitHub".
- Commits and pushes
11 other projects use a version of this.
Adopted by
Most recently taken up by
- allemaar/open-skillstheir own version, first seen Oct 13, 2026
- runxhq/runxtheir own version, first seen Oct 13, 2026
- mccc8/claude-skillstheir own version, first seen Oct 13, 2026
- tymrtn/tomorrowkit-for-mindstheir own version, first seen Aug 30, 2026
- Cal-Starfur/claude-skillstheir own version, first seen Jun 21, 2026
- bmad-labs/skillstheir own version, first seen Jun 14, 2026
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- runxhq/runx★ 97same name
- 9thLevelSoftware/legion★ 76same name
- bmad-labs/skills★ 19same name
- allemaar/open-skills★ 15same name
- Mindgames/skills★ 4same name
- tymrtn/tomorrowkit-for-minds★ 4same name
- Howie126313/obsidian-vault-kit★ 3same name
- h-mascot/Enterprise-Crew-skills★ 1same name
- Cal-Starfur/claude-skills★ 0same name
- jahody/skills★ 0same name
1 more not listed
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 repository7 other files it gives its agents.
- build-planSkill
- executeSkill
- initSkill
- iterateSkill
- reviewSkill
- saveSkill
- skill-forgeSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. 0 are common, 11 are distinctive, and 8 are very specific to this project.
0
Common
Most of the 10 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 9
Commit and push local changes, pull remote changes, or both — auto-detected from the current git state.
- Distinctive: line 19
Commit hash + branch + remote URL reported to user
- Distinctive: line 25
Run these in parallel:
- Very specific: line 44
If branch has no upstream (@{u} resolution fails), treat as push-only and set upstream during Phase 3.
- Distinctive: line 48
Run git add -A. If the user specified files in their invocation, stage only those.
- Very specific: line 49
Run git diff --cached --stat.
- Distinctive: line 51
If user passed one in the invocation, use it verbatim.
- Very specific: line 58
If the current branch has no upstream: git push -u origin <branch>.
- Very specific: line 60
If push is rejected (non-fast-forward): ask via AskUserQuestion how to proceed — rebase, merge, or cancel.
- Very specific: line 66
Auto-stash dirty tree (pull-only edge case): If the user explicitly invoked a pull but the working tree has uncommitted changes (e.g., they …
- Distinctive: line 71
Run git pull --rebase (default) or git pull --no-rebase if the user chose merge in Phase 0.
- Distinctive: line 72
If conflicts surface: stop and surface them.
- Distinctive: line 73
After resolving + committing, return to Phase 2 if local is now ahead.
- Distinctive: line 77
Run git status — working tree must be clean.
- Distinctive: line 79
Commit hash (if a new commit was made)
- Distinctive: line 86
After a successful push (pulls do not trigger memory writes), write a commit-log entry to the local memory store:
- Very specific: line 98
Dedup: if a fresh entry (<24h) exists for the same project/branch, db_upsert instead of db_write to update rather than duplicate.
- Very specific: line 100
Optional MCP mirror: if a memory MCP is configured in this session, the main thread may also call its store_memory (or memory_call gateway) …
- Very specific: line 132
Before completing, read and follow ../../references/cross-cutting-rules.md.
“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GitHub Sync
Commit and push local changes, pull remote changes, or both — auto-detected from the current git state. No flags. The working tree is left clean and in sync with origin.
Inputs
- Current git working tree (status, diff, branch, remote)
- User-provided commit message (optional, parsed from invocation)
Outputs
- Clean working tree, synced with origin
- Commit hash + branch + remote URL reported to user
Instructions
Phase 0: Detect mode
Run these in parallel:
git status --porcelain # any local changes?
git fetch --prune --quiet 2>/dev/null # --prune removes deleted remote-tracking branches
git rev-list --left-right --count @{u}...HEAD 2>/dev/null # remote-ahead / local-ahead countsBranch on the result:
| Local dirty | Local ahead | Remote ahead | Mode | Action |
| no | 0 | 0 | clean | Report "already in sync" and exit |
| no | 0 | >0 | pull-only | Go to Phase 3 |
| yes | * | 0 | push-only | Phases 1, 2, 3 |
| yes | * | >0 | both | Ask user via AskUserQuestion: "Local and remote both have changes. Rebase local on remote then push, OR pull --no-rebase merge then push?" |
| no | >0 | 0 | push-only | Phases 2, 3 (no staging needed) |
| no | >0 | >0 | both | Same AskUserQuestion as above |
If branch has no upstream (@{u} resolution fails), treat as push-only and set upstream during Phase 3.
Phase 1: Stage and commit (if local dirty)
- Run
git add -A. If the user specified files in their invocation, stage only those. - Run
git diff --cached --stat. If >20 files or >500 lines, show the summary and confirm viaAskUserQuestionbefore continuing. - Determine commit message:
- If user passed one in the invocation, use it verbatim.
- Otherwise generate a conventional-commit message (
feat:/fix:/chore:/docs:/refactor:/test:) from the staged diff. Keep subject ≤ 72 chars. - Show the message and ask via
AskUserQuestion: "Use this message, or rewrite?" — three options: accept / edit / cancel.
- Run
git commit -m "<message>".
Phase 2: Push
- If the current branch has no upstream:
git push -u origin <branch>. - Otherwise:
git push. - If push is rejected (non-fast-forward): ask via
AskUserQuestionhow to proceed — rebase, merge, or cancel. Never force-push without explicit confirmation.
On --amend requests: If the user explicitly asks to amend (e.g., "amend the last commit"), only proceed if the previous commit has NOT been pushed (check git log @{u}..HEAD — if non-empty, amending is local-only and safe). If the commit IS already on the remote, refuse and explain: amending pushed commits requires force-push, which the cross-cutting rules (and global CLAUDE.md) flag as needing explicit user authorization. Surface the choice; never force-push unprompted.
Phase 3: Pull (if remote ahead and local clean — or after rebase/merge resolution)
- Auto-stash dirty tree (pull-only edge case): If the user explicitly invoked a pull but the working tree has uncommitted changes (e.g., they meant
pull --rebasebut forgot to commit first), auto-stash:
Pop after the pull (git stash push -m "github-sync auto-stash $(date -u +%Y-%m-%dT%H:%M:%SZ)"git stash pop); if the pop has conflicts, surface them and tell the user where the stash lives (git stash list). - Run
git pull --rebase(default) orgit pull --no-rebaseif the user chose merge in Phase 0. - If conflicts surface: stop and surface them. Don't attempt automatic resolution.
- After resolving + committing, return to Phase 2 if local is now ahead.
Phase 4: Verify and report
- Run
git status— working tree must be clean. - Report:
- Commit hash (if a new commit was made)
- Branch
- Remote URL
- Direction synced (pushed N commits / pulled N commits / both)
Phase 5: Memory sync (cross-cutting rule 5)
After a successful push (pulls do not trigger memory writes), write a commit-log entry to the local memory store:
source references/db.sh
PROJECT=$(basename "$(git rev-parse --show-toplevel)")
COMMIT=$(git rev-parse --short HEAD)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
FILES=$(git diff --stat HEAD~1 HEAD | tail -1 | awk '{print $1}')
SUMMARY="Pushed ${COMMIT} on ${BRANCH}: ${FILES} files changed. $(git log -1 --pretty=%s)"
db_write 'memory' 'github-sync' "commit-log,${PROJECT}" "$SUMMARY"Dedup: if a fresh entry (<24h) exists for the same project/branch, db_upsert instead of db_write to update rather than duplicate.
Optional MCP mirror: if a memory MCP is configured in this session, the main thread may also call its store_memory (or memory_call gateway) tool with the same payload — best-effort, silent on failure.
Examples
User: /github-sync
→ Phase 0 detects: local dirty, remote up-to-date.
Phase 1 generates "feat: add /github-sync skill", asks to confirm message.
Phase 2 pushes. Phase 4 reports clean tree and commit hash.User: pull latest from origin
→ Phase 0 detects: clean tree, remote 3 commits ahead.
Phase 3 runs `git pull --rebase`. Phase 4 reports 3 commits pulled.User: sync
→ Phase 0 detects: local 2 ahead, remote 1 ahead.
AskUserQuestion → user picks "rebase".
Phase 3 rebases, Phase 2 pushes.User: commit "fix: null deref in auth handler" and push
→ Phase 1 uses provided message verbatim, no AskUserQuestion for confirmation.
Phase 2 pushes.Before completing, read and follow ../../references/cross-cutting-rules.md.
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.

