Skip to content
Agentmart
Submit a tool

code-review

代码审查框架:通用审查流程 + 语言特定规则引用,支持多语言代码审查

Skill by hellyguo

IndexedApache-2.0★ 8
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/hellyguo-code-review

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

代码审查框架:通用审查流程 + 语言特定规则引用,支持多语言代码审查

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/code-review

What's inside

Skill name
code-review
Description
代码审查框架:通用审查流程 + 语言特定规则引用,支持多语言代码审查
License
Apache-2.0
Instructions
272 lines in SKILL.md · view on GitHub

Files (5)

  • SKILL.md
  • code-smells.md · templates/
  • database-review.md · templates/
  • lang-rule.md · templates/
  • report-full.md · templates/

SKILL.md (first lines)

# 代码审查框架

**审查原则**:理性、客观、实际、真实、不恭维、实事求是

## 概述

基于模块化设计的代码审查框架:

1. **通用审查流程**:所有语言通用的审查步骤和原则
2. **语言规则引用**:按需加载语言特定审查规则
3. **组合审查支持**:支持多语言混合项目

**优势**:减少LLM上下文负担(按需加载)、维护简单、扩展灵活、复用性强。

## 语言支持

### 直接源码文件

| 语言       | 文件类型                      | 编码规范          | 审查规则             |
|------------|-------------------------------|-------------------|----------------------|
| Java       | `*.java`                      | `spec.java.md`    | `review.java.md`     |
| Python     | `*.py`                        | `spec.python.md`  | `review.python.md`   |
| C++        | `*.cpp *.hpp *.cxx *.hxx *.h` | `spec.cpp.md`     | `review.cpp.md`      |
| Rust       | `*.rs`                        | `spec.rust.md`    | `review.rust.md`     |
| Kotlin     | `*.kt *.kts`                  | `spec.kotlin.md`  | `review.kotlin.md`   |
| ANSI C     | `*.c *.h`                     | `spec.ansi_c.md`  | `review.ansi_c.md`   |
| JavaScript | `*.js *.mjs *.cjs`            | `spec.js.md`      | `review.js.md`       |
| TypeScript | `*.ts *.tsx *.mts *.cts`      | `spec.js.md`      | `review.js.md`       |
| Shell      | `*.sh *.bash *.zsh`           | `spec.shell.md`   | `review.shell.md`    |

**加载指令**:

```text
Read ${AI_SPEC_ROOT}/lang-spec/spec.{lang}.md
Read ${AI_SPEC_ROOT}/lang-spec/review.{lang}.md
```

### SQL 来源(需拼接提取)

| 来源类型       | 文件/位置        | 审查要点           |
|----------------|------------------|--------------------|
| SQL文件        | `*.sql`          | SQL注入、性能、索引|
| MyBatis Mapper | `**/*Mapper.xml` | `$`符号拼接风险    |
| 内嵌SQL        | 各种源码         | 正则匹配审查       |

## 审查模式

### 1. 全量审查(默认)

遍历项目所有源代码文件,自动识别语言并加载对应规则。

### 2. 增量审查

根据 git/svn diff 进行增量审查。

### 3. 混合语言审查

对于多语言项目,按文件类型加载不同规则。

## 审查流程

1. **项目分析**:识别技术栈、主要语言、项目结构
2. **规则加载**:根据语言加载对应规则集,应用通用审查框架
3. **代码遍历**:遍历所有源代码文件,理解代码结构和意图
4. **执行审查**:应用通用规则 + 语言特定规则,记录问题和建议
5. **生成报告**:汇总结果,输出审查报告

## 严重度分级

所有语言审查规则、报告模板统一使用以下三级口径,语言文件中的等价表述按此映射:

| 级别 | 别名 | 判定标准 | 处理要求 |
|------|------|----------|----------|
| P0 | 严重 / 必须修正 / 高优先级 | 安全漏洞、数据错误、崩溃、资源泄漏、主流程阻塞 | 本次修改必须修复 |
| P1 | 警告 / 应当修正 / 中优先级 | 性能隐患、可维护性问题、边界处理缺失 | 下次迭代修复并登记 |
| P2 | 建议 / 建议改进 / 低优先级 | 风格、命名、可读性、可选优化 | 选择性修复 |

判定原则:

1. 同一问题命中多个级别时取最高级。
2. 严重度只由问题影响决定,不由修复难度决定。
3. 报告必须给出级别,模糊表述(如"建议关注")不允许作为级别。

## 通用审查规则

### 安全规则

- **敏感信息泄露**:硬编码的密码、密钥、API Key
- **SQL注入风险**:字符串拼接的SQL语句
- **XSS漏洞**:用户输入未转义
- **敏感数据内存残留**:内存中敏感数据未安全清除

### 中间件消息追踪规则(强制)

- **消息通道清单**:检索所有中间件的 Topic/Group/Queue 名称
- **跨应用数据流**:追踪数据在应用间的流动路径(生产者→消费者)
- **幽灵通道检测**:只有生产者没有消费者的 Topic/Queue
- **孤儿通道检测**:只有消费者没有生产者的 Topic/Queue
- **消息体格式记录**:记录消息体关键字段和结构

### 性能规则

- **资源泄漏**:文件句柄、数据库连接、网络连接未关闭
- **内存泄漏**:动态分配的内存未释放
- **循环性能**:嵌套循环、N+1查询
- **对象创建**:循环中不必要的对象实例化

### 代码质量规则

- **重复代码**、**方法长度**(> 50行)、**圈复杂度**、**命名规范**
- **变量声明**(高优先级):禁止单行多声明(如 `int a, b;`、`const a = 1, b = 2;`),每个变量独占一行;适用于所有语言
- **文件长度**(建议 > 500 行拆分,强制 > 1000 行必须拆分);若存在结构性阻碍(如强耦合的状态共享),需在报告中明确说明原因

### 并发安全规则

- **线程安全**、**死锁风险**、**优雅退出**

### 坏味道分类

From hellyguo/self-ai-spec, Apache-2.0.

More from hellyguo/self-ai-spec

Signals

Stars
8
Forks
0
Open issues
0
Last commit (this folder)
Oct 23, 2026 (6 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from hellyguo

Cite this page

code-review skill. Agent Mart. https://agentmart.dev/skills/hellyguo-code-review (last updated 2026-10-24)