Code Review Skill
Performs thorough, structured code reviews for GitHub pull requests with focus on problem-solving effectiveness, security, and code quality.
When to Use This Skill
- User provides a GitHub PR URL for review
- User asks to review a pull request or code change
- User wants to verify if a PR fixes a specific issue
- User asks about security implications of a change
- User wants alternative approaches to a fix
Input Format
The user will typically provide:
- PR URL (required):
https://github.com/{owner}/{repo}/pull/{number}
- Issue URL (optional):
https://github.com/{owner}/{repo}/issues/{number}
- Additional context (optional): What to focus on, concerns, etc.
Review Process
Step 1: Gather Information
Use GitHub MCP tools to fetch all relevant data:
1. Parse the PR URL to extract: owner, repo, pull_number
2. Parse the Issue URL (if provided) to extract: owner, repo, issue_number
Fetch PR Data:
- Get pull request details (title, body, author, state, base/head)
- Get pull request diff/files changed
- Get pull request comments and review comments
- Get commits in the pull request
Fetch Issue Data (if provided):
- Get issue details (title, body, labels, state)
- Get issue comments (the full discussion)
- Check for linked issues or references
Fetch Repository Context:
- Search for similar implementations in the codebase
- Check if feature exists in related areas (e.g., MVC vs Blazor)
- Look for existing patterns that should be followed
Step 2: Analyze Against Review Criteria
Evaluate the PR against each of these categories:
2.1 Problem Alignment
- Does the PR actually solve the problem stated in the issue?
- Are ALL cases mentioned in the issue discussion addressed?
- Does the PR scope match the issue scope (not under/over-engineering)?
- Are there requirements in comments that were missed?
2.2 Code Quality & Design
- Does the change make logical sense?
- Is the code readable and maintainable?
- Does it follow existing patterns in the codebase?
- What code should be refactored?
- Can the fix be done simpler?
- Is there unnecessary complexity?
2.3 Security Analysis
- What security threats could this PR introduce?
- Input validation: Is user input properly sanitized?
- Authentication/Authorization: Any bypasses possible?
- Data exposure: Could sensitive data leak?
- Injection risks: SQL, XSS, command injection?
- Dependencies: Any vulnerable packages added?
2.4 Alternative Approaches
- What other ways could this issue be fixed?
- What are the trade-offs of each approach?
- Is the PR's approach the best one? Why or why not?
- Are there simpler solutions that were overlooked?
2.5 Edge Cases & Completeness
- Are all use cases covered?
- What edge cases might fail?
- Error handling: What happens when things go wrong?
- Boundary conditions: Empty inputs, null values, max limits?
- Concurrency: Thread safety issues?
2.6 Duplication & Consistency
- Does this re-implement something that already exists?
- Is there similar functionality elsewhere that should be reused?
- For ASP.NET Core: Does this feature exist in MVC? How does the Blazor implementation compare?
- Are there patterns in the codebase that should be followed?
- Is the implementation consistent with similar features?
2.7 Testing
- Are there adequate unit tests?
- Are edge cases tested?
- Integration tests where needed?
- Are tests actually testing the right things?
Step 3: Generate Review Report
Structure the output using the review report template.
Review Report Format
Present findings in this structure:
# Code Review: PR #{number}
## Summary
[One paragraph executive summary of the PR and overall assessment]
## Problem Alignment ✅/⚠️/❌
[Does the PR solve the issue? Missing requirements?]
## Code Quality
### What Works Well 👍
- [Positive observations]
### Concerns 🔍
- [Issues that should be addressed]
### Suggestions for Improvement 💡
- [Refactoring opportunities, simplifications]
## Security Analysis 🔒
[Security threats and mitigations]
## Alternative Approaches
| Approach | Pros | Cons |
|----------|------|------|
| Current PR | ... | ... |
| Alternative 1 | ... | ... |
## Edge Cases
- [ ] Case 1: [covered/not covered]
- [ ] Case 2: [covered/not covered]
## Duplication Check
[Existing implementations, MVC vs Blazor comparison if applicable]
## Final Verdict
[APPROVE / REQUEST CHANGES / NEEDS DISCUSSION]
### Must Fix 🔴
- [Blocking issues]
### Should Fix 🟡
- [Important but not blocking]
### Consider 🟢
- [Nice to have]
Examples
Example 1: Basic PR Review
User Input:
Review this PR: https://github.com/dotnet/aspnetcore/pull/65306
It's supposed to fix: https://github.com/dotnet/aspnetcore/issues/49683
Agent Actions:
- Extract: owner=dotnet, repo=aspnetcore, pull_number=65306, issue_number=49683
- Fetch PR #65306 details, diff, and comments
- Fetch Issue #49683 details and all comments
- Search codebase for related implementations
- Analyze against all criteria
- Generate structured review report
Example 2: Security-Focused Review
User Input:
Review https://github.com/myorg/api/pull/123 with focus on security
Agent Actions:
- Fetch PR data
- Prioritize security analysis section
- Check for auth, input validation, data exposure
- Generate report with expanded security section
Checklist Reference
See review-checklist.md for detailed checklist.
See security-checklist.md for security-specific checks.
Important Notes
- Always read the FULL issue discussion, not just the issue body
- Check linked issues and references for additional context
- For ASP.NET Core repos, always compare MVC and Blazor implementations
- Consider the PR in context of the broader architecture
- Be constructive - suggest improvements, don't just criticize
1---2name: code-review3description: Performs comprehensive code reviews for GitHub pull requests. Use when reviewing PRs, checking if a PR fixes an issue, analyzing code changes, or when given a GitHub PR URL (github.com/.../pull/...). Evaluates problem alignment, code quality, security threats, alternative approaches, edge cases, and identifies duplicate/existing implementations.4---56# Code Review Skill78Performs thorough, structured code reviews for GitHub pull requests with focus on problem-solving effectiveness, security, and code quality.910## When to Use This Skill1112- User provides a GitHub PR URL for review13- User asks to review a pull request or code change14- User wants to verify if a PR fixes a specific issue15- User asks about security implications of a change16- User wants alternative approaches to a fix1718## Input Format1920The user will typically provide:211. **PR URL** (required): `https://github.com/{owner}/{repo}/pull/{number}`222. **Issue URL** (optional): `https://github.com/{owner}/{repo}/issues/{number}`233. **Additional context** (optional): What to focus on, concerns, etc.2425## Review Process2627### Step 1: Gather Information2829Use GitHub MCP tools to fetch all relevant data:3031```321. Parse the PR URL to extract: owner, repo, pull_number332. Parse the Issue URL (if provided) to extract: owner, repo, issue_number34```3536**Fetch PR Data:**37- Get pull request details (title, body, author, state, base/head)38- Get pull request diff/files changed39- Get pull request comments and review comments40- Get commits in the pull request4142**Fetch Issue Data (if provided):**43- Get issue details (title, body, labels, state)44- Get issue comments (the full discussion)45- Check for linked issues or references4647**Fetch Repository Context:**48- Search for similar implementations in the codebase49- Check if feature exists in related areas (e.g., MVC vs Blazor)50- Look for existing patterns that should be followed5152### Step 2: Analyze Against Review Criteria5354Evaluate the PR against each of these categories:5556#### 2.1 Problem Alignment57- Does the PR actually solve the problem stated in the issue?58- Are ALL cases mentioned in the issue discussion addressed?59- Does the PR scope match the issue scope (not under/over-engineering)?60- Are there requirements in comments that were missed?6162#### 2.2 Code Quality & Design63- Does the change make logical sense?64- Is the code readable and maintainable?65- Does it follow existing patterns in the codebase?66- What code should be refactored?67- Can the fix be done simpler?68- Is there unnecessary complexity?6970#### 2.3 Security Analysis71- What security threats could this PR introduce?72- Input validation: Is user input properly sanitized?73- Authentication/Authorization: Any bypasses possible?74- Data exposure: Could sensitive data leak?75- Injection risks: SQL, XSS, command injection?76- Dependencies: Any vulnerable packages added?7778#### 2.4 Alternative Approaches79- What other ways could this issue be fixed?80- What are the trade-offs of each approach?81- Is the PR's approach the best one? Why or why not?82- Are there simpler solutions that were overlooked?8384#### 2.5 Edge Cases & Completeness85- Are all use cases covered?86- What edge cases might fail?87- Error handling: What happens when things go wrong?88- Boundary conditions: Empty inputs, null values, max limits?89- Concurrency: Thread safety issues?9091#### 2.6 Duplication & Consistency92- Does this re-implement something that already exists?93- Is there similar functionality elsewhere that should be reused?94- **For ASP.NET Core**: Does this feature exist in MVC? How does the Blazor implementation compare?95- Are there patterns in the codebase that should be followed?96- Is the implementation consistent with similar features?9798#### 2.7 Testing99- Are there adequate unit tests?100- Are edge cases tested?101- Integration tests where needed?102- Are tests actually testing the right things?103104### Step 3: Generate Review Report105106Structure the output using the [review report template](./templates/review-report.md).107108## Review Report Format109110Present findings in this structure:111112```markdown113# Code Review: PR #{number}114115## Summary116[One paragraph executive summary of the PR and overall assessment]117118## Problem Alignment ✅/⚠️/❌119[Does the PR solve the issue? Missing requirements?]120121## Code Quality122### What Works Well 👍123- [Positive observations]124125### Concerns 🔍126- [Issues that should be addressed]127128### Suggestions for Improvement 💡129- [Refactoring opportunities, simplifications]130131## Security Analysis 🔒132[Security threats and mitigations]133134## Alternative Approaches135| Approach | Pros | Cons |136|----------|------|------|137| Current PR | ... | ... |138| Alternative 1 | ... | ... |139140## Edge Cases141- [ ] Case 1: [covered/not covered]142- [ ] Case 2: [covered/not covered]143144## Duplication Check145[Existing implementations, MVC vs Blazor comparison if applicable]146147## Final Verdict148[APPROVE / REQUEST CHANGES / NEEDS DISCUSSION]149150### Must Fix 🔴151- [Blocking issues]152153### Should Fix 🟡 154- [Important but not blocking]155156### Consider 🟢157- [Nice to have]158```159160## Examples161162### Example 1: Basic PR Review163164**User Input:**165> Review this PR: https://github.com/dotnet/aspnetcore/pull/65306166> It's supposed to fix: https://github.com/dotnet/aspnetcore/issues/49683167168**Agent Actions:**1691. Extract: owner=dotnet, repo=aspnetcore, pull_number=65306, issue_number=496831702. Fetch PR #65306 details, diff, and comments1713. Fetch Issue #49683 details and all comments1724. Search codebase for related implementations1735. Analyze against all criteria1746. Generate structured review report175176### Example 2: Security-Focused Review177178**User Input:**179> Review https://github.com/myorg/api/pull/123 with focus on security180181**Agent Actions:**1821. Fetch PR data1832. Prioritize security analysis section1843. Check for auth, input validation, data exposure1854. Generate report with expanded security section186187## Checklist Reference188189See [review-checklist.md](./checklists/review-checklist.md) for detailed checklist.190See [security-checklist.md](./checklists/security-checklist.md) for security-specific checks.191192## Important Notes193194- Always read the FULL issue discussion, not just the issue body195- Check linked issues and references for additional context196- For ASP.NET Core repos, always compare MVC and Blazor implementations197- Consider the PR in context of the broader architecture198- Be constructive - suggest improvements, don't just criticize