代码审查工具 是 AI Skill Hub 本期精选AI工具之一。综合评分 8.0 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。
自动审查pull/merge请求,提高代码质量
代码审查工具 是一款基于 Python 开发的开源工具,专注于 代码审查、AI工具、Python 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
自动审查pull/merge请求,提高代码质量
代码审查工具 是一款基于 Python 开发的开源工具,专注于 代码审查、AI工具、Python 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:pip 安装(推荐)
pip install rag_for_git
# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install rag_for_git
# 方式三:从源码安装(获取最新功能)
git clone https://github.com/mimfort/rag_for_git
cd rag_for_git
pip install -e .
# 验证安装
python -c "import rag_for_git; print('安装成功')"
# 命令行使用
rag_for_git --help
# 基本用法
rag_for_git input_file -o output_file
# Python 代码中调用
import rag_for_git
# 示例
result = rag_for_git.process("input")
print(result)
# rag_for_git 配置文件示例(config.yml) app: name: "rag_for_git" debug: false log_level: "INFO" # 运行时指定配置文件 rag_for_git --config config.yml # 或通过环境变量配置 export RAG_FOR_GIT_API_KEY="your-key" export RAG_FOR_GIT_OUTPUT_DIR="./output"
🇷🇺 Русская версия: README.ru.md
An agent that automatically reviews pull/merge requests using RAG + a code graph + Claude Code.
---
Copy and paste into any AI coding assistant (Claude Code, Cursor, Gemini CLI, Mimo Code, OpenCode, Kimi Code, Codex, Copilot…):
Set up the rag-reviewer MCP server in this AI tool.
Rules:
- Use `uvx --from rag-reviewer@latest reviewer-mcp` to run the server — do NOT pip install, do NOT clone the repo.
- The `bash -lc` wrapper is required on macOS/Linux so uvx is found by GUI tools: command="/bin/bash", args=["-lc", "uvx --from rag-reviewer@latest reviewer-mcp"]. On Windows use command="uvx", args=["--from","rag-reviewer@latest","reviewer-mcp"].
- Detect which AI tool you are running in, then write the MCP entry to the correct config file:
- Claude Code / generic: .mcp.json in project root ({"mcpServers":{"reviewer":{"command":"/bin/bash","args":["-lc","uvx --from rag-reviewer@latest reviewer-mcp"]}}})
- Cursor: ~/.cursor/mcp.json (same format)
- Gemini CLI: ~/.gemini/settings.json ({"mcpServers":{"reviewer":{"command":"/bin/bash","args":["-lc","uvx --from rag-reviewer@latest reviewer-mcp"]}}})
- Antigravity: ~/.gemini/antigravity/mcp_config.json (same mcpServers format)
- Windsurf: ~/.codeium/windsurf/mcp_config.json (same mcpServers format)
- Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows (same mcpServers format)
- Mimo Code: ~/.config/mimocode/mimocode.json ({"mcp":{"reviewer":{"type":"local","command":["/bin/bash","-lc","uvx --from rag-reviewer@latest reviewer-mcp"],"enabled":true}}})
- OpenCode: ~/.config/opencode/opencode.json ({"mcp":{"reviewer":{"type":"local","command":["/bin/bash","-lc","uvx --from rag-reviewer@latest reviewer-mcp"]}}})
- Kimi Code: ~/.kimi-code/mcp.json ({"mcpServers":{"reviewer":{"command":"/bin/bash","args":["-lc","uvx --from rag-reviewer@latest reviewer-mcp"]}}})
- Codex CLI: ~/.codex/config.toml ([mcp_servers.reviewer] command="/bin/bash" args=["-lc","uvx --from rag-reviewer@latest reviewer-mcp"])
- VS Code: ~/Library/Application Support/Code/User/mcp.json (key is "servers" not "mcpServers": {"servers":{"reviewer":{"command":"/bin/bash","args":["-lc","uvx --from rag-reviewer@latest reviewer-mcp"]}}})
- After writing the config, run: uvx --from rag-reviewer reviewer check
- Report what config file was written and whether the check passed.
---
The MCP server is published on PyPI as rag-reviewer and runs via uvx — no clone of this repo required.
Requirements: Docker, uv (includes uvx), a Voyage API key, a GitHub token.
```bash
uv tool install rag-reviewer
Skills (reviewer_review-pr, reviewer_solve-task, reviewer_sync-codebase, reviewer_sync-tasks, reviewer_performance-review, reviewer_maintainability-review, reviewer_ask) let you invoke the full review workflow with a single command. Without them you can still call MCP tools directly, but the skills wrap them into a guided flow.
reviewer install already installs them for clients that support file-based skills (Gemini, Mimo, Kimi). To (re)install just the skills — or pick a specific client — use:
uvx --from rag-reviewer reviewer install-skills --all # all detected skills-capable clients
uvx --from rag-reviewer reviewer install-skills gemini # a specific one
uvx --from rag-reviewer reviewer install-skills --list # show targets + directories
It downloads the skills from GitHub (no repo clone) and unpacks them into each client's global skills directory, with a path-traversal guard. Manual fallback (equivalent):
curl -sL https://github.com/mimfort/rag_for_git/archive/refs/heads/main.tar.gz -o /tmp/rag-reviewer.tgz
mkdir -p ~/.gemini/skills
tar xz -C ~/.gemini/skills --strip-components=3 -f /tmp/rag-reviewer.tgz 'rag_for_git-main/plugin/skills'
rm /tmp/rag-reviewer.tgz
| Tool | Global skills directory |
|---|---|
| Gemini CLI | ~/.gemini/skills/ |
| Mimo Code | ~/.config/mimocode/skills/ |
| Kimi Code | ~/.kimi-code/skills/ + extra_skill_dirs in ~/.kimi-code/config.toml |
| OpenCode | ~/.config/opencode/skills/ |
| Claude Code | bundled in the plugin (step above) |
| Cursor | project-level via .cursor-plugin/plugin.json |
---
That's it. Build the base index (recommended — see CLI) and review a PR (see Plugin usage).
uvx --from rag-reviewer reviewer index /path/to/repo --ref master --repo owner/name
With the plugin installed (see Installation) and Claude Code open at the repo root, call a skill:
/rag-reviewer:reviewer_review-pr owner/repo#42 # review a PR (prepare_review → subagents → publish_review)
/rag-reviewer:reviewer_sync-codebase # build/update vector store + code graph from local clone
/rag-reviewer:reviewer_sync-tasks # warm the task graph & vector store (server-side ETL via sync_board)
/rag-reviewer:reviewer_solve-task <key | free text> # gather disciplined context for a task, then hand off to dev
A typical end-to-end run:
```bash git clone https://github.com/ORG/REPO /tmp/REPO reviewer index /tmp/REPO --ref main # build base index + graph for main reviewer index /tmp/REPO --ref master # optionally index a second branch (REVIEW_BRANCHES=main,master)
reviewer init
uvx --from rag-reviewer reviewer index /path/to/repo --ref main --repo owner/name
uv tool upgrade rag-reviewer ```
reviewer installis cross-platform (Windows / macOS / Linux). It injects the absolute path touvxautomatically — nobash -lcwrapper needed. The manual JSON configs below usebash -lcfor macOS/Linux only; on Windows usereviewer installor set"command": "uvx"with `"args": ["--from", "rag-reviewer@latest", "reviewer-mcp"]` directly.
Claude Code: tools work out of the box.reviewer install claude-codealso writes an allowlist rulemcp__reviewer__*into your global~/.claude/settings.json(permissions.allow), so the reviewer MCP tools run in every project without hitting theauto-mode safety classifier — no manual settings edits. Being global, it also covers the plugin (marketplace) install, where the server is available everywhere but ships no permission grants.
Where keys are read from. The reviewer resolves its.envfrom a fixed location, not the current working directory — MCP clients launch the server with an arbitrary CWD, so a project-local.envis unreliable. Lookup order:$REVIEWER_ENV_FILE→$XDG_CONFIG_HOME/rag-reviewer/.env(default~/.config/rag-reviewer/.env) →./.env(handy when running from a repo clone). Real environment variables always win over the file, so you can instead pass keys via an"env": { "VOYAGE_API_KEY": "…", "GITHUB_TOKEN": "…" }block in your MCP client config — works in every client.
- Voyage (VOYAGE_API_KEY): https://dashboard.voyageai.com/ — free token pool; attach a card to lift the 3 RPM / 10K TPM limit (charged only beyond the free pool). - GitHub (GITHUB_TOKEN): a PAT with Pull requests: Read and write + Contents: Read (fine-grained) or the repo scope (classic). Quick option: gh auth token.
All other settings have defaults (documented in .env.example). DEFAULT_REPO (optional) sets the default owner/name for single-repo deployments. REVIEW_BRANCHES (optional, CSV, default main) lists the branches to track — each gets its own isolated base index; PRs targeting a branch outside this list are silently skipped by prepare_review. TASK_BOARD_TYPE / TASK_BOARD_MCP / TASK_BOARD_KEY_PATTERN / TASK_BOARD_URL_TEMPLATE (optional) configure the task board once for the whole deployment, so it need not be repeated in every repo's .review.yml (see Per-repo policy below).
uvx --from rag-reviewer@latest reviewer-mcp ```
Reviewing works even without a prior index — context is then limited to the diff and the overlay (RAG/graph are "thin"). For full whole-repo impact analysis, run index against the target branch.
task_board: type: yougile # yougile | jira — selects the skill playbook mcp: yougile # name of the connected board MCP server (tools are mcp<mcp>*) key_pattern: "[A-Z]+-\\d+" # optional; matches Yougile PRI-34/ID-34 and Jira PROJ-123 ```
The task_board block is a deploy-wide default, not a per-repo requirement. A board connection is the same for every repo of one team, so configure it once in the reviewer .env (TASK_BOARD_TYPE / TASK_BOARD_MCP / TASK_BOARD_KEY_PATTERN / TASK_BOARD_URL_TEMPLATE) and every repo inherits it — no .review.yml needed just for the board. A task_board block in a repo's .review.yml overrides that default for that repo; an explicit empty task_board: disables the board for it. review-pr reads this through the policy; solve-task reads it via the get_board_config MCP tool (and the board-MCP, LLM-side) as a fallback when the local .review.yml has no block.
Bulk task sync is server-side, not LLM (sync_board). The sync-tasks skill is a thin trigger: it calls one MCP tool, sync_board(board, limit, purge_orphaned, keep_with_prs), and the reviewer server enumerates the board over REST itself (reviewer/tasks/boards/, behind a TaskBoardProvider interface — Yougile is the reference), normalizes each task into a TaskBrief in Python, and indexes it via the existing batch indexer. The LLM passes no task text, so a sync costs O(1) tokens regardless of board size. It is incremental via a per-board timestamp watermark in index_meta (ref="tasks:<board>"): a repeat sync touches ~0 tasks; --limit disables purge and the watermark advance. The board REST credentials live only in the reviewer-mcp environment (TASK_BOARD_API_KEY / TASK_BOARD_API_BASE). This inverts the "reviewer Python never touches the board" rule for bulk sync only — single-task reads in solve-task / review-pr still go through the board-MCP on the LLM side.
If you prefer to configure your client config by hand rather than using reviewer install:
Each AI coding tool has its own config file. Pick yours:
| Tool | Global config file | Project config | Install guide |
|---|---|---|---|
| **Claude Code** | /plugin marketplace add (see below) | .claude-plugin/ ✓ | — |
| **Cursor** | ~/.cursor/mcp.json | .cursor/mcp.json ✓ | — |
| **Windsurf** | ~/.codeium/windsurf/mcp_config.json | — | — |
| **Claude Desktop** | macOS: ~/Library/Application Support/Claude/claude_desktop_config.json; Windows: %APPDATA%\Claude\claude_desktop_config.json | — | — |
| **Antigravity** | ~/.gemini/antigravity/mcp_config.json | — | — |
| **Mimo Code** | ~/.config/mimocode/mimocode.json | .mimocode/mimocode.json ✓ | [INSTALL.md](.mimocode/INSTALL.md) |
| **OpenCode** | ~/.config/opencode/opencode.json | .opencode/opencode.json ✓ | [INSTALL.md](.opencode/INSTALL.md) |
| **Kimi Code** | ~/.kimi-code/mcp.json | .kimi-code/mcp.json ✓ | [INSTALL.md](.kimi-code/INSTALL.md) |
| **Gemini CLI** | ~/.gemini/settings.json | .gemini/settings.json ✓ | [GEMINI.md](GEMINI.md) |
| **Codex CLI** | ~/.codex/config.toml | .codex-plugin/plugin.json ✓ | [AGENTS.md](AGENTS.md) |
| **Copilot CLI** | — | .github-copilot/plugin.json ✓ | — |
| **Trae IDE** | ~/Library/Application Support/Trae/User/mcp.json | — | — |
| **VS Code** | ~/Library/Application Support/Code/User/mcp.json (key: servers, not mcpServers) | — | — |
Files marked ✓ are already present in this repo — if you open rag_for_git as a project in that tool, the MCP server auto-connects. For a global install (works from any project), add the entry to the corresponding global config file.
The MCP entry format by tool (macOS/Linux — use reviewer install on Windows):
Mimo Code (mimocode.json):
{
"$schema": "https://mimo.xiaomi.com//config.json",
"mcp": {
"reviewer": {
"type": "local",
"command": ["/bin/bash", "-lc", "uvx --from rag-reviewer@latest reviewer-mcp"],
"enabled": true
}
}
}
OpenCode (opencode.json):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"reviewer": {
"type": "local",
"command": ["/bin/bash", "-lc", "uvx --from rag-reviewer@latest reviewer-mcp"]
}
}
}
Kimi Code / Cursor / Gemini CLI / Codex CLI / Trae / Claude Desktop / Windsurf / Antigravity (standard mcpServers JSON):
{
"mcpServers": {
"reviewer": {
"command": "/bin/bash",
"args": ["-lc", "uvx --from rag-reviewer@latest reviewer-mcp"]
}
}
}
VS Code (mcp.json — note: key is servers, not mcpServers):
{
"servers": {
"reviewer": {
"command": "/bin/bash",
"args": ["-lc", "uvx --from rag-reviewer@latest reviewer-mcp"]
}
}
}
Codex CLI (~/.codex/config.toml):
[mcp_servers.reviewer]
command = "/bin/bash"
args = ["-lc", "uvx --from rag-reviewer@latest reviewer-mcp"]
After adding, restart the tool — reviewer will appear alongside other MCP servers.
Two commands, from any project:
/plugin marketplace add mimfort/rag_for_git
/plugin install rag-reviewer@rag-reviewer-marketplace
You get:
- Skills: /rag-reviewer:reviewer_review-pr, /rag-reviewer:reviewer_solve-task, /rag-reviewer:reviewer_sync-codebase, /rag-reviewer:reviewer_sync-tasks (plus /rag-reviewer:reviewer_maintainability-review, /rag-reviewer:reviewer_performance-review, and /rag-reviewer:reviewer_ask). - MCP server reviewer exposing: prepare_review, publish_review, search_code, get_related_symbols, read_file, get_definition, find_callers, get_changed_file_diff, index_task, search_tasks, get_task_context, search_codebase. Alongside search_codebase, session-less graph tools related_symbols/callers/definition (graph traversal without a PR session) are available — used by the /rag-reviewer:reviewer_ask skill for grounded codebase Q&A.
Run/pluginto confirmrag-revieweris installed and enabled.
rag_for_git 是一个基于 RAG(检索增强生成)技术、代码图谱(Code Graph)以及 Claude Code 构建的智能 Agent。它能够自动对 Pull Request (PR) 或 Merge Request 进行深度审查,通过结合上下文感知能力,为开发者提供精准的代码变更分析与质量评估。
运行本项目需要 Docker 环境以及 uv 工具(包含 uvx)。此外,用户需要准备 Voyage API key 用于向量检���,以及 GitHub token 用于访问代码仓库。若需结合任务看板功能,还需配置相应的任务上下文读取权限。
推荐使用一键安装方式:直接将提供的 Prompt 复制并粘贴到任何 AI 编程助手(如 Claude Code, Cursor, Copilot 等)中即可完成 MCP server 的设置。本项目通过 PyPI 发布的 `rag-reviewer` 包运行,建议使用 `uvx --from rag-reviewer@latest reviewer-mcp` 命令,无需手动 clone 仓库或使用 pip install。
安装完成后,在 Claude Code 的仓库根目录下,可以通过特定的 Skill 命令进行交互。例如,使用 `/rag-reviewer:reviewer_review-pr` 来审查指定的 PR;使用 `/rag-reviewer:reviewer_sync-codebase` 来构建或更新本地代码库的向量存储与代码图谱;或使用 `sync-tasks` 来同步任务看板信息。
项目提供交互式配置向导,通过运行 `reviewer init` 命令,可以方便地设置 VOYAGE_API_KEY、GITHUB_TOKEN 以及配置存储、多仓库模式和任务看板(task board)等参数。对于 macOS/Linux 用户,手动配置 JSON 时需注意使用 `bash -lc` 包装器以确保能正确找到 uvx 路径。
可以通过执行 `uv tool upgrade rag-reviewer` 来升级 CLI 工具。在 Windows 环境下,建议优先使用 `reviewer install` 命令进行跨平台安装,它会自动注入 uvx 的绝对路径,避免手动配置复杂的环境变量。
本项目采用 MCP server (stdio transport) 架构,由 AI 助手自动启动。其核心工作流结合了 RAG 与代码图谱技术:即使在未进行全量 index 的情况下,Agent 也能基于 diff 和 overlay 进行初步审查;若需进行全仓库级别的变更影响分析,建议先针对目标分支运行 index 命令以构建完整的上下文。
该工具未明确声明开源协议,商业使用前请联系原作者确认授权范围,避免侵权风险。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
经综合评估,代码审查工具 在AI工具赛道中表现稳健,质量优秀。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | rag_for_git |
| 原始描述 | 开源AI工具:Агент ревью pull/merge request'ов: RAG + граф кода + LLM (OpenRouter/Voyage)。⭐11 · Python |
| Topics | 代码审查AI工具Python |
| GitHub | https://github.com/mimfort/rag_for_git |
| 语言 | Python |
收录时间:2026-06-20 · 更新时间:2026-06-20 · License:未公布 · AI Skill Hub 不对第三方内容的准确性作法律背书。