How this command is triggered — by the user, by Claude, or both
Slash command
/code-review:reviewThe summary Claude sees in its command listing — used to decide when to auto-load this command
# Command: /review 对代码进行全面的专业审查,提供代码质量、安全性和性能优化建议。 ## 描述 /review 命令启动一个专业的代码审查流程,使用多个专门的代理来分析代码的不同方面,包括代码质量、安全性、性能和最佳实践。 ## 用法 ### 参数 - `target` - 审查目标(文件路径、目录、PR链接、或代码片段) - `--focus` - 审查重点(security, performance, quality, architecture, all) - `--depth` - 审查深度(quick, standard, deep) - `--format` - 输出格式(summary, detailed, report) - `--language` - 代码语言(自动检测或指定) ## 示例 ### 审查当前文件 ### 审查特定文件 ### 专注于安全性审查 ### 深度审查整个目录 ### 审查代码片段 ## 审查流程 ### 1. 自动分析 - 检测编程语言和框架 - 分析代码结构和复杂度 - 识别潜在的问题区域 ### 2. 多维度审查 - 🔒 **安全审查**:SQL注入、XSS、认证授权等 - ⚡ **性能分析**:算法效率、资源使用、缓存策略 - 🏗️ **架构评估**:设计模式、...
对代码进行全面的专业审查,提供代码质量、安全性和性能优化建议。
/review 命令启动一个专业的代码审查流程,使用多个专门的代理来分析代码的不同方面,包括代码质量、安全性、性能和最佳实践。
/review [target] [options]
target - 审查目标(文件路径、目录、PR链接、或代码片段)--focus - 审查重点(security, performance, quality, architecture, all)--depth - 审查深度(quick, standard, deep)--format - 输出格式(summary, detailed, report)--language - 代码语言(自动检测或指定)/review
/review src/components/UserList.jsx
/review --focus security src/api/auth.js
/review src/ --depth deep --format report
/review `
function getUser(id) {
return db.query("SELECT * FROM users WHERE id = " + id);
}
`
# 代码审查报告
## 基本信息
- **文件**: src/components/UserProfile.jsx
- **语言**: React/JavaScript
- **代码行数**: 156
- **审查时间**: 2024-01-15 10:30:00
- **总体评分**: 7.8/10
## 审查摘要
代码整体质量良好,存在2个严重安全问题需要立即修复,3个性能优化机会。
## 详细问题
### 🔴 严重问题 (必须修复)
#### 1. SQL注入漏洞
**位置**: 第45行
**风险等级**: 高
```javascript
// 问题代码
const query = `SELECT * FROM users WHERE id = ${userId}`;
// 修复建议
const query = 'SELECT * FROM users WHERE id = ?';
db.query(query, [userId]);
位置: 第78-82行 风险等级: 中
位置: 第12-25行
## 配置选项
可以通过项目根目录的 `.codereview.json` 文件自定义审查规则:
```json
{
"review": {
"defaultDepth": "standard",
"autoFix": false,
"ignorePatterns": ["*.test.js", "node_modules/**"],
"rules": {
"security": {
"enabled": true,
"severity": "error"
},
"performance": {
"enabled": true,
"severity": "warn"
},
"style": {
"enabled": true,
"severity": "info"
}
},
"customRules": [
{
"name": "no-console-in-production",
"pattern": "console\\.",
"message": "生产环境不应该有console语句"
}
]
}
}
#!/bin/sh
# pre-commit hook
npx claude /review --focus security,quality
# .github/workflows/code-review.yml
name: Code Review
on: [pull_request]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run Code Review
run: npx claude /review --format report > review-report.md
/security - 专门进行安全审查/performance - 专门进行性能分析/refactor - 代码重构建议/fix - 自动修复简单问题如果遇到问题或需要帮助:
/help code-review@CodeReviewernpx claudepluginhub protagonistss/ithinku-plugins --plugin code-review/reviewPerforms multi-dimensional code review on <CODE_SCOPE>, evaluating quality, security, performance, and architecture. Produces summary, detailed findings, improvement suggestions, action plan, and follow-ups.
/reviewPerforms a comprehensive code review on a specified file or recent changes, delivering actionable feedback on quality, security, performance, best practices, and bugs.
/code-reviewPerforms code review on files, directories, recent git changes, or PRs, providing actionable feedback on quality, security, performance, maintainability, and testing.
/reviewReviews specified code scope via four specialists (quality, security, performance, architecture), producing summary, detailed findings, refactoring suggestions, prioritized action plan.
/pr-reviewReviews Pull Requests for code quality, security, performance, and architecture using structured checklists, producing prioritized comments with severity tags and fix examples.
/reviewReviews staged changes or recent commits across five axes—correctness, readability, architecture, security, performance—producing categorized findings with file:line references and fixes.