From multi-agents
This skill should be used when the user asks to "fix a PR", "fix pull request", "fix PR issues", "review and fix PR", or wants an iterative multi-agent review + fix loop that automatically resolves issues found in a GitHub pull request.
How this skill is triggered — by the user, by Claude, or both
Slash command
/multi-agents:fix-prThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Review a GitHub PR using multiple AI agents in parallel, then iteratively fix the issues found until the PR is clean. Unlike `review-pr` which only posts a review comment, this skill actively modifies code to resolve issues.
Review a GitHub PR using multiple AI agents in parallel, then iteratively fix the issues found until the PR is clean. Unlike review-pr which only posts a review comment, this skill actively modifies code to resolve issues.
The user provides a PR number or URL (e.g., 42 or https://github.com/owner/repo/pull/42). Extract the PR number from the argument. Also extract any --skip {name} flags and pass them to Agent Resolution for exclusion.
Follow the procedure in references/agent-resolution.md to build the agent roster.
Fetch the PR metadata and check out the PR branch first:
gh pr view <PR_NUMBER> --json title,body,baseRefName,headRefName
gh pr checkout <PR_NUMBER>
After checkout, detect the gh pr-review extension and store flags:
REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)
gh pr-review --version 2>/dev/null
Store has_pr_review_ext (true if exit code 0, false otherwise) and REPO. Refer to the PR Review Extension section in references/agent-catalog.md for the full command reference.
Check for uncommitted local changes:
git status --short
If there are uncommitted changes that overlap with the PR files, warn the user — these may represent prior fixes that haven't been committed yet. Ask whether to include them or stash them.
Generate the diff locally against the base branch (more reliable than gh pr diff which only reflects the remote state):
mkdir -p pr-reviews
BASE_BRANCH=$(gh pr view <PR_NUMBER> --json baseRefName -q .baseRefName)
git diff ${BASE_BRANCH}...HEAD > pr-reviews/pr<PR_NUMBER>.diff
Large diff guard: Check wc -l pr-reviews/pr<PR_NUMBER>.diff. If the diff exceeds 5000 lines, warn the user — agents (especially Codex, which embeds diffs inline) may hit token limits or produce lower-quality reviews on very large diffs. Ask whether to proceed or focus on specific files.
Fetch existing review comments and conversations — these are first-class issues to fix. Use one of two paths depending on has_pr_review_ext:
When has_pr_review_ext is true — use structured JSON for review threads plus REST for issue-level comments:
gh pr-review review view -R ${REPO} --pr <PR_NUMBER> --unresolved > pr-reviews/pr<PR_NUMBER>.review-threads.json
gh api repos/${REPO}/issues/<PR_NUMBER>/comments --jq '.[] | "[\(.user.login)] — \(.body)"' > pr-reviews/pr<PR_NUMBER>.comments 2>/dev/null
The review-threads.json contains structured data with thread_id, path, line, body, and is_resolved for each thread. This is preferred over REST for better parsing and thread ID access.
Fallback (when has_pr_review_ext is false) — current REST API approach:
gh api repos/${REPO}/pulls/<PR_NUMBER>/comments --jq '.[] | "[\(.user.login)] \(.path):\(.line // .original_line) — \(.body)"' > pr-reviews/pr<PR_NUMBER>.comments 2>/dev/null
gh api repos/${REPO}/pulls/<PR_NUMBER>/reviews --jq '.[] | select(.body != "") | "[\(.user.login)] (\(.state)) — \(.body)"' >> pr-reviews/pr<PR_NUMBER>.comments 2>/dev/null
gh api repos/${REPO}/issues/<PR_NUMBER>/comments --jq '.[] | "[\(.user.login)] — \(.body)"' >> pr-reviews/pr<PR_NUMBER>.comments 2>/dev/null
Read the diff and comments/threads files to understand the scope, context, and any prior feedback.
Parse the fetched comments into an initial issues list. Apply the PR Comment Filtering rules from the catalog to skip CI bot noise, quota messages, and auto-generated summaries. Focus on actionable feedback from human reviewers and code review bots with severity-tagged findings.
When has_pr_review_ext is true: Parse review-threads.json to extract structured issues. For each unresolved thread, preserve the thread_id alongside the issue data. Maintain a mapping for each actionable issue:
{thread_id, severity, path, line, description}
This mapping is persisted across loop iterations so that threads can be resolved after fixes are applied (Step 3g).
Fallback: Parse the plain-text .comments file as before (no thread IDs available).
Categorize each piece of actionable feedback by severity:
These existing review comments are treated as first-class issues alongside multi-agent findings — the skill should attempt to address unresolved feedback from human reviewers too.
Track iteration count starting at 1. For each iteration:
Run ALL agents from the resolved roster in parallel using run_in_background: true on each Bash call. Each agent reviews the current diff.
For each agent in the roster, build the review command using the agent's one-shot command template from the catalog:
printf + cat.-m {model} for OpenCode).timeout: 600000 (600 seconds / 10 minutes) on each Bash call per the catalog's common conventions.Review prompt (adapt per agent's prompt passing strategy from the catalog):
Review the PR diff for correctness, bugs, security issues, architecture patterns, performance, and code quality.
Focus on logic errors, edge cases, and best practices.
Consider the existing review comments below — do not duplicate issues already raised, and note if prior feedback has been addressed or not.
Output your findings as a structured list with severity labels (critical/major/minor).
If the code looks clean with no significant issues, explicitly state "No critical or major issues found."
--- DIFF ---
{diff content or file reference}
--- EXISTING REVIEW COMMENTS ---
{comments content or file reference}
Collect results following the Result Collection and Output Validation rules from the catalog: collect TaskOutput sequentially (never in parallel), handle timeouts with TaskStop, and discard useless output without treating it as "no issues found."
After all tools finish (or time out):
If there are no critical or major issues (from agents or existing reviews), exit the loop and proceed to Step 4 (Final Report).
Display the categorized issues to the user briefly, then proceed directly to fixing them. No confirmation needed — the skill auto-fixes all critical and major issues.
Read the relevant source files and apply fixes for all critical and major issues (both from multi-agent review AND existing PR feedback). Only fix critical and major issues — minor issues are listed but not auto-fixed to avoid churn.
For each fix:
Run tests before committing if the project has a test command (check CLAUDE.md or common patterns like dotnet test, npm test, pytest, go test, etc.). If tests fail, fix the issues before committing.
After all fixes are applied and tests pass, create a commit. Stage only the files you modified — do NOT use git add -A or git add . which may accidentally include unrelated changes:
git add {list of specific files modified}
git commit -m "fix: address review findings (iteration {N})
- {brief description of each fix}
Fixes identified by multi-agent review ({display_name_1}, {display_name_2}, ...)"
Push the fix commit to the remote so the PR is updated:
git push
Then re-generate the diff locally for the next review iteration:
git diff ${BASE_BRANCH}...HEAD > pr-reviews/pr<PR_NUMBER>.diff
When has_pr_review_ext is true, also refresh the thread data so the next iteration sees up-to-date resolution status:
gh pr-review review view -R ${REPO} --pr <PR_NUMBER> --unresolved > pr-reviews/pr<PR_NUMBER>.review-threads.json
has_pr_review_ext is true)Only when has_pr_review_ext is true. After pushing fixes, resolve the review threads for issues that were actually fixed in this iteration.
For each fixed issue that has a thread_id, run sequentially (NOT in parallel):
Reply to the thread with what was fixed:
gh pr-review comments reply <PR_NUMBER> -R ${REPO} \
--thread-id <THREAD_ID> --body "Fixed in $(git rev-parse --short HEAD). {brief description of the fix}"
Resolve the thread:
gh pr-review threads resolve --thread-id <THREAD_ID> -R ${REPO} <PR_NUMBER>
Rules:
Then loop back to step 3a for re-review.
Display a summary to the user:
## Fix PR Summary
### Iterations: {count}
### Issues Found & Fixed
{for each iteration:}
**Iteration {N}:**
- {list of critical/major issues found and fixed}
### Remaining Minor Issues
{list of minor issues that were not auto-fixed, if any}
### Commits Made
{list of commit hashes and messages from each iteration}
### Status
{either "All critical/major issues resolved" or "Max iterations (3) reached — {N} issues remain"}
If max iterations (3) were reached and issues remain, ask the user if they want to continue with more iterations.
rm -f pr-reviews/pr<PR_NUMBER>.diff pr-reviews/pr<PR_NUMBER>.comments pr-reviews/pr<PR_NUMBER>.review-threads.json
rmdir pr-reviews 2>/dev/null
review-pr, this skill fixes instead of reporting. The fixes themselves are the output.gh pr-review thread resolution (Step 3g) never blocks the fix loop. If it fails, the fix was still applied.gh pr-review is available, structured thread data provides thread IDs for resolution and better parsing than the REST API's plain-text output.git diff <base>...HEAD instead of gh pr diff to ensure the diff reflects local commits that haven't been pushed yet.git add -A; only stage the files that were actually modified for the fix.gh is not authenticated, prompt the user to run gh auth logingh pr-review extension commands fail during thread resolution (Step 3g), log the error and continue — thread resolution is best-effort and never blocks the fix loopgh pr-review review view fails during comment fetching (Step 1), fall back to the REST API approach for that iterationgh pr-review is installed but returns errors for a specific PR (e.g., permissions), silently fall back to REST-based comment fetchingnpx claudepluginhub quabug/multi-agents-plugin --plugin multi-agentsSuggests optimal commands for iterative PR review and autofix loops, including review cycles, fixing comments, and Codex reviews. Useful for automating PR checks and resolutions.
Resolves GitHub PR issues including review comments, CI failures via triage-dispatch workflow with code edits, replies, and verification.
Automates GitHub PR review-fix loops: requests bot reviews via @mentions, polls comments with GitHub CLI, analyzes issues, fixes code, runs internal review, pushes changes, repeats until no critical issues.