aif-review
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCode 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
- 运行获取暂存变更
git diff --cached - 若没有暂存内容,则运行获取未暂存变更
git diff - 分析每个文件的变更内容
With PR Number/URL
带PR编号/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
- 使用获取PR详情
gh pr view <number> --json - 使用获取差异内容
gh pr diff <number> - 审查PR中的所有变更
Review Checklist
审查检查清单
Correctness
正确性
- Logic errors or bugs
- Edge cases handling
- Null/undefined checks
- Error handling completeness
- Type safety (if applicable)
- 逻辑错误或bug
- 边界情况处理
- Null/undefined值检查
- 错误处理完整性
- 类型安全性(若适用)
Security
安全性
- SQL injection vulnerabilities
- XSS vulnerabilities
- Command injection
- Sensitive data exposure
- Authentication/authorization issues
- CSRF protection
- Input validation
- SQL注入漏洞
- XSS漏洞
- 命令注入
- 敏感数据泄露
- 认证/授权问题
- CSRF防护
- 输入验证
Performance
性能
- N+1 query problems
- Unnecessary re-renders (React)
- Memory leaks
- Inefficient algorithms
- Missing indexes (database)
- Large payload sizes
- N+1查询问题
- 不必要的重渲染(React)
- 内存泄漏
- 低效算法
- 缺失数据库索引
- 过大的负载大小
Best Practices
最佳实践
- Code duplication
- Dead code
- Magic numbers/strings
- Proper naming conventions
- SOLID principles
- DRY principle
- 代码重复
- 死代码
- 魔术数字/字符串
- 命名规范遵循情况
- SOLID原则
- DRY原则
Testing
测试
- Test coverage for new code
- Edge cases tested
- Mocking appropriateness
- 新代码的测试覆盖率
- 边界情况是否已测试
- Mock使用是否恰当
Output Format
输出格式
markdown
undefinedmarkdown
undefinedCode Review Summary
代码审查总结
Files Reviewed: [count]
Risk Level: 🟢 Low / 🟡 Medium / 🔴 High
已审查文件数: [count]
风险等级: 🟢 低 / 🟡 中 / 🔴 高
Critical Issues
关键问题
[Must be fixed before merge]
[合并前必须修复]
Suggestions
优化建议
[Nice to have improvements]
[可选的改进项]
Questions
疑问
[Clarifications needed]
[需要澄清的内容]
Positive Notes
正面评价
[Good patterns observed]
undefined[发现的良好代码模式]
undefinedReview 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/123用户:
审查当前仓库中的暂存变更。
/aif-review用户:
使用GitHub CLI审查PR #123。
/aif-review 123用户:
通过URL审查PR。
/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
若已配置GitHub MCP,可实现:
- 直接在PR上发布审查评论
- 请求变更或批准PR
- 根据审查结果添加标签
提示: 代码审查后上下文信息较多。在继续其他任务前,可考虑使用或/clear命令清理上下文。/compact