pr-review-loop
БесплатноЗапускает вложенные скриптыНе проверенUse this skill whenever a pull request of this repo has review feedback waiting: Codex (or a human) left comments and they need to be triaged, fixed, answered…
от lemline★ 47 звёзд на GitHubОб этом скилле
Answering a PR review, with a workflow: round after round
One round is: enumerate → judge → fix → verify → commit/push → reply → resolve → wait. Repeat until a round finds nothing to act on, or a stop condition (§8) fires.
The loop is autonomous inside a round, but not across rounds it should not have started: it never implements a finding the project gates forbid without asking, and it never spins on a disagreement. If the user asked only to "answer the current comments", run one round and stop before §7 — the waiting is what makes it a loop, and it is opt-in.
0. Resolve the target and check the ground
# Accepts a number, a PR URL, or a review permalink (…/pull/144#pullrequestreview-4967165301)
PR=$(printf '%s' "${1:-}" | sed -E 's#.*/pull/([0-9]+).*#\1#; s/[^0-9]//g')
PR=${PR:-$(gh pr view --json number --jq .number)} # default: the PR of the current branch
REPO=$(gh repo view --json nameWithOwner --jq .nameWithOwner) # owner/name, for the REST paths below
gh pr view "$PR" --json headRefName,state,url
git status --short && git diff --stat HEAD
Three preconditions, all blocking:
- The checkout must be on the PR's
headRefName. Answering a review from another branch commits the fixes somewhere nobody is reviewing. - Pre-existing working-tree changes get surfaced to the user before anything is committed (AGENTS.md, Commit Hygiene). Never bundle them silently into a review-fix commit.
- Another session may already be looping on this PR. Modified files matching the paths of open review threads, or commits on the branch you did not make, are the tell. Ask before writing.
1. Enumerate the worklist — unresolved threads, not "the last review"
The naive version of this loop reads the comments of the most recent review. That silently drops findings: Codex reviews per commit, so a finding raised three commits ago and still unfixed does not necessarily reappear in the newest review. The durable worklist is the set of unresolved review threads.
.claude/skills/pr-review-loop/scripts/pr-threads.sh "$PR" # one JSON object per unresolved thread
Each line carries the two identifiers the round needs, and they are not interchangeable:
| field | shape | used by |
|---|---|---|
threadId |
PRRT_kwDO… node id |
the resolveReviewThread mutation (§6) |
replyToId |
integer databaseId |
the /replies REST endpoint (§5) |
lastAuthor decides whether a thread is really pending. An unresolved thread whose last comment
is already yours was answered by a round that died before resolving it — resolve it, do not
answer it twice. An unresolved thread whose last comment is the bot's rebuttal of your reply is
a new finding, not the old one.
Thread enumeration does not see everything. Also read, once per round:
gh api --paginate "repos/$REPO/pulls/$PR/reviews?per_page=100" \
--jq '.[] | select(.user.login | test("codex")) | {commit_id, body}'
gh api --paginate "repos/$REPO/issues/$PR/comments?per_page=100" --jq '.[] | {user: .user.login, body}'
The Codex review body carries findings with no inline anchor, and humans leave plain issue comments. Both belong to the worklist even though no thread exists for them. Pagination is not optional: these endpoints return 30 items oldest-first by default, so on a PR with a few rounds the newest content is on a page you did not fetch.
isOutdated: true means the line moved, not that the issue is gone. Re-derive the location at
current HEAD and judge the substance.
2. Judge each finding — the comment is a hypothesis
Open the cited path:line at current HEAD and read the real code before agreeing with
anything. A bot finding can be stale (already fixed by a later commit in the same PR), can misread
control flow, or can be right about the symptom and wrong about the cause.
Codex prefixes each finding with a severity badge (P1 / P2 / P3). Treat it as a hint about
attention order, never as the decision — a P1 about code that does not do what the comment claims
is still a decline.
Route each finding into exactly one of four outcomes:
| Outcome | When | Action |
|---|---|---|
| Apply | Mechanical, local, behaviour-preserving, or a plain bug with an obvious correct fix | Fix it in this round |
| Apply at the root | The finding is real but names a symptom | Fix the layer that produced the invalid state, then reply explaining the redirection |
| Decline | The code does not do what the comment says, the case is unreachable, or the suggestion contradicts the intended contract | Reply with the evidence (file:line, actual behaviour). No code change |
| Ask the user | Any gate trigger below | Reply that it is understood and pending arbitration, leave the thread open, keep going on the others |
A human comment is not a bot finding: a person knows the intent behind the PR. When you disagree with a human reviewer, that is a conversat
Установить pr-review-loop в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл pr-review-loop?
Use this skill whenever a pull request of this repo has review feedback waiting: Codex (or a human) left comments and they need to be triaged, fixed, answered on GitHub, and the threads resolved — then the next automated review awaited and the cycle repeated until the reviewer stops finding things. Trigger it on a pasted PR or review URL with "traite ça", on "traite les commentaires de la PR", "réponds à codex", "boucle sur la review", "clear the review threads", or any request to make a PR's review feedback go away — even when the loop is not named. Do NOT use it to produce a review of code (that is /code-review), to merge or release, or to decide whether a change is allowed at all: tinystaff-change-control still governs every fix produced here.
Как установить скилл pr-review-loop?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pr-review-loop запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic