git-workflows/skills/refresh-repo/SKILL.md
Check PR merge readiness, sync local repo, and cleanup stale worktrees
npx skillsauth add jacobpevans/claude-code-plugins refresh-repoInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Check open PR merge-readiness status, sync the local repository, and cleanup stale worktrees. Note: Does not automatically merge PRs - only reports readiness status for each PR.
State warning: Branch state, remote tracking, and PR status change between invocations. Re-run all git/gh commands from Step 1.
CRITICAL: Always check for open PRs, regardless of current branch.
# Check for PR from current branch
gh pr view --json state,number,title 2>/dev/null
# ALWAYS also check for any open PRs by the user
gh pr list --author @me --state open --json number,title,headRefName
For each open PR, DO NOT MERGE - only check and report:
gh pr view NUMBER --json state,mergeable,mergeStateStatus,statusCheckRollup,reviewDecision
Merge-ready criteria: state: OPEN, mergeable: MERGEABLE, mergeStateStatus: CLEAN or
HAS_HOOKS (any other value: BEHIND, BLOCKED, DIRTY, UNSTABLE, UNKNOWN, DRAFT = not
ready), all CI checks SUCCESS, review APPROVED or not required, all review threads
resolved (verify via
gh pr view NUMBER --json reviewThreads --jq '[.reviewThreads[] | select(.isResolved == false)] | length'
returns 0).
git fetch origin --no-tags --prune --forceorigin/HEAD, falling back to main or master.git merge --ff-only origin/<default>.
If the default worktree is dirty or divergent, report it and skip instead of resetting.git branch -d.
Never delete main/master/develop/current branches, worktree-checked-out branches, or branches
with open PRs.Do not use git fetch --tags, git fetch --prune-tags, or git pull --tags during the
normal refresh. Tags are audited separately in Step 4 so local-only non-release tags and
tag rewrites are not deleted by a broad fetch refspec.
Treat origin as authoritative for release tags only.
Use native Git commands to compare local tags to remote tags:
git for-each-ref '--format=%(refname:short)' refs/tags
git show-ref --tags
git ls-remote --tags --refs origin
For local-only tags:
v[0-9]*, delete it with
git tag -d <tag>.For tags that exist both locally and on origin but point at different objects, report the mismatch and do not force-update it automatically. Never delete or rewrite remote tags.
Only remove a worktree if it is confirmed stale.
Stale definition: No open PR, no uncommitted changes, and either:
mergedAt) whose headRefOid matches the local branch HEAD
(gh pr list --state merged --head <branch> --json number,headRefOid,mergedAt)[gone] in git branch -vv) and it has no commits
ahead of the default branch (git log origin/<default>..HEAD --oneline is empty)Branches with open PRs, local-only branches without PRs, and worktrees with uncommitted changes are NEVER stale.
For each worktree from git worktree list:
git worktree remove <path> — NEVER use --forcegit branch -d <branch>.
If this fails only because a squash-merged branch is not reachable from local default,
use git branch -D <branch> only when the merged PR headRefOid matched the local
branch HEAD before removing the worktree.Finish with git worktree prune.
Report: PRs assessed as merge-ready (if any), tags deleted or reported, branches cleaned up, worktrees removed, current branch, and sync status.
DO NOT skip the PR check just because you're on main. The user may have multiple open PRs from different branches.
Always run gh pr list --author @me --state open to find work that needs merging.
Do not use --prune-tags as a shortcut for tag cleanup. Git treats tag pruning as an
explicit refspec prune and can delete local-only tags that are not release artifacts.
documentation
Use when editing GitHub Actions workflow files (.github/workflows/*.yml) in JacobPEvans repos. Documents when to target self-hosted RunsOn runners vs GitHub-hosted runners, the v3 label catalog used across the org, the required github.run_id segment, and the GitHub App allowlist prereq.
testing
Check PR merge readiness, sync local repo, cleanup stale worktrees; optional cross-repo sweep and stale-branch prune modes
tools
Local rebase-merge workflow for pull requests with signed commits
tools
Canonical reference for all gh CLI command shapes used by skills in this plugin. Defines the placeholder convention, allowed --json fields, GraphQL fallback rules, -f/-F/--raw-field flag semantics, the PR-readiness gate, code-scanning alert query, review-thread fetch/count/resolve mutations, and heredoc bodies. Prevents Unknown JSON field errors and divergent query shapes.