/fix-review:fix-reviewfrom fix-review
Non-interactive PR review fixer. Fetches unresolved review threads of a GitHub pull request, applies the valid fixes, commits, pushes, and replies to every thread. Run only when the user explicitly invokes fix-review by name; never start it on your own.
Ships in fix-review. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Role: Senior software engineer autonomously fixing PR review feedback.
Task: Process unresolved review comments on the target PR, research validity, auto-apply valid fixes, skip questionable/invalid.
Target PR: the PR URL the user passed when invoking this skill. If none was given, use the PR of the current branch: gh pr view --json url -q .url. Stop if neither resolves.
IMPORTANT: Work directly — no plan mode (EnterPlanMode or equivalent). Apply fixes immediately after research.
Parse PR URL to get owner/repo/number:
PR_URL="<target PR URL>"
OWNER=$(echo "$PR_URL" | sed 's|.*github.com/\([^/]*\)/.*|\1|')
REPO=$(echo "$PR_URL" | sed 's|.*github.com/[^/]*/\([^/]*\)/.*|\1|')
PR=$(echo "$PR_URL" | sed 's|.*/pull/\([0-9]*\).*|\1|')
gh api graphql -f owner="$OWNER" -f repo="$REPO" -F pr="$PR" -F query=@- << 'EOF'
query($owner: String!, $repo: String!, $pr: Int!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $pr) {
reviewThreads(first: 100) {
nodes {
id
isResolved
isOutdated
path
line
comments(first: 100) {
nodes {
databaseId
author { login }
body
createdAt
}
}
}
}
}
}
}
EOF
Filter: isResolved: false AND isOutdated: false
For each surviving thread, capture:
threadId — GraphQL node id (used for addPullRequestReviewThreadReply)databaseId — REST fallback id for POST /repos/{O}/{R}/pulls/{N}/comments/{cid}/repliesFor each unresolved comment:
path:lineValid (ALL must be true):
Invalid (ANY true):
Questionable (ANY doubt):
Before the first edit, record the files that already have local changes, staged or not: git status --porcelain. Do not edit those files; skip such a fix as questionable ("file has local changes not from this run") so the user's work never lands in the fix commit.
threadId + one-line note on the fix (for the post-commit reply)threadId + reasoning (the tradeoff, the open question)threadId + evidence (e.g. "already implemented at file:line", "not in PR diff", "conflicts with pattern X")If no valid fix was applied, make no commit and no push; go to Phase 4.
Otherwise list the files you edited in Phase 2 as <paths>. Never git add ., and leave anything already staged alone: only <paths> go into this commit.
Format: <type>(<scope>): <description>, title ≤50 characters, no PR refs, no AI attribution.
type: fix by default; docs, test, refactor, style, perf, ci, or build when every fix is of that kind. If the scope is ci, test, docs, or build, use it as the type too (test(test): ..., never fix(test): ...).
scope: reuse a scope from recent subjects that matches the touched paths:
git log -n 50 --format=%s
git diff --name-only -- <paths>
Prefer the scope of recent commits that touched the same files (git log -n 20 --format=%s -- <path>). If no recent scope fits, use the narrowest directory name that contains every file in <paths> (e.g. auth for internal/auth/*). If that directory is the repo root, use the top-level directory of the most significant fix, or the repo name for root-only files. Never leave the scope empty. Use only lowercase letters, digits, -, _ and /: drop leading dots and turn other dots into - (.github becomes github, api.v2 becomes api-v2).
description: imperative, lowercase, no trailing period; name what the fixes changed (e.g. fix(auth): handle nil token in refresh), not that review comments were addressed. For several unrelated fixes, name the most significant one or the common theme.
Count the full title; if it exceeds 50 characters, shorten the description, not the scope.
Keep apostrophes, backticks, $ and ! out of the title (write "do not", not "don't"), then stage and commit <paths> in one command, signed, with the title in single quotes. The trailing -- <paths> keeps anything else in the index out of the commit:
git add -- <paths> && git commit -s -S -m '<title>' -- <paths>
Files you removed with git rm are already staged: keep them in the trailing -- <paths> of git commit but leave them out of git add.
Check the exit code. If the commit fails for any reason (hook rejection, signing error, shell error), read the error and fix the cause: adjust the message, or fix the flagged content, then retry. Change only lines you edited in Phase 2; if a hook flags other code, do not touch it and count the attempt as failed. Never use --no-verify, never disable hooks, never drop -s -S.
After three failed attempts, stop committing and do not push. Unstage with git reset -q -- <paths> and leave the fixes in the working tree for the user to commit, still reply to every thread in Phase 4 (applied fixes use the Fixed, not pushed template), and report the uncommitted fixes plus the last error in the Phase 5 summary.
git push
Check the exit code. If the push fails for any reason, read the error, fix the cause, and retry, at most three attempts in total. Never use --no-verify or --force.
git commit --amend -s -S (new message via -m '<title>' under the rules above, or re-staged content), so the rejected version never stays in the pushed range. Change only lines you edited in Phase 2; if the hook flags other code, do not touch it and count the attempt as failed.git pull --rebase, then retry. On a rebase conflict, git rebase --abort and count the attempt as failed.If the push still fails, reply as for a failed commit (applied fixes use Fixed, not pushed, naming the local SHA) and report the unpushed commit.
Push is required before replying so reviewers see the new SHA alongside the replies.
For every thread processed in Phase 1 — applied, questionable, or invalid — post one reply. Silent skips are the failure mode this skill exists to fix; reviewers must learn the outcome without re-pinging.
**Applied** — <one-line description of the change> (<short-sha>).
Only when Phase 3 could not commit or push:
**Fixed, not pushed** — <one-line description of the change>. <Why it is not on the PR yet, e.g. the hook error>. The change is ready locally and needs a manual commit or push.
**Skipped (questionable)** — <one-line reasoning>. <Concrete question for reviewer, or tradeoff statement>. Leaving the thread open for your call.
**Skipped (invalid)** — <one-line evidence>. Happy to revisit if I'm reading this wrong.
GraphQL (preferred):
gh api graphql -f threadId="$THREAD_ID" -f body="$REPLY_BODY" -F query=@- << 'EOF'
mutation($threadId: ID!, $body: String!) {
addPullRequestReviewThreadReply(input: { pullRequestReviewThreadId: $threadId, body: $body }) {
comment { id url }
}
}
EOF
REST fallback (if mutation unavailable for the repo):
gh api -X POST "/repos/$OWNER/$REPO/pulls/$PR/comments/$FIRST_COMMENT_DBID/replies" \
-f body="$REPLY_BODY"
Summary: Fixed N/M unresolved review comments
Applied (replied + pushed in <sha>):
✓ <thread1>: <one-liner>
✓ ...
Fixed, not pushed (only when Phase 3 failed; <last commit or push error>):
! <thread4>: <one-liner> — in working tree / local commit <sha>
Skipped (replied with reasoning):
? <thread2>: <one-liner> — questionable, awaiting reviewer
✗ <thread3>: <one-liner> — invalid, <evidence>
Threads replied: N+X+Y / total processed
DO:
type(scope): description title of at most 50 charsDON'T:
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub automaat/environment-as-code --plugin fix-review