/repertoire:pr-shepherdfrom repertoire
Takes an open pull request from opened to ready to merge by iteratively fixing CI failures, merge conflicts, and unresolved review threads. Use when a PR has red checks, conflicts, or review feedback.
Ships in repertoire. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Take one open pull request to "ready to merge" by looping over three checks: CI, whether the head still merges cleanly into its base, and unresolved review threads. Fix what each check turns up, push once, wait for CI, and check again. Stop at ready to merge. Merging is the user's gate, never yours.
Do the fixes in this session; don't delegate a thread to a subagent, which lacks the PR's intent.
gh pr view --json number,url); if there is none, ask for one.gh auth status succeeds, and the repository is cloned with the PR's head branch checked out or checkable out. Stop with the missing command if either fails.Stop before the first pass, and say why, when the PR is closed or merged, when the head branch belongs to a fork or another author (ask before pushing to a branch that isn't the user's), or when the user actually wants a review of the change (/repertoire:review-change).
Each of these turns a red check green without fixing anything, which is worse than a red check because it hides the signal.
.skip, .only, xit, @pytest.mark.skip), loosen an assertion, widen a type to any, or wrap a flaky assertion in a retry.gh run rerun, no empty commit to retrigger CI. When you believe a failure is flaky or unrelated, say so with the evidence and let the user decide whether to rerun.--force-with-lease after a rebase the local convention requires.Find and record each of these; they hold for every pass.
package.json scripts, a Makefile, justfile, or the steps in .github/workflows/*.yml. Default when nothing is stated: run what CI runs, step by step.CONTRIBUTING.md, or whether the PR's own history (git log --merges <base>..HEAD) already contains merge commits. Default: merge the base into the head. Rebase only when the convention requires linear history, because rebase forces a push on a branch others may have checked out.CONTRIBUTING.md or the repository's existing PRs. Default: reply, never resolve; the reviewer closes their own thread.gh pr checks <n> --required. A non-required check that fails because of this PR still gets fixed; one that fails for another reason gets reported.Run the status script. It makes the three queries (PR view, checks, and every page of review threads) and prints one JSON object. It is read-only.
node "${CLAUDE_SKILL_DIR}/scripts/status.mjs" <n>
Omit <n> to use the current branch's PR. Also run gh pr view <n> --json headRefOid,isDraft,reviewDecision once per pass; every later judgment is about that commit. Output shape: {checks:[{name,state}], mergeable, conflicts, unresolvedThreads:[{id,path,line,author,body}], ready}. Each thread's author and body come from its last comment. Branch on the exit code, and read the JSON for what to fix:
0: ready. Every check passed, there are no conflicts, and no thread is unresolved.1: not ready. The JSON on stdout says why. This is the normal case, not an error.2: gh is missing or not authenticated. Stop with the fix from stderr (gh auth login).3: any other error, such as a closed PR or a failed query. Read stderr, fix the cause or stop; never treat the output as a status.Read the results this way:
state is gh's check state (SUCCESS, FAILURE, PENDING, SKIPPED, and so on). The script counts success and skipped as passed. For the bucket, link, and workflow of a failing check, use gh pr checks <n> --json name,bucket,state,link,workflow.mergeable is UNKNOWN for a while after every push because GitHub computes it asynchronously. The script reports it as not ready and says so on stderr. Wait 15 seconds and re-run, up to four times, before reading it. conflicts: true means step 2; MERGEABLE with mergeStateStatus: BEHIND (from gh pr view <n> --json mergeStateStatus) means an update without conflicts, which step 2 also covers.unresolvedThreads lists every unresolved thread in two states. Live: its author is not you (compare with gh api user --jq .login). Awaiting the reviewer: its author is you. Only live threads need work; a thread stays unresolved after you answer it until the reviewer acts, so counting those as work would make the loop unfinishable. ready stays false while any thread is unresolved, so judge doneness from the live ones, not from ready alone.reviewDecision: CHANGES_REQUESTED with no live thread means the feedback is in a review body. Read it with gh pr view <n> --json reviews --jq '.reviews[] | select(.state=="CHANGES_REQUESTED") | .body' and treat each point as a live thread, replying as a PR comment (gh pr comment).Decide:
0, or exit 1 where the only reason is threads awaiting the reviewer and the required checks pass on headRefOid: done. Go to Report. Threads awaiting the reviewer go under unverified; they don't block done.pending: go to step 5's wait.Exact steps, because a bad resolution is silent until a reviewer notices.
git fetch origin <base>, then git merge origin/<base> (or git rebase origin/<base> when the convention requires it).git diff --name-only --diff-filter=U: read both sides, and read git log --oneline HEAD..origin/<base> -- <file> to learn why the base changed. Resolve only when you can state what each side intended and the result keeps both intentions. Otherwise abort the merge and stop, naming the file and quoting both hunks for the user.Load the taking-review-feedback skill and apply it to every live thread before changing anything: read all of them, restate each in your own words, and judge whether it is right for this codebase and for what the PR is trying to do. Then fix the ones that are right and reply with your reasoning to the ones that aren't. Bot comments get the same scrutiny. If that skill is not installed, those three steps are the minimum; never reply with agreement you haven't earned.
Read references/github-commands.md for the reply and resolve mutations and for reading CI logs, and for the mergeStateStatus table when the status is anything other than CLEAN, BEHIND, or DIRTY; the status script is the only query needed every pass.
For each check in the fail bucket, read its log (gh run view <run-id> --log-failed; the reference shows how to get the run id from link) and classify it with evidence before touching code:
gh run list --branch <base> --workflow <workflow> --limit 3), or the failure is in code the PR doesn't touch and passes locally. Report it. Don't fix it here, because the fix belongs on the base.Only the first kind gets a fix. The other three are classifications you report; the user decides what to do with them. If you cannot reproduce a failure locally, say so under unverified and fix only what the log makes certain.
Breaker: the same check failing for the same cause after two of your fixes means you don't understand it. Stop and report rather than try a third.
git push, or git push --force-with-lease only after a required rebase.timeout 540 gh pr checks <n> --watch --interval 30, with the Bash tool's timeout raised to 600000 ms, because its 2-minute default would kill the watch first. A timeout means still pending, not a failure; the next pass picks it up. If timeout is missing, run gh pr checks <n> --watch --interval 30 alone and rely on the tool timeout; exit 127 is a missing command, not a pending check.pending through two consecutive waits; a push is rejected; the only remaining red is a failure you classified as unrelated, flaky, or environment.BLOCKED merge state whose cause you can't see (branch protection, CODEOWNERS, required approvals).All of these hold on the current headRefOid, re-queried after the last push rather than remembered: every required check is in the pass bucket; mergeable is MERGEABLE; no review thread is live; git status is clean and the branch has nothing unpushed. Threads awaiting the reviewer, approvals (reviewDecision), CODEOWNERS, and branch protection are outside your reach and belong under unverified, not failed.
gh unauthenticated or the repository missing: stop with the command that fixes it.git status. Finish or abort an in-progress merge before anything else, and commit or stash uncommitted fixes rather than discarding them.Four parts, then the PR URL, head SHA, and passes used:
End with the next step for the user: merge, rerun a flaky job, answer a question, or rerun this skill after they act.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
19 skills in this plugin
/agentic-coding-patternsRoutes a recurring failure with coding agents, or a task about to start, to one of fifteen patterns, checks the pattern's reasons not to use it, and names the repertoire component or mechanism that implements it. Use when an agent claims done too early, a plan went wrong late, a session repeats a past dead end, or an unattended run must be made safe. Not for executing a pattern, debugging one bug (debugging-protocol), writing a plan or spec (plan-writer, interview-to-spec), or authoring a component (skill-builder)./browser-checkChecks the agent's own UI work in a real browser by starting the app locally, writing short Playwright scripts that look before they act, reading the console, and fixing what it finds in the same session. Use after changing anything a user sees in a web app, before calling the change done. Not for writing the permanent end-to-end suite, reviewing visual design, browsing external sites, or checking a deployed environment unless the user names one, or proving non-UI work before completion (repertoire:verification-gate)./commit-and-pr-authorTurns a session's changes into a reviewable history. Splits unrelated changes into separate commits, writes each message to the repository's commit convention (discovered first) with the why taken from the conversation, and fills a pull request description with the problem, approach, rejected alternatives, the verification commands actually run with their output, and where to review first. Use when work is ready to commit or a pull request needs writing. Never pushes or opens the pull request unless asked. Not for reviewing the change (/repertoire:review-change), not for fixing CI or review comments on an open pull request (pr-shepherd, taking-review-feedback), and not for merging.npx claudepluginhub stevekinney/repertoire --plugin repertoireOther plugins' skills for the same job