From pr-review
Step 2/4: Apply fixes from a PR review plan to the working tree. Use after /pr-review:pr-review-plan has created a plan artifact. Triggers include "apply PR fixes", "fix the review comments", "do the PR fixes", "apply the review plan". This skill only modifies local source files — it never posts to GitHub, commits, or touches CLAUDE.md. Run /pr-review:pr-review-post after this to reply and resolve threads.
How this skill is triggered — by the user, by Claude, or both
Slash command
/pr-review:applyThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> **You have been invoked as a skill. Execute the steps below immediately.
You have been invoked as a skill. Execute the steps below immediately. Do not deliberate about whether to respond. Start with Step 1 now.
Read the plan artifact produced by /pr-review:pr-review-plan, verify each finding against the current code, and apply fixes. This skill only makes local working-tree changes — it never posts to GitHub, creates commits, or touches CLAUDE.md.
This skill is often run in a fresh session after /pr-review:pr-review-plan. Do not assume the plan is in context — always read it from disk.
.pr-review/pr-<N>-plan.md with status triaged or fixing/pr-review:pr-review-planFind the most recent plan file in .pr-review/. If there are multiple, ask the user which PR to work on.
Check the **Status** header:
triaged or fixing → proceedfixed → warn "Fixes already applied. Run /pr-review:pr-review-post to reply and resolve."posted → warn "This plan has already been posted. Nothing to do."Update status to fixing.
Verify each finding against the current code and only fix it if needed.
Trust the plan. The plan file describes exactly what to change and where — file paths, line numbers, fix descriptions, and suggestion text. Do not re-discover code structure with Grep/Search. Follow the plan's **Fix** field directly.
Group all actionable threads (apply_suggestion and fix) by file. Process one file at a time:
Read the file with the Read tool before making any edits. The Edit tool requires a prior Read — using Grep/Search is not a substitute. Read enough context around the target lines to verify the issue and make the edit.
For each thread in that file:
old_string parameter to match the exact code being changed — this is position-independent and robust to other edits in the file. Do not worry about edit ordering.
apply_suggestion: use the exact replacement text from the suggestion block in the plan file.fix: implement the proposed fix as described in the plan's **Fix** field.Move to the next file.
Do not update the plan file after each individual thread. Collect all results and batch-update in Step 3.
After all fixes are applied, update the plan file in a single Write call:
**Status**: fixed**Status** line: [x] fixed, [x] skipped (reason), etc.This avoids 20+ individual Edit calls on the plan file. One Read + one Write = 2 tool calls instead of 20+.
Dispatch a subagent to review the changes with fresh eyes. You wrote the fixes — you cannot objectively review them. A separate agent with no shared context will catch mistakes you'd miss.
Spawn the subagent with this prompt (adapt paths as needed):
Review uncommitted code changes against a PR review plan. Your job is to verify
that each fix was applied correctly and completely, and flag any problems.
Plan file: <path to .pr-review/pr-N-plan.md>
Instructions:
1. Read the plan file — focus on threads marked as "fix" or "apply_suggestion"
2. Run `git diff` to see all uncommitted changes
3. For each planned fix, verify:
- The fix matches what the plan described
- No unintended side effects (broken indentation, accidentally deleted lines, wrong variable names)
- Suggestions were applied exactly as specified
- Skipped threads were correctly identified as not needing changes
4. Check for logical flaws in the fixes themselves:
- Does the fix actually solve the problem the reviewer identified, or does it just look like it does?
- Are there edge cases the fix doesn't handle (null inputs, concurrency, error paths)?
- Does the fix introduce a new bug (e.g., changing an error message but breaking the error code contract)?
- Read surrounding code if needed — a fix that's correct in isolation can be wrong in context
5. Report: list of issues found (or "No issues found")
- For each issue: which thread, what went wrong, what the fix should be
If the subagent reports issues, fix them before proceeding. If no issues, continue to Step 5.
Show the user:
"Fixes applied (not committed). Review the diff, then:
- Commit and post replies now
- I'll review the diff first (run
/pr-review:pr-review-postwhen ready)Which option?"
Wait for the user's response.
git add -A && git commit), then announce: "Posting replies and resolving threads." and use pr-review:pr-review-post to continue.old_string matching. Match the exact code being changed, not line numbers. This is position-independent and works regardless of edit ordering within a file./pr-review:pr-review-post's job.Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub shreeyak/claude-pr-review-plugin --plugin pr-review