Chuyển đến nội dung
Skillpedia
Lập trình chung8.2k · #12528

code-review-graph

Skill này làm gì

Skill này thiết lập một bản đồ về cách các file trong dự án liên kết với nhau. Nó giúp AI của bạn tập trung vào các file mà một thay đổi chạm tới thay vì đọc toàn bộ dự án. Dành cho các nhóm có codebase lớn.

Khi nào nên dùng

  • ✓Khi bạn rà soát một thay đổi trong một dự án lớn có nhiều file.
  • ✓Khi AI của bạn hết chỗ vì codebase quá lớn để đọc.
  • ✓Khi bạn muốn giới hạn việc rà soát vào các file xung quanh một thay đổi.

Liên kết skill

https://github.com/vudovn/ag-kit/blob/main/.agents/skills/code-review-graph/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/vudovn/ag-kit/blob/main/.agents/skills/code-review-graph/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Dùng đồ thị mã để cho tôi xem những file nào bị ảnh hưởng bởi thay đổi mới nhất của tôi trước khi bạn rà soát.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill dùng một máy chủ MCP phân tích mã thành đồ thị cấu trúc, lưu trong cơ sở dữ liệu cục bộ. AI truy vấn đồ thị đó để tìm các file mà một thay đổi có thể ảnh hưởng.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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:

  1. Step 1: Check if the tool is installed: Get-Command code-review-graph (Windows) or which code-review-graph (macOS/Linux).
  2. Step 2: Check if a .code-review-graph/ directory exists in the workspace.
  3. Step 3: If installed but the index is missing, ask the user before running code-review-graph build (it scans the whole project).
  4. Step 4: If not installed and the project is large, ask the user: "Would you like to pip install code-review-graph and 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
Câu hỏi thường gặp

Điều này có hữu ích cho dự án nhỏ không?

Skill nói lợi ích nhỏ trên các dự án nhỏ, vì việc thiết lập có thể tốn nhiều hơn những gì nó tiết kiệm.

Đồ thị lưu những gì?

Nó lưu cấu trúc mã trong cơ sở dữ liệu SQLite được xây dựng bằng phân tích Tree-sitter.

Nó có thay thế việc đọc mã không?

Nó thu hẹp những file AI đọc, nhưng việc rà soát vẫn phụ thuộc vào mã mà nó xem.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
8.2k
Vị trí xếp hạng
#12528
Giấy phép
MIT
Cập nhật
18/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự