đ PR Review Skill
name: pr-review
description: Automatically review Pull Requests for code quality, bugs, security issues, and best practices
đ¯ Purpose
Review Pull Requests ā¸ā¸ąā¸āšā¸ā¸Ąā¸ąā¸ā¸´ ā¸ā¸Ŗā¸§ā¸ā¸Ēā¸ā¸ code quality, potential bugs, security issues, āšā¸Ĩ⏰ best practices
đ When to Use
- Review PRs ā¸āšā¸ā¸ merge
- Assist human reviewers
- Enforce coding standards
- Catch common issues
- Improve code quality
đ§ Review Dimensions
1. Code Quality
| Check | Description |
|-------|-------------|
| Readability | Code easy to understand |
| Complexity | Functions not too complex |
| Duplication | No copy-paste code |
| Naming | Variables/functions named well |
| Comments | Complex logic documented |
2. Correctness
| Check | Description |
|-------|-------------|
| Logic errors | Conditions correct |
| Edge cases | Null checks, empty arrays |
| Error handling | Try-catch where needed |
| Type safety | No any, proper types |
| Async handling | Await, error boundaries |
3. Security
| Check | Description |
|-------|-------------|
| Input validation | User input sanitized |
| SQL injection | Parameterized queries |
| XSS | Output encoded |
| Secrets | No hardcoded credentials |
| CORS | Properly configured |
4. Performance
| Check | Description |
|-------|-------------|
| N+1 queries | Batch database calls |
| Memoization | Avoid re-computation |
| Bundle size | No large dependencies |
| Rendering | Minimize re-renders |
5. Testing
| Check | Description |
|-------|-------------|
| Test coverage | New code tested |
| Edge cases | Tests cover edge cases |
| Mocking | External deps mocked |
đ Review Process
1. UNDERSTAND context
- Read PR description
- Check linked issues
- Understand the goal
2. ANALYZE changes
- File by file review
- Check diff context
- Identify patterns
3. CHECK each dimension
- Quality
- Correctness
- Security
- Performance
- Testing
4. PROVIDE feedback
- Clear comments
- Suggest improvements
- Explain WHY
- Offer alternatives
5. SUMMARIZE
- Overall assessment
- Blocking issues
- Nice-to-haves
đ Review Comment Templates
Bug Found
đ **Potential Bug**
This code will throw an error when `user` is null:
const name = user.name; // Error if user is null
**Suggestion:**
const name = user?.name ?? 'Unknown';
Security Issue
đ **Security Concern**
User input is used directly in the query without sanitization:
const result = db.query(SELECT * FROM users WHERE id = ${userId});
**Suggestion:** Use parameterized queries:
const result = db.query('SELECT * FROM users WHERE id = ?', [userId]);
Performance Issue
⥠**Performance Improvement**
This component re-renders on every parent update:
const result = heavyCalculation(data);
**Suggestion:** Use memoization:
const result = useMemo(() => heavyCalculation(data), [data]);
Style Suggestion
đĄ **Suggestion**
Consider extracting this logic to a custom hook for reusability:
const [data, setData] = useState(null);
const [loading, setLoading] = useState(true);
useEffect(() => { ... }, []);
Could become:
const { data, loading } = useDataFetch(url);
đ Review Summary Template
## đ PR Review Summary
### Overview
- **Files changed**: 12
- **Lines added**: 234
- **Lines removed**: 56
### Assessment: â
Approve with suggestions
### đ´ Blocking Issues
None
### đĄ Should Fix
1. Add null check in `UserCard.tsx` (line 45)
2. Remove console.log in `api.ts` (line 23)
### đĸ Suggestions (Nice-to-have)
1. Consider extracting validation to separate function
2. Add loading skeleton for better UX
### đŦ Comments
Great implementation overall! The new auth flow is well-structured.
Just a few minor issues to address before merging.
đ§ Automated Checks
# .github/workflows/pr-review.yml
name: PR Review
on: [pull_request]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run linter
run: npm run lint
- name: Run type check
run: npm run type-check
- name: Run tests
run: npm test
- name: Check bundle size
run: npm run analyze
â Review Checklist
- [ ] PR description is clear
- [ ] Changes match the description
- [ ] No obvious bugs
- [ ] Error handling present
- [ ] No security vulnerabilities
- [ ] No performance issues
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] No console.logs or debug code
- [ ] Types are correct
đ Related Skills
code-review- General code reviewsecurity-audit- Security analysistesting- Test coverage