Gh pr review

From WaterplanAI/agentic-config · View interactive version

Gh pr review is an AI agent skill from the GitHub repository WaterplanAI/agentic-config. Reviews GitHub PRs with multi-agent orchestration for comprehensive validation. Triggers on keywords: PR review, review PR, GitHub PR review, pull request review

How to use this skill

Skill file

GitHub PR Review

Review the GitHub pull request with comprehensive validation using multi-agent orchestration.

Inputs


Pre-Flight

  1. Extract PR number from URL: $1
  2. Generate UUID for this review session
  3. Create output directory: tmp/mux/{date}-{uuid}/

Step 1: Fetch PR Data

Use gh CLI to gather PR information:

gh pr view <PR_NUMBER> --json title,body,author,state,baseRefName,headRefName,files,additions,deletions,commits
gh pr diff <PR_NUMBER>
gh pr view <PR_NUMBER> --json comments,reviews
gh pr checks <PR_NUMBER>

Store PR metadata for agent context.


Step 2: Launch Review Agents (PARALLEL)

Use the Task tool to spawn 5 agents in parallel. Each agent writes findings to its output file.

Agent 1: Expected Changes Validation

Subagent type: general-purpose

Task: Compare PR diff against expected changes: $2

Agent 2: Security Review

Subagent type: general-purpose

Task: Security review of PR diff

Agent 3: Code Quality Review

Subagent type: general-purpose

Task: Code quality review of PR diff

Agent 4: Test Discovery & Execution

Subagent type: general-purpose

Task: Discover and run tests from PR

Agent 5: Logic & Bug Risk Analysis (CRITICAL)

Subagent type: general-purpose

Model: opus (requires deep reasoning)

Task: Critical evaluation of logic changes and bug introduction risk

Logic Correctness Review
Bug Introduction Risk
Logic Smell Detection
Impact Analysis
Output Format

For each issue found:

[SEVERITY] - [Category]
Location: file:line
Issue: [description]
Why it's a bug: [reasoning]
Fix suggestion: [if applicable]

Step 3: Aggregate Results

After ALL agents complete:

  1. Read all agent summaries from {OUTPUT_DIR}/*.md
  2. Synthesize findings into consolidated report

Step 4: Generate Review Report

Create report at: $3 or tmp/mux/{date}-{uuid}/PR-{PR_NUMBER}-{UUID}.md

Report Template

# PR Review: #{PR_NUMBER}

**URL**: {PR_URL}
**Title**: {PR_TITLE}
**Author**: {AUTHOR}
**Branch**: {HEAD} -> {BASE}
**Review Session**: {UUID}
**Date**: {TIMESTAMP}

---

## Executive Summary

{Overall assessment: APPROVE / REQUEST_CHANGES / NEEDS_DISCUSSION}

### Scores
| Category | Score | Status |
|----------|-------|--------|
| Expected Changes Alignment | X/10 | {emoji} |
| Logic & Bug Risk | X/10 | {emoji} |
| Security | X/10 | {emoji} |
| Code Quality | X/10 | {emoji} |
| Tests | X/10 | {emoji} |

---

## Detailed Findings

### Expected Changes
{From Agent 1}

### Logic & Bug Risk (CRITICAL)
{From Agent 5 - This section requires careful review}

#### Logic Issues Found
{List of logic correctness problems}

#### Potential Bugs Introduced
{List of bug risks with severity and reasoning}

#### Impact Assessment
{Downstream effects and contract changes}

### Security
{From Agent 2}

### Code Quality
{From Agent 3}

### Test Results
{From Agent 4}

---

## PR Review Comments

| File | Line | Severity | Comment |
|------|------|----------|---------|
| path/file.py | 42 | ERROR | Issue description |

---

## PR Review Message

{Copy-paste ready message for GitHub PR comment}

### Recommendation
- APPROVE: Ready to merge
- REQUEST_CHANGES: Must address before merge
- COMMENT: No blocking issues

---

## Next Steps
{Actionable recommendations}

Step 5: Present Results

Output summary to user:

PR REVIEW COMPLETE

PR: #{PR_NUMBER} - {TITLE}
Report: {REPORT_PATH}

Top Issues:
{Critical findings}

Proposed Actions:
1. Post review: gh pr review {PR_NUMBER} --comment --body-file {REPORT}
2. Request changes: gh pr review {PR_NUMBER} --request-changes
3. Approve: gh pr review {PR_NUMBER} --approve

Which action?

Safety

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.