一键导入
pr-fix
Fetch PR review comments, classify by severity and confidence, and fix the selected subset.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Fetch PR review comments, classify by severity and confidence, and fix the selected subset.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Research a work item, draft an implementation plan, and begin work after approval.
Guided one-shot install — discover installed plugins (or help install new ones), pick install scope, calibrate risk tolerance into a concrete allowlist + hooks, scaffold or merge CLAUDE.md, and sanity-check the result.
Finalize work — commit via /commit, push, and create PRs on feature branches.
Reviewer-side PR workflow — checks out the branch in a worktree, runs focus-area reviews plus a senior-engineering pass, optionally cross-checks against an autonomous reviewer, and posts inline findings only on explicit approval. Read-only — never edits, commits, or pushes.
Triage CVE and SBOM scanner output (Trivy, Grype, Snyk, Docker Scout, Dependabot) into a ranked, deduplicated action list.
Review project memory and promote durable lessons into CLAUDE.md / settings (with confirmation); file a GitHub issue when a lesson is a defect in one of this repo's own skills.
| name | pr-fix |
| description | Fetch PR review comments, classify by severity and confidence, and fix the selected subset. |
| user-invocable | true |
| disable-model-invocation | true |
| allowed-tools | Read, Write, Edit, Grep, Glob, Bash, AskUserQuestion |
Fetch review comments from the current branch's PR, classify each issue, present a prioritized matrix, and fix the selected subset.
Invoke with /pr-fix. Must be on a branch with an open PR. No arguments needed.
Use the GitHub CLI to gather all review feedback:
# Get PR number and repo
gh pr view --json number,headRefName,headRepository
# PR-level comments (issue comments)
gh api --paginate repos/{owner}/{repo}/issues/{number}/comments
# Code review comments (inline)
gh api --paginate repos/{owner}/{repo}/pulls/{number}/comments
# PR review bodies (review-level feedback)
gh api --paginate repos/{owner}/{repo}/pulls/{number}/reviews
Parse the JSON responses with jq. For each review comment, extract: id (needed for replies), body, path, line (or original_line), diff_hunk, and user.login. Retain the comment id throughout classification so it can be used in step 8.
Skip comments that are NOT substantive review feedback:
github-actions[bot] posting coverage tables)reviewThreads query from step 8 to check isResolved)Keep comments from: human reviewers, automated code review sections (look for headings like "Blocker", "Warning", "Suggestion"), and code review bot comments with substantive feedback.
When a single comment contains multiple distinct issues (e.g. a review with separate sections), split them into individual issues for the matrix.
For each issue, assign:
| Axis | Values | Definition |
|---|---|---|
| Severity | Blocker / Warning / Suggestion | Impact if left unfixed. Blocker = bug, broken behavior, or data loss. Warning = correctness risk or code smell. Suggestion = improvement, style, or nice-to-have. |
| Confidence | Unambiguous / Debatable | Whether the fix is objectively correct (Unambiguous) or a matter of opinion, tradeoff, or requires product/design input (Debatable). |
| Effort | Quick / Involved | Quick = mechanical change, less than 5 min. Involved = requires thought, testing, design decisions, or touches multiple files. |
| Scope | In / Out / Ambiguous | Whether the issue is in scope for the current branch's work. See Scope classification below. "Out" covers both out-of-scope surface and out-of-scope subject. |
Derive a Recommendation column:
If core:scope-statement-check is available and a scope contract exists for this branch (.scope/<branch>.md), invoke scope-statement-check classify on the filtered findings. This attaches a Scope axis to each finding:
If the skill is not available, or no contract exists for this branch, classify scope inline: read the contract at .scope/<branch>.md if present, apply the same In/Out/Ambiguous logic. If no contract exists at all, skip scope classification entirely and proceed. Suggest the user run /scope-statement-check extract for future branches.
Out-of-scope findings default to Defer regardless of severity; the user can override case-by-case in step 5. When scope-statement-check ran, it pre-fills the reply template in step 8 with a generated deferral rationale. This is the single largest source of review-cycle waste — bots and reviewers consistently flag legitimately out-of-scope work, and a contract-based default removes the keystroke cost of explaining each one.
Output a markdown table sorted by recommendation priority (Fix now > Discuss > Optional), then by severity (Blocker > Warning > Suggestion):
| # | Issue | File | Scope | Severity | Confidence | Effort | Recommendation |
|---|-------|------|-------|----------|------------|--------|----------------|
| 1 | Description | path#line | In | Blocker | Unambiguous | Quick | Fix now |
| 2 | Description | path#line | Out | Warning | Unambiguous | Involved | Defer |
| ...
When scope classification was skipped (no contract), omit the Scope column.
Below the table, provide a brief summary:
If all issues are already fixed (e.g. addressed in a prior commit), skip straight to step 8 -- do not prompt for a fix category. There is nothing to commit, so step 7 is skipped too.
If every remaining issue is classified as Fix now + Quick, skip the prompt and fix them all -- the selection adds no value when there is only one sensible answer.
Otherwise, use AskUserQuestion with these options:
After the user selects a category:
Do NOT commit yet -- that happens in step 7.
If a "Debatable" issue is included in the selection (via "All"), mention the tradeoff to the user before fixing and let them confirm.
After all fixes are applied (and any project tests pass), commit and push the changes. This must happen before any PR comment activity in step 8 -- otherwise the resolved threads and "addressed" summary describe a diff that isn't on the branch yet, which misleads reviewers.
gh pr checks --required on the open PR. If required checks are FAILING, the new commits are presumed to fix them; proceed. If checks are IN_PROGRESS or QUEUED, prefer to wait so this push doesn't stack on top of the in-flight run. Ask via AskUserQuestion: Wait / Push now.git add -A).fix(scope): address <reviewer> review on PR #N). Append a Co-Authored-By: trailer using the current Claude model name from your runtime environment -- do not hardcode a stale version. Use a HEREDOC so multi-line formatting is preserved.git commit && git push violates the per-command allowlist pattern and breaks the inspect-between-steps discipline.If there are no local file changes (all issues were already fixed in a prior commit, or only Discuss/Optional items remained and the user opted not to fix them), skip this step.
After fixes are committed and pushed (step 7), update the PR to reflect what was addressed.
Use GraphQL to fetch review thread IDs and resolve threads whose issues were fixed. This is safe to do automatically -- resolving is reversible and self-evident from the diff.
# Fetch review threads with their comment bodies and thread IDs
gh api graphql -f query='
query($owner: String!, $repo: String!, $pr: Int!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $pr) {
reviewThreads(first: 100) {
nodes {
id
isResolved
comments(first: 10) {
nodes { body databaseId author { login } }
}
}
}
}
}
}
' -f owner=OWNER -f repo=REPO -F pr=NUMBER
# Resolve a thread
gh api graphql -f query='
mutation($threadId: ID!) {
resolveReviewThread(input: {threadId: $threadId}) {
thread { isResolved }
}
}
' -f threadId=THREAD_NODE_ID
Match each fixed issue back to its review thread by comparing the comment body/path/line from the original fetch. Resolve threads where the underlying issue has been addressed.
For issues that were NOT selected for fixing, draft a reply for each unfixed thread. Present all draft replies to the user for review before posting. Use AskUserQuestion with options:
# Reply to a review comment
gh api repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies \
-f body='MESSAGE'
Reply messages should be concise and include the classification:
Do NOT reply to:
After fixes are pushed (step 7) and threads/replies are handled (step 8), post a single summary comment on the PR. This gives reviewers a clear picture of what was addressed and what remains.
Use AskUserQuestion to confirm before posting. Show the full rendered comment to the user first.
# Post PR-level comment
gh api repos/{owner}/{repo}/issues/{pull_number}/comments \
--raw-field "body=MESSAGE"
Use the following template. Every decision falls into one of five buckets. Keep the overall header, the rollup line, and the "Merge Readiness" section; omit any bucket that has no entries.
The five buckets (derived from analyzing real review-cycle decisions across many merged PRs):
<!-- pr-fix-summary: status report, not actionable review feedback -->
## Review Feedback Summary
**N accepted · M rejected (pre-existing) · K rejected (out-of-scope per #X) · L rejected (style) · P deferred (tracked in #Y)**
### Accepted
| # | Issue | File | Severity | Reviewer |
|---|-------|------|----------|----------|
| 1 | Description of fix | `path/file.ext#L42` | Blocker | reviewer |
### Rejected — Pre-existing
Findings that pre-date this PR. Not introduced by these changes; addressing them would expand scope.
| # | Issue | File | Severity |
|---|-------|------|----------|
| 1 | Brief description | `path/file.ext#L17` | Warning |
### Rejected — Out of Scope
Valid feedback that falls outside the issue's scope contract. Tracked separately.
| # | Issue | Severity | Scope ref | Track |
|---|-------|----------|-----------|-------|
| 1 | Brief description | Warning | Contract: "Out of Scope — migration changes" | [Create issue](ISSUE_URL) |
### Rejected — Style
Debatable style preferences with no correctness impact.
| # | Issue | Severity | Reason |
|---|-------|----------|--------|
| 1 | Brief description | Suggestion | Style preference, no correctness impact |
### Deferred — Tracked in Follow-up
Valid feedback that will be addressed, but not in this PR. Each entry links to its tracking issue.
| # | Issue | Severity | Why deferred | Track |
|---|-------|----------|--------------|-------|
| 1 | Brief description | Warning | Risk outweighs benefit at this stage | [#NNN](url) |
### Merge Readiness
ASSESSMENT
---
*Generated by `/pr-fix`*
The bold line under the header is the rollup. Include it always — it is the line reviewers actually read. Counts must match the bucket tables exactly. Use zero-counts as 0 accepted rather than dropping the term.
For each deferred issue, construct a GitHub "new issue" URL that pre-fills the title and body:
https://github.com/{owner}/{repo}/issues/new?title={ENCODED_TITLE}&body={ENCODED_BODY}
URL-encode the title and body parameters.
Evaluate based on the remaining unaddressed issues:
| Condition | Text |
|---|---|
| All issues addressed, tests pass | Ready to merge -- all review feedback has been addressed. |
| No blockers remain, some warnings/suggestions deferred | Ready to merge with follow-ups -- no blockers remain. N issue(s) deferred for separate tracking. |
| Debatable blockers remain (need discussion) | Needs discussion -- N debatable blocker(s) require reviewer input before merging. |
| Unaddressed blockers remain | Not ready to merge -- N unresolved blocker(s) remain. |
If tests failed and could not be resolved, always mark as not ready regardless of issue status.
0 accepted)/pr-fix) -- never auto-triggerdocs/ journal before closing the loop — if this branch has a
docs/issues/ or docs/features/ doc (see /document), nudge the user to
record what was addressed in this round. Soft reminder, never a blocking gate.@ mention bots or users in the summary comment. Use plain names -- @ mentions can trigger bot actions or unwanted notifications.