code-reviewer - AI Code Review Assistant 🔍
Built for AI agent developers who care about code quality.
An intelligent code review assistant that analyzes your codebase and provides detailed, actionable feedback on:
- - 🛡️ Security vulnerabilities
- ⚡ Performance bottlenecks
- 🧹 Code smells and anti-patterns
- ✨ Best practices adherence
- 📚 Documentation quality
🎯 Why code-reviewer?
When building AI agents with OpenClaw, code quality matters more than ever:
- - Agents often run with elevated permissions
- Security vulnerabilities can be exploited by malicious prompts
- Performance issues compound when agents loop
- Maintainability is critical for evolving agent behavior
code-reviewer understands these unique challenges and provides tailored advice.
🚀 Quick Start
Review a single file
Tell your agent:
"Review the code quality of src/agent.js"
Review an entire directory
"Analyze all Python files in ./skills/my-skill/"
Get a detailed report
"Generate a full code review report for the current project"
📋 What Gets Checked
Security 🛡️
- - Injection vulnerabilities - Command injection, path traversal, eval usage
- Sensitive data exposure - Hardcoded secrets, API keys in code
- Unsafe dependencies - Known CVEs in package.json/requirements.txt
- Permission issues - Overly broad file access, unnecessary privileges
Performance ⚡
- - Inefficient algorithms - O(n²) when O(n) exists, unnecessary loops
- Memory leaks - Unreleased resources, closure traps
- Blocking operations - Sync file I/O in async contexts
- Redundant computations - Repeated calculations, unnecessary allocations
Code Quality 🧹
- - Code smells - Long functions, deep nesting, duplicated code
- Naming conventions - Inconsistent or unclear variable names
- Dead code - Unused imports, unreachable statements
- Magic numbers - Hardcoded values without explanation
Best Practices ✨
- - Error handling - Unhandled promises, swallowed exceptions
- Testing - Missing tests, low coverage areas
- Documentation - Missing docstrings, unclear comments
- Type safety - Missing type annotations (TypeScript/Python)
🎨 Output Format
Terminal Summary
CODEBLOCK0
Detailed Markdown Report
Saved to code-review-report.md:
CODEBLOCK1
⚙️ Configuration
Create .codereview.json in your project root for custom rules:
CODEBLOCK2
🧠 How It Works
- 1. Parse - Reads your code files using OpenClaw's
read tool - Analyze - Uses AI to understand code structure and intent
- Detect - Applies security, performance, and quality rules
- Report - Generates actionable findings with fix suggestions
- Learn - Adapts to your codebase patterns over time
🌟 Features
Multi-Language Support
- - ✅ JavaScript / TypeScript
- ✅ Python
- ✅ Go
- ✅ Rust
- ✅ Shell scripts
- 🔄 More languages coming soon
Smart Context Awareness
Understands your project type:
- - OpenClaw skills and plugins
- Express/Fastify APIs
- React/Vue frontends
- CLI tools
- Lambda functions
Incremental Reviews
Reviews only changed files in Git:
"Review my latest changes"
Team Integration
Share review reports with your team:
- - Export to GitHub PR comments
- Slack/Discord notifications
- Email summaries
💡 Usage Examples
Example 1: Pre-commit Review
CODEBLOCK3
Output:
CODEBLOCK4
Example 2: Security Audit
CODEBLOCK5
Output:
CODEBLOCK6
Example 3: Performance Check
CODEBLOCK7
Output:
⚡ Performance Analysis
━━━━━━━━━━━━━━━━━━━━━
Found 3 optimization opportunities:
1. Line 45: O(n²) loop - use Map for O(n)
2. Line 67: Sync file read blocks event loop
3. Line 89: Regex compiled in hot path
Estimated improvement: 85% faster
🔒 Privacy & Security
- - ✅ Runs locally - Your code never leaves your machine
- ✅ No telemetry - Zero data collection
- ✅ Open source - Audit the code yourself
- ✅ Safe analysis - Never executes your code
📦 Installation
Via ClawHub (Recommended)
CODEBLOCK9
Manual Installation
CODEBLOCK10
🤝 Contributing
Found a bug? Have a feature idea?
📜 License
MIT License - see LICENSE for details.
🙏 Acknowledgments
Built with ❤️ by 翠花 for the OpenClaw community.
Special thanks to:
- - OpenClaw team for the amazing framework
- ClawHub for making skill distribution easy
- Early adopters for feedback and bug reports
📞 Support
Made with 🌸 by 翠花 | ClawHub Pioneer
code-reviewer - AI代码审查助手 🔍
专为注重代码质量的AI代理开发者打造。
一个智能代码审查助手,能够分析您的代码库并提供详细、可操作的反馈,涵盖以下方面:
- - 🛡️ 安全漏洞
- ⚡ 性能瓶颈
- 🧹 代码坏味与反模式
- ✨ 最佳实践遵循情况
- 📚 文档质量
🎯 为什么选择code-reviewer?
在使用OpenClaw构建AI代理时,代码质量比以往任何时候都更重要:
- - 代理通常以提升的权限运行
- 安全漏洞可能被恶意提示利用
- 当代理循环时,性能问题会叠加
- 可维护性对于不断演进的代理行为至关重要
code-reviewer 理解这些独特挑战,并提供量身定制的建议。
🚀 快速开始
审查单个文件
告诉您的代理:
审查 src/agent.js 的代码质量
审查整个目录
分析 ./skills/my-skill/ 中的所有Python文件
获取详细报告
为当前项目生成完整的代码审查报告
📋 检查内容
安全 🛡️
- - 注入漏洞 - 命令注入、路径遍历、eval使用
- 敏感数据泄露 - 硬编码密钥、代码中的API密钥
- 不安全的依赖 - package.json/requirements.txt中的已知CVE
- 权限问题 - 过宽的文件访问、不必要的权限
性能 ⚡
- - 低效算法 - 存在O(n)方案时使用O(n²)、不必要的循环
- 内存泄漏 - 未释放的资源、闭包陷阱
- 阻塞操作 - 异步上下文中的同步文件I/O
- 冗余计算 - 重复计算、不必要的分配
代码质量 🧹
- - 代码坏味 - 长函数、深层嵌套、重复代码
- 命名规范 - 不一致或含义不清的变量名
- 死代码 - 未使用的导入、不可达的语句
- 魔法数字 - 无解释的硬编码值
最佳实践 ✨
- - 错误处理 - 未处理的Promise、被吞没的异常
- 测试 - 缺少测试、低覆盖率区域
- 文档 - 缺少文档字符串、不清晰的注释
- 类型安全 - 缺少类型注解(TypeScript/Python)
🎨 输出格式
终端摘要
🔍 代码审查摘要
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📁 分析文件数:12
⚠️ 发现问题数:8
严重程度分布:
🔴 严重:1
🟠 高: 2
🟡 中: 3
🟢 低: 2
主要问题:
1. [严重] query.js:45 存在SQL注入漏洞
2. [高] config.js:12 存在硬编码API密钥
3. [高] worker.js:78 存在内存泄漏
💡 使用 --detailed 参数获取完整报告
详细Markdown报告
保存至 code-review-report.md:
markdown
代码审查报告
生成时间:2026-03-24 20:30 PDT
项目:my-agent-project
审查文件数:12
问题总数:8
🔴 严重问题(1个)
1. SQL注入漏洞
文件:src/query.js:45
严重程度:严重
问题描述:
未经过滤的用户输入直接拼接到SQL查询中。
代码:
\\\javascript
const query = SELECT * FROM users WHERE id = ${userId};
\\\
影响:
允许任意SQL执行。攻击者可读取/修改数据库。
修复方案:
使用参数化查询:
\\\javascript
const query = SELECT * FROM users WHERE id = ?;
db.query(query, [userId]);
\\\
🟠 高优先级问题(2个)
2. 硬编码API密钥
文件:config.js:12
...
⚙️ 配置
在项目根目录创建 .codereview.json 以自定义规则:
json
{
severity: {
min: medium,
failOnCritical: true
},
ignore: {
files: [.test.js, dist/],
rules: [magic-numbers]
},
languages: [javascript, python],
output: {
format: markdown,
path: ./reports/code-review.md
}
}
🧠 工作原理
- 1. 解析 - 使用OpenClaw的read工具读取代码文件
- 分析 - 利用AI理解代码结构和意图
- 检测 - 应用安全、性能和质量规则
- 报告 - 生成包含修复建议的可操作发现
- 学习 - 随时间适应您的代码库模式
🌟 功能特性
多语言支持
- - ✅ JavaScript / TypeScript
- ✅ Python
- ✅ Go
- ✅ Rust
- ✅ Shell脚本
- 🔄 更多语言即将推出
智能上下文感知
理解您的项目类型:
- - OpenClaw技能和插件
- Express/Fastify API
- React/Vue前端
- CLI工具
- Lambda函数
增量审查
仅审查Git中变更的文件:
审查我最近的更改
团队集成
与团队共享审查报告:
- - 导出为GitHub PR评论
- Slack/Discord通知
- 邮件摘要
💡 使用示例
示例1:提交前审查
代理:在我提交之前审查所有暂存文件
输出:
✅ 一切正常!未发现严重问题。
💡 3个次要建议:
- 建议在auth.js:23添加错误处理
- utils.js:56中的变量temp可以使用更好的名称
- 在api.js:12为函数processData()添加JSDoc
示例2:安全审计
代理:对./src/运行安全审计
输出:
🛡️ 安全审计结果
━━━━━━━━━━━━━━━━━━━━━━━
🔴 发现1个严重漏洞
🟠 检测到2个高风险问题
详情:
- 1. [严重] exec.js中的命令注入
- [高] 日志中的敏感数据
- [高] 缺少输入验证
📄 完整报告:security-audit-2026-03-24.md
示例3:性能检查
代理:查找worker.js中的性能瓶颈
输出:
⚡ 性能分析
━━━━━━━━━━━━━━━━━━━━━
发现3个优化机会:
- 1. 第45行:O(n²)循环 - 使用Map实现O(n)
- 第67行:同步文件读取阻塞事件循环
- 第89行:正则表达式在热路径中编译
预估改进:速度提升85%
🔒 隐私与安全
- - ✅ 本地运行 - 您的代码永远不会离开您的机器
- ✅ 无遥测 - 零数据收集
- ✅ 开源 - 自行审计代码
- ✅ 安全分析 - 从不执行您的代码
📦 安装
通过ClawHub(推荐)
bash
clawhub install code-reviewer
手动安装
bash
git clone https://github.com/your-username/code-reviewer
cd code-reviewer
clawhub publish .
🤝 贡献
发现Bug?有功能建议?
📜 许可证
MIT许可证 - 详见 LICENSE。
🙏 致谢
由翠花为OpenClaw社区倾情打造 ❤️
特别感谢:
- - OpenClaw团队提供的出色框架
- ClawHub使技能分发变得简单
- 早期用户提供的反馈和Bug报告
📞 支持
由翠花精心制作 🌸 | ClawHub先锋