main

ReviewPR Workflow

Perform a thorough code review of a GitHub pull request.

When to Use

  • “review pr”
  • “review pull request”
  • “code review”
  • “check this pr”

Required Tool

Always use gh-pr review --llm to gather PR context:

# From within the repository
gh-pr review <number> --llm

# Or with full URL (works from any directory)
gh-pr review https://github.com/owner/repo/pull/123 --llm

This gathers all context in one call: metadata, files, CI status, existing reviews, comments, commits, and diff.

Workflow

Phase 1: Context Gathering

gh-pr review <number> --llm

Summarize: Problem being solved, scope, files affected, CI status.

Phase 2: Code Analysis

Read all changed files to understand the full context:

  • Files in the diff
  • Related files (imports, tests, configs)

Focus analysis on:

  • Functional correctness and logic bugs
  • Security vulnerabilities
  • Performance issues
  • Edge cases and error handling

Severity classification:

  • CRITICAL: Security vulnerabilities, data loss, breaking changes
  • HIGH: Bugs, performance bottlenecks, resource leaks
  • MEDIUM: Code quality, missing validation, complexity
  • LOW: Style, minor optimizations, documentation

Phase 3: Present Findings

Format findings by file:

## File: path/to/file.go

### L42: [HIGH] Missing error handling
The error from `doSomething()` is ignored, which could cause silent failures.

Suggested fix:
if err := doSomething(); err != nil {
    return fmt.Errorf("failed to do something: %w", err)
}

### L78: [MEDIUM] Complex conditional could be simplified

If no issues found:

No issues found. Code looks clean and ready to merge.

Phase 4: Submit Review

Always ask user before posting reviews.

# Approve
gh pr review <number> --approve --body "LGTM! <summary>"

# Request changes
gh pr review <number> --request-changes --body "<feedback>"

# Comment only
gh pr review <number> --comment --body "<notes>"

Critical Rules

  • DO: Use gh-pr review --llm first, read all relevant files, focus on correctness, ask before posting
  • DON’T: Skip context gathering, post reviews without approval, comment on unchanged lines, nitpick style