code-review-graph
できること
このスキルは、プロジェクト内のファイル同士のつながりのマップを設定します。AIが、プロジェクト全体を読むのではなく、変更が触れるファイルに集中できるようにします。大きなコードベースを持つチーム向けです。
使う場面
- ✓多くのファイルがある大きなプロジェクトで、変更をレビューするとき。
- ✓コードベースが大きすぎて読み切れず、AIの余力が足りなくなったとき。
- ✓一つの変更の周辺のファイルにレビューを絞りたいとき。
スキルのリンク
https://github.com/vudovn/ag-kit/blob/main/.agents/skills/code-review-graph/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“最新の変更を確認する前に、コードグラフを使って影響を受けるファイルを示してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このスキルは、コードをその構造のグラフに解析するMCPサーバーを使い、グラフはローカルのデータベースに保存されます。AIはそのグラフに問い合わせて、変更が影響しうるファイルを見つけます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Code Review Graph — Token-Efficient Codebase Context via MCP
Cut AI token usage substantially on large codebases by giving the AI a structural map instead of letting it read everything. Savings scale with codebase size — marginal on small projects, large on monorepos.
Overview
code-review-graph is an MCP server that uses Tree-sitter to parse your codebase into an AST graph stored in SQLite. When your AI assistant needs context for a task, it queries the graph first — getting only the files in the blast radius of your change — instead of reading every file in the directory.
Token Impact (illustrative — varies by codebase):
| Codebase Type | Pattern |
|---|---|
| Large monorepo (10K+ files) | Biggest savings — graph reads a small fraction of files |
| Mid-size app (1-5K files) | Meaningful reduction on multi-file changes |
| Small project (<200 files) | Little benefit — graph overhead can exceed savings |
Quality angle: scoping the AI to the blast radius reduces noise, which tends to improve review focus. Measure on your own repo rather than relying on a fixed multiplier.
Bootstrap Protocol (opt-in)
When invoked during /plan or standard usage on a mid-to-large project, check whether graph analysis is available before relying on it:
- Step 1: Check if the tool is installed:
Get-Command code-review-graph(Windows) orwhich code-review-graph(macOS/Linux). - Step 2: Check if a
.code-review-graph/directory exists in the workspace. - Step 3: If installed but the index is missing, ask the user before running
code-review-graph build(it scans the whole project). - Step 4: If not installed and the project is large, ask the user: "Would you like to
pip install code-review-graphand build a local map to cut token usage for this project?" Never install or run build without confirmation.
When to Use vs When to Skip
✅ Install it if:
- Codebase is 500+ files
- You make multi-file changes with cross-module dependencies
- You spend $20+/month on AI assistant tokens
- You work with monorepos, microservices, or cross-package TypeScript
- You want better review quality in addition to cost savings
❌ Skip it if:
- Codebase is under ~200 files with isolated single-file changes
- Heavy use of dynamic patterns (reflection, runtime code gen, dynamic imports)
- You want zero-maintenance — the graph needs to stay in sync
- Team hasn't standardized on an AI coding tool yet
⚠️ Evaluate first if:
- Codebase is 200–500 files — benchmark before committing
- Mix of static and dynamic patterns — test on representative commits
How It Works (4 Layers)
Layer 1: PARSE → Tree-sitter builds ASTs from 19 languages
Layer 2: STORE → Nodes + edges saved in SQLite graph
Layer 3: TRACE → BFS computes blast radius of changes
Layer 4: SERVE → MCP exposes graph to AI assistants
What the Graph Contains
- Nodes: Files, functions, methods, classes, imports, tests
- Edges: "A calls B", "X imports Y", "TestZ covers FunctionW", "ClassA extends ClassB"
- Metadata: Name, type, file path, line range per node
- Privacy: Structural metadata only — NO source code content in the graph
Supported Languages (19)
Python, TypeScript, JavaScript, Go, Rust, Java, C#, Ruby, Kotlin, Swift, PHP, C/C++, Vue SFC, Solidity, Dart, R, Perl, Lua, Jupyter/Databricks notebooks.
Installation
Prerequisites
- Python 3.9+ (
python3 --version) - pip or pipx installed
- An MCP-compatible AI client (AG Kit, Claude Code, Cursor, Windsurf, Zed)
- Git-tracked codebase (for incremental updates)
Step 1: Install the Package
# Recommended: isolated environment
pipx install code-review-graph
# Alternative: fastest, no permanent install
uvx code-review-graph install
# Alternative: global pip
pip install code-review-graph
Step 2: Configure MCP Client
# Auto-detect all supported tools
code-review-graph install
# Or target a specific platform
code-review-graph install --platform claude-code
code-review-graph install --platform cursor
code-review-graph install --platform windsurf
Restart your editor after this step. The MCP server activates on restart.
Step 3: Build the Initial Graph
cd /your/project
code-review-graph build
| Codebase Size | Expected Build Time |
|---|---|
| 500 files | 10–30 seconds |
よくある質問
小さなプロジェクトでも役立ちますか?
スキルによると、小さなプロジェクトでは効果が小さく、設定にかかるコストが節約効果を上回ることがあります。
グラフには何が保存されますか?
Tree-sitterで解析したコードの構造を、SQLiteデータベースに保存します。
コードを読む作業の代わりになりますか?
AIが読むファイルを絞り込みますが、レビューは読んだコードの内容に依存します。
詳細
作者による元の説明
Token-efficient code review using Tree-sitter AST graphs and MCP. Cuts AI token usage on large codebases by computing the blast radius of changes instead of reading entire codebases. Uses a SQLite graph database for structural analysis.
repo: vudovn/ag-kit
人気
- GitHubのスター
- 8.2k
- ランキング
- #12528
- ライセンス
- MIT
- 更新日
- 2026/10/18
コメント
- …
このリポジトリの他のスキル
batch-operations
8.2k関数の名前変更や古いimportの置き換えなど、同じ変更を多くのファイルに一度に行うよう、エージェントを支援します。
brainstorming
8.2k何か新しいものや複雑なものを作る前に、エージェントが確認の質問をして、まず目標を理解するよう教えます。
code-review-checklist
8.2k正しさ、セキュリティ、性能、テスト、ドキュメントに加え、AI特有のリスクも含めて、コードをレビューするためのチェックリストをエージェントに与えます。
context-compression
8.2k終わった作業を要約し、重要な決定を残すことで、長いチャットのセッションを短くし、集中を保つようエージェントに教えます。
似ているスキル
diffs
394k編集内容の実際の共有可能な差分を、手書きの要約ではなく、ビューアーのリンクや画像ファイルとして作成するようエージェントを支援します。
coding-agent
394kCodex、Claude Code、OpenCodeに大きめのコーディング作業をバックグラウンドのワーカーとして渡し、その進捗を確認するようエージェントを支援します。
gh-issues
394kGitHubのイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。