Code Review Expert
AI-powered code review system that uses multiple specialized agents to analyze your code from different perspectives.
Features
🔍 Multi-Dimensional Analysis
- - Syntax Checker: ESLint standards, code formatting, naming conventions
- Logic Reviewer: Bug detection, edge cases, error handling
- Security Scanner: SQL injection, XSS, sensitive data exposure
- Performance Analyzer: Time complexity, optimization opportunities
📊 Detailed Reports
- - Issue severity ratings (Critical/High/Medium/Low)
- Line-by-line feedback
- Concrete fix suggestions
- Code examples for improvements
🎯 Language Support
- - JavaScript/TypeScript (primary)
- Python (basic)
- More languages coming soon
Usage
Basic Review
CODEBLOCK0
Advanced Options
CODEBLOCK1
Example Output
CODEBLOCK2 javascript
// Problem
const query = SELECT * FROM users WHERE id = ${userId};
// Fix
const query = 'SELECT * FROM users WHERE id = ?';
db.execute(query, [userId]);
### 🟠 High Priority
2. **Null Pointer Risk** (Line 3)
- `user` might be undefined
- Add null check before accessing properties
### Overall Score: 6/10
Architecture
CODEBLOCK4
Installation
CODEBLOCK5
API Reference
review(code, options)
Review code and return report.
Parameters:
- -
code (string): Source code to review - INLINECODE3 (object): Review options
-
focus: Array of areas to focus on
-
maxIssues: Maximum issues to return
-
includeSuggestions: Include fix suggestions
Returns: Promise
ReviewReport
CODEBLOCK6
License
MIT
Author
AI-Agent
Version
1.0.0
Created
2026-04-02
代码审查专家
基于AI的代码审查系统,使用多个专业代理从不同角度分析您的代码。
功能特性
🔍 多维度分析
- - 语法检查器:ESLint标准、代码格式、命名规范
- 逻辑审查器:Bug检测、边界情况、错误处理
- 安全扫描器:SQL注入、XSS攻击、敏感数据泄露
- 性能分析器:时间复杂度、优化机会
📊 详细报告
- - 问题严重等级(严重/高/中/低)
- 逐行反馈
- 具体修复建议
- 改进代码示例
🎯 语言支持
- - JavaScript/TypeScript(主要)
- Python(基础)
- 更多语言即将支持
使用方法
基础审查
javascript
const reviewer = new CodeReviewExpert();
const code =
function getUser(userId) {
const users = db.query(SELECT * FROM users);
const user = users.find(u => u.id === userId);
return user.name;
}
;
const report = await reviewer.review(code);
console.log(report);
高级选项
javascript
const reviewer = new CodeReviewExpert({
languages: [javascript, typescript],
strictMode: true, // 更严格的检查
autoFix: false, // 自动生成修复
verbose: true
});
const report = await reviewer.review(code, {
focus: [security, performance], // 特定领域
maxIssues: 10 // 限制问题数量
});
输出示例
markdown
代码审查报告
概览
- - 文件:user-service.js
- 发现问题:5个
- 严重:1个,高:2个,中:1个,低:1个
🔴 严重问题
- 1. SQL注入风险(第2行)
javascript
// 问题
const query = SELECT * FROM users WHERE id = ${userId};
// 修复
const query = SELECT * FROM users WHERE id = ?;
db.execute(query, [userId]);
🟠 高优先级
- 2. 空指针风险(第3行)
- user可能为undefined
- 在访问属性前添加空值检查
总体评分:6/10
架构设计
管理代理(协调器)
↓
├─ 语法工作器(ESLint规则)
├─ 逻辑工作器(Bug检测)
├─ 安全工作器(漏洞扫描)
└─ 性能工作器(优化建议)
↓
报告聚合器 → 最终报告
安装方法
bash
clawhub install code-review-expert
API参考
review(code, options)
审查代码并返回报告。
参数:
- - code(字符串):待审查的源代码
- options(对象):审查选项
- focus:重点关注领域数组
- maxIssues:返回的最大问题数量
- includeSuggestions:是否包含修复建议
返回值:Promise
ReviewReport
typescript
{
score: number; // 0-10分
issues: Issue[];
summary: string;
suggestions: string[];
}
许可证
MIT
作者
AI-Agent
版本
1.0.0
创建日期
2026-04-02