pr-comments
npx skills add https://github.com/galelmalah/skills --skill pr-comments
Agent 安装分布
Skill 文档
PR Comment Handler
Process PR comments with a hybrid approach: parallel analysis of all comments, then sequential user decisions via AskUserQuestion.
Core principle: Analyze fast in parallel, decide carefully one at a time.
Workflow
1. Detect the PR
Auto-detect the PR from the current branch. If no PR is found, use AskUserQuestion to ask for the PR number or URL. See references/gh-commands.md for the exact detection command.
2. Fetch All Comments
Fetch both review comments (inline code comments) and issue comments (general PR comments) from the PR. See references/gh-commands.md for exact commands, field details, and filtering.
Filter out:
- Comments authored by the current user
- Bot comments
- Comments that already have a reply from the current user (already handled)
3. Parallel Analysis (Subagents)
Spawn one subagent per comment using the Task tool with subagent_type: "general-purpose". Dispatch all subagents in a single message so they run concurrently. Each subagent:
- Reads the comment body and understands what change is being requested
- Identifies the relevant file(s) and line(s) from the comment context
- Checks the current code to determine if the requested change was already made
- If not addressed, proposes a concrete fix (the actual code change)
- Returns a structured JSON result
See references/subagent-prompt.md for the full prompt template and JSON output format. Use the complete template from the reference file – it includes fields for threading replies back to the correct comment.
4. Present Summary
After all subagents return, present a summary:
PR #123: "Add user authentication"
- 8 comments total
- 3 already addressed
- 5 need your input
5. Sequential Decisions
For each unaddressed comment, use AskUserQuestion:
Question format:
**Comment by @reviewer on `src/auth.ts:42`:**
> Consider using bcrypt instead of md5 for password hashing
**Proposed fix:** Replace the md5 hash call on line 42 with bcrypt.hash(), add bcrypt import, and update the comparison in verifyPassword() on line 58.
How would you like to handle this comment?
Options:
- Accept proposed fix – Implement the proposed change as described
- Fix with custom instructions – User provides their own approach
- Won’t fix – Disagree or out of scope
- Skip for now – Come back to it later
6. Apply Fixes
For each accepted fix:
- Implement the code change
- Reply on the PR comment via
ghwith what was done
For “Won’t fix”:
- Reply on the PR comment explaining the decision
For “Skip”:
- Do nothing, move to the next comment
See references/reply-formats.md for reply comment templates.
7. Final Summary
After processing all comments, show a summary:
Done processing PR #123 comments:
- 3 were already addressed
- 3 fixed (accepted proposed fix)
- 1 fixed (custom instructions)
- 1 won't fix
- 0 skipped
Error Handling
- If
ghis not authenticated, instruct the user to rungh auth login - If a subagent fails to analyze a comment, present the raw comment and ask the user directly
- If a file referenced in a comment no longer exists, mark as “file removed” and ask the user
Additional Resources
Reference Files
references/gh-commands.md– ExactghCLI commands for fetching comments, replying, and detecting PRsreferences/subagent-prompt.md– Full subagent prompt template for comment analysisreferences/reply-formats.md– Reply comment templates andgh apicalls for each decision type