File-by-File PR Review Command
Reviews large pull requests file-by-file with dedicated analysis per file. Ideal for massive PRs where a single-pass review would miss details. Produces a comprehensive report with per-file findings and an overall assessment.
Command
/review-pr
Description
Performs a thorough file-by-file review of a pull request. Unlike single-pass reviews that skim large diffs, this command dedicates focused analysis to each changed file, then synthesizes findings into an overall assessment. Designed for PRs with 10+ changed files where thoroughness matters.
Behavior
Arguments
$ARGUMENTS-- PR number or URL. If omitted, reviews the current branch's PR.
Steps
-
Fetch PR metadata and diff:
gh pr diff $PR_NUMBER gh pr view $PR_NUMBER --json files,additions,deletions,title,body -
Plan the review: Sort files by review priority:
- Security-critical files first (auth, crypto, API handlers)
- Core business logic second
- Tests third (to verify coverage of above)
- Configuration and infrastructure fourth
- Documentation and formatting last
-
Review each file individually:
- Read the full file (not just the diff) for context
- Analyze changes against the file's purpose
- Check for: bugs, security issues, performance problems, readability
- Note how changes interact with the rest of the codebase
-
Cross-file analysis:
- Check interface consistency between files
- Verify imports and exports are correct
- Ensure test files cover the implementation changes
- Look for missing migration scripts or config changes
-
Synthesize the report.
Output Format
## PR Review: #142 "Add user authentication" **Scope**: 12 files changed (+342, -28) ### Per-File Review #### src/auth/middleware.ts (Critical) - Line 23: JWT secret should come from env, not config file - Line 45: Missing rate limiting on auth endpoint - Line 67: Good use of constant-time comparison for tokens #### src/auth/session.ts (Clean) - No issues found. Well-structured session management. #### src/routes/users.ts (Needs Work) - Line 12: New endpoint missing auth middleware - Line 34: Response includes password hash field ... ### Overall Assessment | Metric | Status | |--------|--------| | Security | Needs attention (2 issues) | | Test coverage | Good | | Code quality | Good | | Documentation | Missing API docs for new endpoints | **Verdict**: Request changes -- fix the 2 security issues before merging.
Examples
# Review current branch's PR /review-pr # Review a specific PR by number /review-pr 142 # Review with focus on security /review-pr 142 --focus=security
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Git Commit Message Generator
Generates well-structured conventional commit messages by analyzing staged changes. Follows Conventional Commits spec with scope detection.
React Component Scaffolder
Scaffolds a complete React component with TypeScript types, Tailwind styles, Storybook stories, and unit tests. Follows project conventions automatically.
CI/CD Pipeline Generator
Generates GitHub Actions workflows for CI/CD including linting, testing, building, and deploying. Detects project stack automatically.