github-pr-review
Scannednpx machina-cli add skill fvadicamo/dev-agent-skills/github-pr-review --openclawGitHub PR review
Resolves Pull Request review comments with severity-based prioritization, fix application, and thread replies.
Current PR
!gh pr view --json number,title,state,milestone -q '"PR #\(.number): \(.title) (\(.state)) | Milestone: \(.milestone.title // "none")"' 2>/dev/null
Core workflow
1. Fetch and classify comments
Fetch both inline comments and PR-level reviews (needed for CodeRabbit "outside diff" comments):
REPO=$(gh repo view --json nameWithOwner -q '.nameWithOwner')
PR=$(gh pr view --json number -q '.number')
# Inline review comments - filter out replies (keep only originals)
gh api repos/$REPO/pulls/$PR/comments --jq '
[.[] | select(.in_reply_to_id == null) |
{id, path, user: .user.login, body: .body[0:200]}]
'
# PR-level reviews with non-empty body (CodeRabbit "outside diff" comments)
gh api repos/$REPO/pulls/$PR/reviews --jq '
[.[] | select(.body | length > 0) |
{id, user: .user.login, state, body: .body[0:200]}]
'
For PR-level reviews, parse the body for CodeRabbit <details> blocks containing
"outside diff" comments - extract file path, line range, and comment text from each block.
Classify all originals by severity and process in order: CRITICAL > HIGH > MEDIUM > LOW.
| Severity | Indicators | Action |
|---|---|---|
| CRITICAL | critical.svg, _๐ Security_, _๐ด Critical_, "security", "vulnerability" | Must fix |
| HIGH | high-priority.svg, _โ ๏ธ Potential issue_, _๐ Bug_, _๐ Major_, "High Severity" | Should fix |
| MEDIUM | medium-priority.svg, _๐ก Suggestion_, "Medium Severity" | Recommended |
| LOW | low-priority.svg, _๐งน Nitpick_, _๐ง Optional_, _๐ก Minor_, "style", "nit" | Optional |
See references/severity_guide.md for full detection patterns (Gemini badges, CodeRabbit emoji, Cursor comments, keyword fallback, related comments heuristics).
2. Process each comment
For each comment, in severity order:
- Show context: comment ID, severity, file:line, quote
- Read affected code and propose fix
- Confirm with user before applying
- Apply fix if approved
- Verify ALL issues in the comment are addressed (multi-issue comments are common)
3. Commit changes
Use git-commit skill format. Functional fixes get separate commits, cosmetic fixes are batched:
| Change type | Strategy |
|---|---|
| Functional (CRITICAL/HIGH) | Separate commit per fix |
| Cosmetic (MEDIUM/LOW) | Single batch style: commit |
Reference the comment ID in the commit body.
4. Reply to threads
Important: use --input - with JSON. The -f in_reply_to=... syntax does NOT work.
COMMIT=$(git rev-parse --short HEAD)
gh api repos/$REPO/pulls/$PR/comments \
--input - <<< '{"body": "Fixed in '"$COMMIT"'. Brief explanation.", "in_reply_to": 123456789}'
Reply templates (no emojis, minimal and professional):
| Situation | Template |
|---|---|
| Fixed | Fixed in [hash]. [brief description of fix] |
| Won't fix | Won't fix: [reason] |
| By design | By design: [explanation] |
| Deferred | Deferred to [issue/task]. Will address in future iteration. |
| Acknowledged | Acknowledged. [brief note] |
5. Run tests and push
Run the project test suite. All tests must pass before pushing. Push all fixes together to minimize review loops.
6. Submit review (optional)
After addressing all comments, formally submit a review:
gh pr review $PR --approve --body "..."- all comments addressed, PR is readygh pr review $PR --request-changes --body "..."- critical issues remaingh pr review $PR --comment --body "..."- progress update, no decision yet
7. Verify milestone
gh pr view $PR --json milestone -q '.milestone.title // "none"'
If the PR has no milestone, check for open milestones:
REPO=$(gh repo view --json nameWithOwner -q '.nameWithOwner')
gh api repos/$REPO/milestones --jq '[.[] | select(.state=="open")] | .[] | "\(.number): \(.title)"'
If open milestones exist, inform the user and suggest assigning:
gh pr edit $PR --milestone "[milestone-title]"
Do not assign automatically. This is a reminder only.
Avoiding review loops
When bots (Gemini, Codex, etc.) review every push:
- Batch fixes: accumulate all fixes, push once
- Draft PR: convert to draft during fixes
- Commit keywords: some bots respect
[skip ci]or[skip review]
Important rules
- ALWAYS confirm before modifying files
- ALWAYS verify ALL issues in multi-issue comments are fixed
- ALWAYS run tests before pushing
- ALWAYS reply to resolved threads using standard templates
- ALWAYS submit formal review (
gh pr review) after addressing all comments - ALWAYS check milestone at the end and remind if missing
- NEVER use emojis in commit messages or thread replies
- NEVER skip HIGH/CRITICAL comments without explicit user approval
- NEVER assign milestone automatically - suggest only
- Functional fixes -> separate commits (one per fix)
- Cosmetic fixes -> batch into single
style:commit
References
references/severity_guide.md- Severity detection patterns (Gemini badges, Cursor comments, keyword fallback, related comments heuristics)
Source
git clone https://github.com/fvadicamo/dev-agent-skills/blob/main/skills/github-pr-review/SKILL.mdView on GitHub Overview
This skill automates handling GitHub PR reviews. It fetches inline and PR-level comments via the GitHub CLI, classifies them by severity, guides fixes with user confirmation, commits changes in the proper format, and replies to threads to close feedback.
How This Skill Works
The skill uses gh to pull the current PRโs comments, including inline and review threads. It classifies each original comment by severity (CRITICAL, HIGH, MEDIUM, LOW) and processes them in order, proposing code changes and awaiting user confirmation before applying. After applying fixes, it commits changes using the prescribed git-commit format (with separate commits for functional fixes and a batched style commit for cosmetics) and replies to the corresponding threads via the GitHub API.
When to Use It
- When you need to resolve or triage PR review comments before merging.
- When addressing reviewer feedback and applying fixes across the PR.
- When verifying PR readiness and checking review status.
- When replying to reviewer threads after making changes.
- When prioritizing and organizing review feedback by severity for efficient fixes.
Quick Start
- Step 1: Fetch the PR comments and classify by severity using gh.
- Step 2: For each comment (CRITICAL/HIGH first), propose fixes, confirm, apply, and verify.
- Step 3: Commit fixes in the prescribed format and reply to threads with the appropriate templates.
Best Practices
- Fetch both inline comments and PR-level reviews to get the full context of feedback.
- Classify comments by severity (CRITICAL > HIGH > MEDIUM > LOW) before acting.
- Ask for explicit user confirmation before applying any fix.
- Commit functional fixes separately from cosmetic changes, and reference the comment IDs in commit messages.
- Reply to threads using the prescribed templates and the gh api with --input - to ensure proper threading.
Example Use Cases
- A critical security-related comment is found; the skill proposes a fix, applies it after confirmation, commits it, and replies in the thread with a summary.
- Multiple HIGH severity issues are identified; separate commits are created for each fix, followed by thread replies explaining the changes.
- A MEDIUM-level refactor suggestion is accepted and batched into a single cosmetic commit with a style-focused message.
- CodeRabbit 'outside diff' comments are parsed and addressed with precise file/line updates and corresponding PR-level replies.
- All comments are resolved, and the tool suggests submitting the final PR review with a concise summary.