code-review-graph
What it does
This skill sets up a map of how the files in a project connect. It helps your AI focus on the files a change touches instead of reading the whole project. It is for teams with large codebases.
When to use it
- βWhen you review a change in a large project with many files.
- βWhen your AI runs short of room because the codebase is too big to read.
- βWhen you want to limit a review to the files around one change.
Skill link
https://github.com/vudovn/ag-kit/blob/main/.agents/skills/code-review-graph/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βUse the code graph to show me which files are affected by my latest change before you review it.β
5 new skills a week. 1 minute to read.
How it works
The skill uses an MCP server that parses code into a graph of its structure, stored in a local database. The AI queries that graph to find the files a change could affect.
Technical content (original SKILL.md)
Original text by the author, straight from 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 |
FAQ
Is this useful for a small project?
The skill says the benefit is small on small projects, where the setup can cost more than it saves.
What does the graph store?
It stores the code structure in a SQLite database built with Tree-sitter parsing.
Does it replace reading the code?
It narrows down which files the AI reads, but the review still depends on the code it looks at.
Details
Original description by the author
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
Popularity
- GitHub stars
- 8.2k
- Ranking position
- #12528
- License
- MIT
- Updated
- 10/18/2026
Comments
- β¦
More skills from this repository
batch-operations
8.2kHelps your agent make the same change across many files at once, such as renaming a function or replacing an old import everywhere.
brainstorming
8.2kTeaches your agent to ask clarifying questions before building anything new or complex, so it understands your goal first.
code-review-checklist
8.2kGives your agent a checklist for reviewing code for correctness, security, performance, testing and documentation, including AI-specific risks.
context-compression
8.2kTeaches your agent to shorten long chat sessions by summarizing finished work and keeping key decisions, so it stays focused.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.