plugins/scm-utils/skills/update-branch/SKILL.md
This skill should be used when the user asks to "update the PR", "update PR
npx skillsauth add nsheaps/ai-mktpl update-branchInstall 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.
Synchronize a local branch with its remote counterpart and ensure the remote branch is up-to-date with its base branch.
Current branch: !git branch --show-current 2>/dev/null || echo "(not in a git repo)"
PR info for current branch:
!gh pr view --json baseRefName,headRefName,number,title,state 2>/dev/null || echo "(no PR found or gh not authenticated)"
This skill handles the common workflow of keeping a feature branch synchronized:
The goal: ensure the remote feature branch contains all local changes AND is current with its base branch.
Default behavior (no arguments): Use the current directory, get the current branch via git branch --show-current, find the associated PR via gh pr list --head <branch>, and update from the PR's base branch.
Determine the target branch from the provided input. Accept any of:
| Input Type | Example | Resolution |
| ----------- | -------------------------------------- | ------------------------------------------------------- |
| No input | (empty) | Current directory → current branch → find PR → update |
| PR number | 123, #123 | gh pr view 123 --json headRefName,baseRefName |
| PR URL | https://github.com/org/repo/pull/123 | Parse number, use gh pr view |
| Branch name | feature/my-branch | Use directly, find PR with gh pr list --head <branch> |
| Directory | /path/to/repo | cd there, get current branch, find PR |
Critical: Always query the PR to determine the base branch. Never assume main or master.
# Get branch info from PR
gh pr view <number> --json headRefName,baseRefName,number,url
# Find PR for a branch
gh pr list --head <branch-name> --json number,baseRefName --limit 1
Execute these steps in order:
git fetch --all --prune
# Extract base branch name
BASE_BRANCH=$(gh pr view <number> --json baseRefName --jq '.baseRefName')
If no PR exists for the branch, ask the user what the base branch should be.
git checkout <feature-branch>
git merge origin/$BASE_BRANCH --no-edit
If conflicts occur, see Conflict Resolution.
git pull origin <feature-branch> --no-edit
If conflicts occur, handle them before proceeding.
git push origin <feature-branch>
Confirm the remote branch is updated:
gh pr view <number> --json commits,mergeable,mergeStateStatus
When merge conflicts occur:
Resolve directly when the conflict is clearly one of:
For conflicts requiring analysis, delegate to specialized agents:
Use Explore agent with haiku model to understand:
Use Plan agent to determine:
Execute the resolution - The executing agent owns the final resolution. Agent delegations are helpers, not decision-makers.
Verify the resolution - Run tests or builds to confirm the merge didn't break anything.
For detailed conflict resolution patterns, see references/conflict-resolution.md.
Only modify the requested branch:
Never rewrite history:
git push --force--force-with-lease or --force-if-includesPreserve all changes:
This skill works identically in CI and local environments:
git directly for all operationsuser.name and user.email appropriately| Error | Resolution |
| -------------------------------- | -------------------------------------------- |
| No PR found for branch | Ask user for base branch, or create PR first |
| Merge conflicts | Follow conflict resolution workflow |
| Push rejected (non-fast-forward) | Pull first, then push again |
| Authentication failure | Ensure gh and git are authenticated |
When reporting completion, use clear language that doesn't imply the PR was merged:
Don't say: "PR #123 is now merged with main" (implies PR merged INTO main)
Do say: "Branch updated: merged base branch (main) into feature branch, synced local and remote"
For detailed conflict resolution guidance, consult:
references/conflict-resolution.md - Patterns for analyzing and resolving merge conflictstools
Manually reproduce what the github-app plugin's SessionStart hook does to make a GitHub App installation token usable in the current session — materialize the PEM, generate the token, isolate GH_CONFIG_DIR, write the runtime env file, and wire CLAUDE_ENV_FILE so every Bash call sees GH_TOKEN/GITHUB_TOKEN. Use when the hook did not run, the token is missing from the environment, or a shell/teammate needs the token wired up by hand. <example>GH_TOKEN isn't set even though github-app is configured</example> <example>the github-app SessionStart hook didn't run, set up the token manually</example> <example>wire the github app token into CLAUDE_ENV_FILE</example> <example>gh keeps falling back to the wrong account, isolate GH_CONFIG_DIR</example>
tools
Manually configure the GitHub App bot git identity the way the github-app plugin's SessionStart hook does — resolve the app slug and bot user ID, build the <slug>[bot] name and noreply email, set GIT_AUTHOR_*/GIT_COMMITTER_* env vars, and write an isolated GIT_CONFIG_GLOBAL with the gh auth git-credential helper. Use when commits are attributed to the wrong account, "Author identity unknown" appears, or git identity must be set up by hand. <example>my commits are showing up as the handler, not the bot</example> <example>git says Author identity unknown after the github-app hook ran</example> <example>configure the github app bot git identity manually</example> <example>set up the gh credential helper for git push</example>
tools
Manages spec files for requirements capture and validation
tools
# Bash Chaining Alternatives This skill teaches you how to work around the bash command chaining restriction enforced by this plugin. ## Why Chaining is Blocked The `bash-command-rejection` plugin blocks these operators: | Operator | Name | Why Blocked | | -------- | ---------- | ----------------------------------------------------------------------------------- | | `&&` | AND chain | Runs cmd2 only if cmd1 su