AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Github Sync

skill-trevorbyrum-claude-skills-suite-github-sync · by trevorbyrum

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".

No reviews yet
0 installs
35 views
0.0% view→install

Install

$ agentstack add skill-trevorbyrum-claude-skills-suite-github-sync

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-trevorbyrum-claude-skills-suite-github-sync)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Github Sync? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

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 counts

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

  1. Run git add -A. If the user specified files in their invocation, stage only those.
  2. Run git diff --cached --stat. If >20 files or >500 lines, show the summary and confirm via AskUserQuestion before continuing.
  3. 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.
  1. Run git commit -m "".

Phase 2: Push

  1. If the current branch has no upstream: git push -u origin .
  2. Otherwise: git push.
  3. If push is rejected (non-fast-forward): ask via AskUserQuestion how 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)

  1. 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 --rebase but forgot to commit first), auto-stash:

``bash git stash push -m "github-sync auto-stash $(date -u +%Y-%m-%dT%H:%M:%SZ)" ` Pop after the pull (git stash pop); if the pop has conflicts, surface them and tell the user where the stash lives (git stash list`).

  1. Run git pull --rebase (default) or git pull --no-rebase if the user chose merge in Phase 0.
  2. If conflicts surface: stop and surface them. Don't attempt automatic resolution.
  3. After resolving + committing, return to Phase 2 if local is now ahead.

Phase 4: Verify and report

  1. Run git status — working tree must be clean.
  2. 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.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.