Fetches PR review comments from GitHub, batches similar comments together using semantic analysis, and walks through each batch one at a time with user confirmation between each. Tracks progress in REVIEW_COMMENT_WORK.md for resumability. Use when the user wants to address PR review feedback, fix review comments, or work through code review suggestions.
This skill helps you systematically work through PR review comments by batching similar ones together and addressing them one batch at a time with user feedback between each.
REVIEW_COMMENT_WORK.md exists in the current directoryFirst, check if REVIEW_COMMENT_WORK.md exists in the current working directory:
ls -la REVIEW_COMMENT_WORK.md 2>/dev/null
Run the script to fetch unresolved PR review comments:
~/.pi/agent/skills/pr-review-comments/get_pr_review_comments
This will create individual {comment-id}-review-feedback.md files in the current directory.
List all the generated comment files:
ls -la *-review-feedback.md 2>/dev/null
Each file contains:
Use the task tool to investigate comments in parallel. Spawn a task for each comment file to analyze it independently. This significantly speeds up the triage process.
For each comment, the task should read the comment file, examine the relevant code and context, and determine:
Example task invocation:
task({
tasks: [
{ description: "Analyze PR comment PRRC_abc-review-feedback.md: Read the comment file, examine the referenced code at [file:line], determine if the feedback is valid/applicable. Return: comment ID, file:line, issue summary, verdict (INCLUDE/QUESTIONABLE/EXCLUDE), and reasoning." },
{ description: "Analyze PR comment PRRC_def-review-feedback.md: Read the comment file, examine the referenced code at [file:line], determine if the feedback is valid/applicable. Return: comment ID, file:line, issue summary, verdict (INCLUDE/QUESTIONABLE/EXCLUDE), and reasoning." },
// ... one task per comment file
]
})
Each task should classify its comment as:
Collect results from all tasks before proceeding to batching.
Group INCLUDE comments into batches based on semantic similarity. Consider:
For each batch, note:
Important: A batch can be a single comment if it's unique. Don't force unrelated comments together.
Create the work file as a scratchpad and todo list. Use whatever format feels natural, but include:
Example structure (adapt as needed):
# PR Review Comment Work
## Current State
Phase: Awaiting triage approval
## Triage Summary
### Included (5 comments → 2 batches)
| Comment | File | Issue | Verdict |
|---------|------|-------|---------|
| PRR_abc | auth.py:45 | Add try/catch | ✅ Valid |
| PRR_def | user.py:112 | Handle network errors | ✅ Valid |
| PRR_ghi | Header.tsx:23 | Typo "recieve" | ✅ Valid |
### Questionable (1 comment)
| Comment | File | Issue | Concern |
|---------|------|-------|---------|
| PRR_jkl | api.py:89 | Add rate limiting | ⚠️ Out of scope for this PR |
### Excluded (1 comment)
| Comment | File | Issue | Reason |
|---------|------|-------|--------|
| PRR_mno | utils.py:34 | Unused import | ❌ Import is actually used on line 156 |
## Batches (pending approval)
### Batch 1: Error Handling
**Files**: auth.py, user.py
**Comments**: PRR_abc, PRR_def
### Batch 2: Typos
**Files**: Header.tsx
**Comments**: PRR_ghi
## Notes
- (scratchpad space)
STOP and present a CONCISE overview to the user. Format:
PR Review Triage
Will address (N comments in M batches):
- Batch 1 - [Name]: [brief description] (N comments)
- Batch 2 - [Name]: [brief description] (N comments)
Questionable (need your input):
- [file:line] - [issue] — [your concern]
Recommending to skip:
- [file:line] - [issue] — [reason]
Let me know if you want to exclude anything, include something I flagged, or adjust the batches.
WAIT for user response. Do not proceed until they approve or provide feedback.
Process user feedback:
Update REVIEW_COMMENT_WORK.md with any changes.
If changes were made, present the updated overview and ask for approval again.
Once approved, update work file:
[PENDING]Proceed to Working on a Batch.
Read REVIEW_COMMENT_WORK.md to understand:
Before starting work, update REVIEW_COMMENT_WORK.md:
[IN PROGRESS]Use tasks for investigation, but make edits sequentially.
If the batch has multiple comments, consider using parallel tasks to investigate each comment's context before making changes:
task({
tasks: [
{ description: "Investigate comment PRRC_abc: Read [file] around line [N], understand the current implementation, and recommend the specific change needed to address: '[comment summary]'. Do NOT make edits." },
{ description: "Investigate comment PRRC_def: Read [file] around line [N], understand the current implementation, and recommend the specific change needed to address: '[comment summary]'. Do NOT make edits." },
]
})
After gathering investigation results, make the actual code changes sequentially (to avoid edit conflicts):
cd backend && make lintcd frontend && ENV=local bun run lintImportant: The comment files contain specific instructions. Follow them, especially the verification steps.
After addressing each comment in the batch, resolve the thread on GitHub using the resolve-pr-comment skill:
Get the PR's review threads to find the thread ID for each comment:
gh api graphql -f query='
query {
repository(owner: "OWNER", name: "REPO") {
pullRequest(number: PR_NUMBER) {
reviewThreads(first: 100) {
nodes {
id
isResolved
comments(first: 1) {
nodes { id }
}
}
}
}
}
}'
Find the thread where comments.nodes[0].id matches your comment ID (e.g., PRRC_...). The parent id is the thread ID (PRRT_...).
Resolve the thread:
gh api graphql -f query='
mutation {
resolveReviewThread(input: {threadId: "PRRT_..."}) {
thread { isResolved }
}
}'
After completing the batch:
Update REVIEW_COMMENT_WORK.md:
[DONE]Delete the processed comment files for this batch:
rm {comment-id}-review-feedback.md
STOP and ask the user:
"Batch N complete. I [brief summary of changes made].
Any feedback on these changes, or should I proceed to Batch N+1?"
WAIT for the user's response. Do not proceed until they respond.
When all batches are marked as done:
REVIEW_COMMENT_WORK.md to reflect completionresolve-pr-comment skill