Review a GitHub PR and provide a comprehensive summary with documentation links.
Comprehensive PR review for junior engineers that analyzes code patterns, checks consistency with existing codebase, and provides educational summaries with documentation links. Includes manual testing instructions and data setup requirements.
/plugin marketplace add aaronmaturen/claude-plugin/plugin install atm@aaronmaturen-pluginsReview a GitHub PR and provide a comprehensive summary with documentation links.
PR URL: $ARGUMENTS
Parse PR Information
https://github.com/{owner}/{repo}/pull/{number}Setup PR for Review
git stash push -m "PR review backup"git branch --show-current > .pr-review-original-branchgh pr checkout {number} --repo {owner}/{repo}git diff {original-branch}...HEAD -- package.json requirements.txt Gemfile go.modFetch PR Overview
gh pr view {number} --repo {owner}/{repo} --json title,body,state,author,createdAt,files,additions,deletionsgh pr diff {number} --repo {owner}/{repo} - Get the full diffAnalyze Changed Files
Pattern Consistency Check
Search Existing Codebase for similar implementations:
Compare PR Patterns with established ones:
Examples to Look For:
Create Junior-Friendly Summary
For each significant change:
Search Documentation (context7)
Learning Points
Testing Strategy
Manual Testing Steps:
Data Setup Requirements:
Edge Cases to Test:
Test Data Examples:
// Example user for testing auth
{
"email": "test@example.com",
"password": "TestPass123!",
"role": "admin"
}
Questions to Ask
# PR Review: Add User Authentication (#123)
## Overview
This PR adds JWT-based authentication to our API. It affects 15 files
and introduces middleware for protecting routes.
## Key Changes Explained
### 1. Authentication Middleware (auth.middleware.ts)
**What**: New file that checks if requests have valid JWT tokens
**Why**: We need to protect sensitive API endpoints
**How**:
- Extracts token from Authorization header
- Verifies token signature
- Attaches user info to request
📚 JWT Documentation: https://jwt.io/introduction
### 2. User Model Updates (user.model.ts)
**What**: Added password hashing methods
**Why**: Never store plain text passwords
**How**: Uses bcrypt to hash passwords before saving
📚 Password Hashing Best Practices: https://auth0.com/blog/hashing-passwords-one-way-road-to-security/
## Pattern Consistency Analysis
### ✅ Follows Existing Patterns:
- **Error Handling**: Uses established `AppError` class from `src/utils/errors.ts`
- **Response Format**: Matches existing API response structure `{ data, status, message }`
- **Middleware Pattern**: Consistent with existing middleware in `src/middleware/`
### ⚠️ Modified Patterns:
- **JWT Storage**: Changed from localStorage to httpOnly cookies (Security improvement)
- Justification: Prevents XSS attacks
### ❌ New Patterns Introduced:
- **Token Refresh**: Added refresh token rotation
- Justification: No existing refresh mechanism found
- Consider: Should align with planned OAuth implementation
## Testing Instructions
### Data Setup
1. Create test database with:
```sql
INSERT INTO users (email, password_hash, role) VALUES
('admin@test.com', '$2b$10$...', 'admin'),
('user@test.com', '$2b$10$...', 'user');
JWT_SECRET=test-secret-key
JWT_EXPIRY=1h
# If using Docker:
docker-compose up -d
docker-compose exec app npm install # Install any new dependencies
# If not using Docker:
npm install # or yarn install
npm run db:migrate # Run any new migrations
Test Login Flow:
Test Protected Routes:
## Cleanup (After Review Complete):
```bash
# When ready to return to original work:
git checkout $(cat .pr-review-original-branch)
# Restore stashed work
git stash pop
# Clean up
rm .pr-review-original-branch
# Optionally delete PR branch locally
git branch -D pr-branch-name
Note: Stay on the PR branch while reviewing and testing. Only run cleanup when completely done.
gh) to be installed and authenticated/pr-reviewConduct comprehensive PR review from multiple perspectives (PM, Developer, QA, Security)