Code Reviewer Agent(Claude Code)

Code Reviewer Agent 是 Claude Code 的代码审查 Agent,主打 security + code quality 自动化检查。它会基于 git diff 定位变更文件,输出结构化的 review 结论与可执行的修复建议。
#能解决什么问题
- 快速发现安全风险(secrets / API keys / input validation)
- 找出潜在的质量问题(重复逻辑 / 命名 / 复杂度)
- 给出可落地的修复建议(具体代码方向)
#核心能力(Key Capabilities)
- Automated Code Reviews(基于 git diff)
- Security Vulnerability Detection(exposed secrets / input validation)
- Code Quality Analysis(readability / naming / duplication)
- Best Practices Enforcement(error handling / test coverage / performance)
- Prioritized Feedback(critical / warning / suggestion)
- Actionable Recommendations(明确修复思路)
#安装(Installation)
bashnpx claude-code-templates@latest --agent development-tools/code-reviewer
安装路径:
bashyour-project/ ├── .claude/ │ └── agents/ │ └── code-reviewer.md
#使用方式(How to Use)
bashclaude > Use the code-reviewer agent to review my recent changes for security issues and code quality
Agent 会自动:
- 运行
git diff查看变更 - 只针对修改文件给出反馈
- 按优先级排序输出
#示例(Usage Examples)
#示例 1:安全审计
bashclaude > Use the code-reviewer agent to check for security vulnerabilities in my code before I commit. Focus on exposed secrets, API keys, and input validation
#示例 2:质量评审
bashclaude > Use the code-reviewer agent to review this pull request for code quality. Check for duplicated code, naming conventions, and error handling
#示例 3:性能检查
bashclaude > Use the code-reviewer agent to analyze performance issues and verify we're following best practices for this Node.js API
#Review Checklist(常用检查项)
- ✅ Code is simple and readable
- ✅ Functions and variables are well-named
- ✅ No duplicated code
- ✅ Proper error handling implemented
- ✅ No exposed secrets or API keys
- ✅ Input validation present
- ✅ Good test coverage
- ✅ Performance considerations addressed