/kaoths-skills:request-pr-reviewersfrom kaoths-skills
Request PR reviewers (including GitHub Copilot) by browsing valid candidates and confirming a selection conversationally, rather than requiring an exact login/team-slug upfront. User-invoke only — do not trigger automatically from conversational requests; only run when the user explicitly invokes this skill.
Ships in kaoths-skills. 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.
None: SKILL.md is the whole skill.
gh has no built-in interactive picker for reviewer selection — --add-reviewer/--reviewer
both require an exact login or org/team-slug string upfront. This skill substitutes a
conversational list-then-confirm flow: gather valid candidates, present them as a plain-text
list, let the user confirm a selection, then execute the request.
gh pr edit --add-reviewer alice") — that's a manual action, not a request to
browse/select.fetch-pr-detail skill's / the /code-review plugin's job, not this skill's.Detect owner and repo from the current git remote:
git remote get-url origin
If no PR number is given, get it from the current branch:
gh pr view --json number -q '.number'
Also resolve the PR author, since GitHub rejects requesting review from the PR's own
author (422: Review cannot be requested from pull request author) — every candidate
list below must exclude this login:
gh pr view <NUM> --json author -q '.author.login'
Resolve owner, repo, <NUM>, and the author once, then reuse those literal values
through Step 4 — never re-run the resolution commands mid-run. A branch checkout between
the candidate list and the request would otherwise add reviewers to a different PR.
gh api repos/:owner/:repo/pulls/<NUM>/requested_reviewers --jq '{users: [.users[].login], teams: [.teams[].login]}'
Don't re-offer or re-request anyone already on the list — surface it to the user as context ("already requested: alice, myorg/frontend").
GitHub's own ranking for this PR:
gh api graphql -f query='
query($owner:String!, $repo:String!, $num:Int!) {
repository(owner:$owner, name:$repo) {
pullRequest(number:$num) {
suggestedReviewers { isAuthor isCommenter reviewer { login name } }
}
}
}' -f owner=<owner> -f repo=<repo> -F num=<NUM> \
--jq '.data.repository.pullRequest.suggestedReviewers[]
| select(.reviewer.login != "<author>")
| {login: .reviewer.login, name: .reviewer.name, isAuthor, isCommenter}'
isAuthor does NOT mean "is the PR's author." Its actual meaning (confirmed via
GraphQL schema introspection) is "is this suggestion based on past commits?" — i.e. this
person authored, via git blame, some of the code being changed. That's a positive
signal worth surfacing as context ("authored code in this PR"), not something to filter
out. Exclude the PR's own author by comparing reviewer.login against the login already
resolved above, not via isAuthor.
Prefer GraphQL — it returns name alongside login in a single call, which
/repos/:owner/:repo/collaborators (REST) does not:
gh api graphql -f query='
query($owner:String!, $repo:String!) {
repository(owner:$owner, name:$repo) {
collaborators(first: 100) { nodes { login name } }
}
}' -f owner=<owner> -f repo=<repo>
If that errors (permission or otherwise), fall back to REST, then to /assignees on
403 (caller lacks push access — realistic on org repos where the invoker isn't an
admin/maintainer):
gh api repos/:owner/:repo/collaborators --jq '.[].login'
gh api repos/:owner/:repo/assignees --jq '.[].login'
Neither REST fallback returns name — for those, treat every entry as nameless (see
the Step 3 formatting rule below). Exclude the resolved PR author's login yourself in
all three paths — gh api --jq doesn't support jq's --arg, so for the REST calls
filter in the response you already have to read anyway rather than shell-interpolating
the login into the --jq expression (quoting risk for no real benefit).
Do not fetch or display permission levels (role_name, admin/write/etc.) — the
candidate's job here is just to be picked, not to expose the repo's access structure.
gh api repos/:owner/:repo/teams --jq '.[] | {slug, name}'
Teams always have both a slug (the identifier --add-reviewer actually needs, as
org/slug) and a human name — unlike users, team name is never null, so no fallback
formatting is needed here.
Two distinct non-error outcomes to tell apart:
[] — personal (non-org) repo, or an org repo with genuinely no teams
granted access. Expected; omit the "Teams" group entirely.404 — the caller lacks admin access to this specific repo (this
endpoint requires repo-admin, not just org membership or write/maintain access; GitHub
returns 404 rather than 403 here). Fall back to:
gh api orgs/:org/teams --jq '.[] | {slug, name}'
This is org-wide, not repo-scoped — it lists every team in the org, with no
confirmation any of them actually has access to this repo. Present this fallback in a
separately labeled group ("Teams (org-wide list — access to this repo not confirmed)"),
never merged into a plain "Teams" heading as if it were the verified, repo-scoped list.
If this also fails (org team visibility settings can restrict it further), omit the
Teams group and say so, same as the "no teams" case.Not fetched from an API — @copilot is a fixed, always-valid special value for
--add-reviewer (confirmed in gh pr edit --help). Always include it as its own
candidate unless it's already in the "already requested" set from Step 1.
There's no API to check ahead of time whether Copilot code review is actually enabled for this repo/org/subscription tier — if the Step 4 request fails, that's the most likely reason (see Notes below), not a bug in this skill.
Default: a grouped, numbered plain-text list — the conversational equivalent of a spacebar-select picker, and what almost everyone wants. Present everything in one shot (no "here's one suggestion, want to see more?" intermediate step — just show the whole grouped list right away, Suggested group first if non-empty):
Suggested:
1. Alex Rivera (@arivera) — authored code in this PR
2. Sam Patel (@spatel) — commented on this PR
Collaborators:
3. Jordan Lee (@jlee)
4. Taylor Kim (@tkim)
5. Morgan Diaz (@mdiaz)
6. buildbot
7. svc-deploy
Teams:
8. Frontend (acme-corp/frontend)
9. Platform (acme-corp/platform)
Other:
10. @copilot
Already requested: none
Reply with a number, name, login, or team slug (comma-separated for multiple), or "none".
Formatting rule for people (suggested reviewers, collaborators/assignees): a bare
login isn't always enough to identify who someone actually is, and not everyone sets a
display name — matching how GitHub's own UI handles this:
name is set: {name} (@{login}) — e.g. Jordan Lee (@jlee).name is null: just {login} alone, no parentheses — e.g. buildbot.
Never fabricate a name or repeat the login inside parens when there isn't a real one.Formatting rule for teams: always {name} (org/{slug}) — since team name is never
null.
Only label the Teams group "(org-wide list — access to this repo not confirmed)" when it
actually came from the /orgs/:org/teams fallback (Step 2c 404 case); if the repo-scoped
/repos/:owner/:repo/teams call succeeded, just call it "Teams" with no caveat.
Opt-in only, never default: if the user explicitly asks for a table or a "prettified"
view, a hand-drawn box-drawing-character table (─│┌┬┐├┼┤└┴┘) can be built instead, with
section-header rows spanning the full width. This costs meaningfully more tokens and
execution time to generate correctly (column-width alignment across a variable-column
table isn't trivial) — do not produce it unless explicitly asked, and if asked, verify
the alignment programmatically (e.g. assert every line is the same character length)
rather than hand-aligning, since manual alignment is error-prone. Raw HTML tables
(<table>, colspan) are a further, even more experimental option only on explicit
request — rendering isn't guaranteed across destinations (chat UI, PR comment, terminal),
so the user is opting into that uncertainty by asking for it specifically.
Exclude the PR author (resolved above) from every group — GitHub rejects requesting review from the PR's own author, so listing them as a selectable candidate would guarantee a failed request at Step 4.
Exclude anyone already requested (including @copilot, if already requested) from the
selectable numbers.
If every group is empty (no suggested reviewers, no other collaborators after
excluding the author, no teams) — this is distinct from "already fully requested": say
so plainly, e.g. "No human reviewer candidates found — the only collaborator on this
repo is the PR's own author, and there are no teams. You can still request
@copilot," rather than presenting a blank list with no explanation.
The reply is free text, not a constrained widget, so it won't always be a clean number
or exact login — and since names are displayed, people will often reply with a name
rather than a handle. Resolve it against the candidates already presented, in this
order, matching against both name and login (or team name and slug):
org/team slug — pass it through to Step 4 as-is rather than rejecting it.
The candidate list is a convenience aid built from a few endpoints, not an exhaustive
whitelist — someone with repo access through a path we didn't check for (e.g. org
membership without being an explicit collaborator) is still a valid target. Let gh's
own response be the source of truth on whether it was actually valid.Once the user confirms a selection, translate it back to login/org/team-slug before
executing — --add-reviewer only accepts those, never a display name:
gh pr edit <NUM> --add-reviewer <login1>,<login2>,<org/team-slug>
Copilot is the one exception — every other value in that comma-joined list is a bare
login or org/team-slug, but Copilot must keep its literal @ prefix (@copilot), even
inside the list, e.g. --add-reviewer LoremIpsum,@copilot. A bare copilot (no @) fails
with GraphQL: Could not resolve user with login 'copilot'.
Echo back exactly who was requested, so the user has closure that the notification-triggering action actually happened.
gh pr edit --add-reviewer @copilot errors, say so plainly and explain that's the
likely cause, rather than treating it as an unexplained failure./collaborators 403 — fall back to /assignees. Both are presented identically
(flat list of logins, no permission info), so this fallback is invisible to the user./teams returning [] is expected; simply omit that group./teams 404 on an org repo — means the caller lacks repo-admin (not the same as
"no teams exist"). Fall back to /orgs/:org/teams, but label it clearly as an
unconfirmed, org-wide list rather than presenting it with the same confidence as a
verified repo-scoped result.@copilot, rather than showing a blank list with no explanation.gh will error if it isn't
actually a valid reviewer; surface that error as-is rather than treating it as this
skill's own bug, since the candidate list was never claimed to be exhaustive.| Endpoint / approach | Why skipped |
|---|---|
gh pr create's interactive survey prompt | Requires a live pty a human drives directly; not drivable via an agent's Bash tool. |
Third-party gh extensions (gh-reviewer, gh-rr) | Adds an external, unaudited dependency; breaks the "just gh + git" portability this repo relies on. |
| Checking Copilot eligibility ahead of time | No read API for it exists; the request itself is the only way to find out, so failures are explained after the fact instead (see Notes). |
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub kaoths/agent-skills --plugin kaoths-skills4 skills in this plugin
/fetch-pr-detailFetch a GitHub PR's metadata + file changes using a two-phase hybrid approach — triage filenames first (no patches), then fetch diffs only for files worth looking at. Use when asked to fetch, show, pull, or summarize a PR's changes. Do NOT trigger for "review this PR" / "find bugs in this PR" — that's a full analysis workflow, not a fetch./fetch-pr-review-commentsHow to fetch PR review comments using gh api. Triggers when the user asks the agent to look at review comments on a specific PR (by number or by referencing "the PR"/"my PR"). Examples: "got comments on PR 123, which should we address", "check the review feedback on the PR", "triage the PR comments". Do NOT trigger when the user pastes a raw gh command — that's a manual action, not a request for the agent to fetch and analyze./reply-pr-review-commentsReply to PR review comments using gh api. User-invoke only — do not trigger automatically from conversational requests; only run when the user explicitly invokes this skill.