Agent skill
up-to-date
Sync git repository with upstream. Use at the start of a session, when asked to sync, get up to date, check git status, or when working on a stale branch.
Install this agent skill to your Project
npx add-skill https://github.com/idvorkin/chop-conventions/tree/main/skills/up-to-date
SKILL.md
Up To Date
Diagnose and sync the current git repo with upstream.
Step 1: Remote Hygiene
Check remotes follow convention before doing anything else.
Convention: origin = your fork (push here), upstream = canonical repo (PRs target here). Single-remote repos use origin as source of truth.
Fork orgs (must use PRs, never direct push to canonical): idvorkin-ai-tools
git remote -v
Check for these problems and report in output table:
- Non-standard names — remotes named anything other than
origin/upstream(e.g.,fork) - Swapped remotes —
originpoints to canonical repo when a fork remote exists - Fork org without PR workflow — a known fork org remote exists but isn't set up as
origin
If issues found, offer fix commands but don't execute automatically:
git remote rename <canonical> upstream
git remote rename <fork> origin
git branch --set-upstream-to=upstream/main main
Step 2: Diagnose
# Determine source of truth
SRC=$(git remote | grep -q '^upstream$' && echo upstream || echo origin)
git fetch --all --prune 2>&1
git branch --show-current
git status --porcelain
git stash list
echo "Behind $SRC/main:" && git rev-list --count HEAD..$SRC/main
echo "Ahead of $SRC/main:" && git rev-list --count $SRC/main..HEAD
git log --oneline HEAD..$SRC/main | head -10
On a feature branch, also check:
gh pr view --json state,number,title,mergeable,reviewDecision 2>/dev/null || echo "NO_PR"
Step 3: Act
Use SRC from diagnosis. After any action on main, clean up merged branches:
git branch --merged main | grep -v '^\*\|main' | xargs -r git branch -d
On main
git pull $SRC main
# Fork workflow: keep fork in sync
[ "$SRC" = "upstream" ] && git push origin main
Feature branch + PR merged
Check for leftover commits (made after PR merged), then switch to main:
BRANCH=$(git branch --show-current)
LEFTOVER=$(git log --oneline $SRC/main..$BRANCH)
# If leftover commits exist → ASK USER: new PR or discard?
git checkout main && git pull $SRC main
[ "$SRC" = "upstream" ] && git push origin main
git branch -d "$BRANCH" # use -D only if user confirmed discard of leftovers
Feature branch + PR open
Report status and show recent feedback:
gh pr view --json reviews,comments --jq '.reviews[-3:], .comments[-3:]'
Feature branch + PR closed (not merged)
Ask user: delete branch or keep working?
Feature branch + no PR
- Has commits ahead → ask if user wants to create PR
- No commits ahead → ask if user wants to delete branch
Uncommitted changes
List with git status. Ask user: commit, stash, or discard. Never act automatically.
Stashed changes
List with git stash list and inform user.
Output Format
| Check | Status | Action |
|---|---|---|
| Remote naming | pass/fail | Offer rename commands |
| Workflow | PR / direct push | Warn if fork org pushing direct |
| Branch | branch-name |
— |
| PR | #N STATE | Context-dependent |
| Uncommitted | N files | Listed below |
| Behind source/main | N commits | Will pull |
| Stashes | N stashes | Listed below |
Post-Sync
Ask: "Want to /clear context for a fresh start?"
Safety
- NEVER force push
- NEVER delete unmerged branches without asking
- NEVER commit/discard uncommitted changes without user approval
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
image-explore
Brainstorm multiple visual directions for a blog image, generate them in parallel, build a comparison page, and optionally publish as a shareable link (Surge.sh or gist).
build-bd
background-usage
Check Claude Code plan usage via a hidden tmux session. Reports weekly usage percentage, time until reset, and pacing status.
ammon
What time is it for Ammon? Looks up the current time in Denmark (Europe/Copenhagen timezone) and reports it.
showboat
Create executable demo documents with screenshots using Showboat + Rodney. Use when the user wants to document an app, create a visual walkthrough, take screenshots of a deployed site, run an accessibility audit, or build self-verifying documentation.
clock
Schedule recurring tasks in your session. Defaults to time check every 15 min.
Didn't find tool you were looking for?