一键导入
code-review
Code review best practices, guidelines, and checklists for effective peer reviews.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Code review best practices, guidelines, and checklists for effective peer reviews.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Summarize and condense content effectively
Translate content between languages with context awareness
API testing best practices, tools, and workflows for RESTful API testing.
Code quality standards, metrics, and practices for maintaining clean, maintainable codebases.
Go debugging best practices, tools, and techniques for effective troubleshooting.
Technical documentation writing guidelines, standards, and best practices.
| name | code-review |
| description | Code review best practices, guidelines, and checklists for effective peer reviews. |
| version | 1.0.0 |
| author | magic |
| license | MIT |
| metadata | {"hermes":{"tags":["code-review","quality","collaboration","guidelines"],"category":"software-development"}} |
Comprehensive guidelines for conducting effective code reviews that improve code quality, share knowledge, and catch issues early.
Load this skill when:
✓ Security vulnerabilities checked
✓ Error handling comprehensive
✓ Code follows project conventions
✓ Performance implications considered
✓ Test coverage adequate
✓ Documentation complete
✓ No sensitive data exposed
✓ Breaking changes documented
[Priority] Type: Description
Example:
[High] Security: SQL injection vulnerability in user input handling
[Medium] Performance: N+1 query issue in user listing endpoint
[Low] Style: Consider extracting repeated logic into helper function
npm audit, pip check, etc.)🚨 Security Concern
I noticed that user input in `[function/file]` is not properly validated.
This could lead to [specific vulnerability, e.g., SQL injection/XSS].
**Suggestion**: Use [specific solution, e.g., parameterized queries/input validation]
to sanitize the input.
**Example**:
```[language]
// Instead of:
query = "SELECT * FROM users WHERE id = " + userInput
// Use:
query = "SELECT * FROM users WHERE id = ?"
db.Query(query, userInput)
### Performance Issue
⚡ Performance Note
The current implementation fetches all records and then filters in memory (lines X-Y). With large datasets, this could cause memory issues.
Suggestion: Move the filter to the database query level.
Example:
// Instead of:
users = getAllUsers()
filtered = filter(users, condition)
// Use:
filtered = getUsersWhere(condition)
### Code Quality
💡 Code Quality
Consider extracting the repeated logic in lines X-Y into a reusable helper function. This would improve maintainability and reduce duplication.
Suggestion:
function processUserData(user) {
// extracted common logic here
}
## Best Practices
### For Reviewers
- ✅ Review promptly (within 24-48 hours)
- ✅ Ask questions instead of making demands
- ✅ Praise good code ("Nice solution!", "Clean approach")
- ✅ Be objective, not personal
- ✅ Suggest, don't command
- ✅ Approve early for good code (don't delay for minor issues)
### For Authors
- ✅ Keep PRs focused and reasonably sized (< 500 lines ideally)
- ✅ Self-review before requesting reviews
- ✅ Respond to all comments
- ✅ Say "thank you" for feedback
- ✅ Fix issues, don't just defend
- ✅ Update PR description if scope changes
## Pitfalls
### Bikeshedding
**Problem**: Focusing on trivial style issues instead of important logic
**Solution**:
- Use linters/formatters to automate style checks
- Prioritize review comments by impact (security > logic > style)
- Set clear team conventions to avoid debates
### Review Fatigue
**Problem**: Large PRs are overwhelming to review
**Solution**:
- Keep PRs small (< 500 lines)
- Break large features into smaller, reviewable chunks
- Use "Draft" PRs for early feedback on approach
### Hostile Reviews
**Problem**: Review comments feel personal or aggressive
**Solution**:
- Use "we" language instead of "you"
- Focus on the code, not the person
- Assume positive intent
- If tensions rise, switch to video call or in-person discussion
## Verification
After completing a review:
1. All checklist items addressed
2. Feedback is constructive and actionable
3. No blocking issues remain
4. Author understands suggested changes
5. Tests pass and coverage is adequate
## Tools
- **Linters**: ESLint, Pylint, golangci-lint (automate style checks)
- **Security**: SonarQube, Snyk, OWASP ZAP
- **Coverage**: Jest, pytest-cov, go test -cover
- **PR Templates**: Set up in GitHub/GitLab/Bitbucket
## References
- [Google's Code Review Developer Guide](https://google.github.io/eng-practices/review/)
- [Best Practices for Code Review by SmartBear](https://smartbear.com/learn/code-review/best-practices-for-peer-code-review/)
- [Effective Code Reviews Without the Pain](https://www.developer.com/design-development/effective-code-reviews/)