aif-review
Original:🇺🇸 English
Translated
Perform code review on staged changes or a pull request. Checks for bugs, security issues, performance problems, and best practices. Use when user says "review code", "check my code", "review PR", or "is this code okay".
2installs
Sourcelee-to/ai-factory
Added on
NPX Install
npx skill4agent add lee-to/ai-factory aif-reviewTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Code Review Assistant
Perform thorough code reviews focusing on correctness, security, performance, and maintainability.
Behavior
Without Arguments (Review Staged Changes)
- Run to get staged changes
git diff --cached - If nothing staged, run for unstaged changes
git diff - Analyze each file's changes
With PR Number/URL
- Use to get PR details
gh pr view <number> --json - Use to get the diff
gh pr diff <number> - Review all changes in the PR
Review Checklist
Correctness
- Logic errors or bugs
- Edge cases handling
- Null/undefined checks
- Error handling completeness
- Type safety (if applicable)
Security
- SQL injection vulnerabilities
- XSS vulnerabilities
- Command injection
- Sensitive data exposure
- Authentication/authorization issues
- CSRF protection
- Input validation
Performance
- N+1 query problems
- Unnecessary re-renders (React)
- Memory leaks
- Inefficient algorithms
- Missing indexes (database)
- Large payload sizes
Best Practices
- Code duplication
- Dead code
- Magic numbers/strings
- Proper naming conventions
- SOLID principles
- DRY principle
Testing
- Test coverage for new code
- Edge cases tested
- Mocking appropriateness
Output Format
markdown
## Code Review Summary
**Files Reviewed:** [count]
**Risk Level:** 🟢 Low / 🟡 Medium / 🔴 High
### Critical Issues
[Must be fixed before merge]
### Suggestions
[Nice to have improvements]
### Questions
[Clarifications needed]
### Positive Notes
[Good patterns observed]Review Style
- Be constructive, not critical
- Explain the "why" behind suggestions
- Provide code examples when helpful
- Acknowledge good code
- Prioritize feedback by importance
- Ask questions instead of making assumptions
Examples
User:
Review staged changes in current repository.
/aif-reviewUser:
Review PR #123 using GitHub CLI.
/aif-review 123User:
Review PR from URL.
/aif-review https://github.com/org/repo/pull/123Integration
If GitHub MCP is configured, can:
- Post review comments directly to PR
- Request changes or approve
- Add labels based on review outcome
Tip: Context is heavy after code review. Consideror/clearbefore continuing with other tasks./compact