Review a GitHub PR against standards
Analyzes GitHub pull requests for code quality issues and triggers cognitive complexity assessments for large changes.
/plugin marketplace add jeffweiss/elixir-production/plugin install elixir-production@jeffweiss<pr-number>sonnetAutomated GitHub Pull Request review using gh CLI and pr-reviewer agent. Checks code against project standards, identifies issues, and triggers cognitive complexity analysis for large changes.
Reviews GitHub PRs comprehensively:
gh CLI to get PR data, diff, changed filesRequired:
gh CLI installed and authenticatedSetup:
# Install gh CLI
brew install gh # macOS
# or apt install gh # Linux
# Authenticate
gh auth login
# Verify access
gh pr list
# Review specific PR
/pr-review 123
# Review current branch's PR
/pr-review
# Review with PR URL
/pr-review https://github.com/owner/repo/pull/456
Fetch PR metadata, diff, and changed files using gh CLI:
gh pr view 123 --json number,title,body,author,files,additions,deletions
gh pr diff 123
gh pr view 123 --json files --jq '.files[].path'
Check if PR crosses thresholds for cognitive review:
For all PRs - Launch pr-reviewer agent to check against project standards (AGENTS.md, CLAUDE.md, project-learnings.md).
For large PRs - Also launch cognitive-scientist agent to analyze complexity, working memory load, and onboarding difficulty.
Pr-reviewer agent analyzes changed files, rates confidence for each issue, and reports only issues with ā„80% confidence. See production-quality skill for code quality standards and cognitive-complexity skill for complexity analysis.
Post review as PR comment:
gh pr comment 123 --body "$(cat review.md)"
PR not found: Verify PR number and repository access.
Not in git repository: Navigate to project root.
gh CLI not authenticated: Run gh auth login.
## Code Review Summary
### š Change Statistics
- Files changed: N
- Lines added: +N
- Lines deleted: -N
- Complexity: Low/Medium/High
### ā
Strengths
- [Positive observations about the code]
### ā ļø Issues Found
#### [Critical/Important] Issue description (Confidence: N%)
**File**: `path/to/file.ex:line`
**Issue**: Clear description of the problem
**Recommendation**:
```elixir
# Code fix
Large change: N lines across N files
Findings:
Detection status and migration readiness if applicable.
/precommit before mergingš¤ Generated with Claude Code - Elixir Production Plugin
## Configuration
**Review strictness**:
- **Standard** (default): Confidence ā„80%
- **Strict**: Confidence ā„70%
- **Lenient**: Confidence ā„90%
**Cognitive threshold**: 500+ lines OR 5+ files triggers cognitive analysis.
## Confidence Ratings
**90-100% (Critical)**:
- Missing tests (objective)
- Missing typespecs (objective)
- Security vulnerabilities (clear evidence)
- Project convention violations (documented)
**80-89% (Important)**:
- Logic bugs (clear evidence)
- Performance issues (measurable)
- Missing error handling (likely needed)
- Pattern violations (established pattern)
**< 80% (Not reported)**:
- Subjective style preferences
- Speculative improvements
- Uncertain issues
## gh CLI Commands Reference
```bash
# View PR
gh pr view <number>
gh pr view <number> --json title,body,author,files,additions,deletions
# Get diff
gh pr diff <number>
# List changed files
gh pr view <number> --json files --jq '.files[].path'
# Post comment
gh pr comment <number> --body "review text"
# Post review (approve/request changes)
gh pr review <number> --comment --body "review text"
gh pr review <number> --approve --body "LGTM!"
gh pr review <number> --request-changes --body "Please address..."
# Check CI status
gh pr checks <number>
# List PRs
gh pr list --state open --limit 10
/review - Local code review (before PR)/precommit - Run quality checks/cognitive-audit - Deep complexity analysis/spike-migrate - Upgrade SPIKE code found in PRFor code quality standards, see production-quality skill. For cognitive complexity analysis, see cognitive-complexity skill.
Review succeeds when:
/pr-reviewConduct comprehensive PR review from multiple perspectives (PM, Developer, QA, Security)
/pr-reviewReviews pull request changes to provide feedback, check for issues, and suggest improvements before merging into the main codebase.