codegraph
БесплатноБез исполняемых скриптовНе проверенCodeGraph indexes a source tree into a local SQLite knowledge graph of symbols, calls and imports, and serves it to coding agents over MCP and a CLI. Use it…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
CodeGraph — a local code knowledge graph for coding agents
Overview
CodeGraph parses a project with tree-sitter, stores every symbol (functions, classes, methods) and relationship (calls, imports, extends, implements) in .codegraph/codegraph.db inside the project, and answers structural questions from that index instead of from repeated grep and file reads. Everything runs locally: no API keys, no network service. A file watcher keeps the index current while an agent works.
It has two faces:
- an MCP server (
codegraph serve --mcp) that agents launch themselves; by default it exposes one tool,codegraph_explore, which returns the relevant source, call paths and a blast-radius summary in a single call; - a CLI (
codegraph query,callers,callees,impact,affected, ...) that a person, a script, or an agent without MCP can call directly.
It supports about 30 languages including TypeScript, JavaScript, Python, Go, Rust, Java, C#, PHP, Ruby, C/C++, Swift, Kotlin and Dart. It is a code-structure index, not a documentation generator or a visual explorer.
Instructions
Install
Lead with the package manager. The package is @colbymchenry/codegraph (binary codegraph):
npm install -g @colbymchenry/codegraph
codegraph version
The project also publishes a standalone installer (install.sh / install.ps1 in the repository root) for machines without Node. If you use it, download the file, read it, then run it as a separate step; do not pipe it into a shell.
Upgrade with codegraph upgrade (add --check to only look, or pass a version to pin it). Remove with codegraph uninstall (--keep-cli keeps the binary).
Index a project
Run once per project, from its root:
cd ~/work/storefront
codegraph init
init creates .codegraph/ and builds the whole graph in one step; it refuses a home folder or filesystem root unless you pass --force; --yes skips every prompt for scripts and CI. Afterwards:
codegraph status # file, node and edge counts, DB size, journal mode
codegraph sync # incremental update (normally the watcher does this)
codegraph index --force # full re-index if the graph looks wrong
codegraph uninit # delete the graph for this project
.codegraph/ is generated data: add it to .gitignore unless the team decides otherwise.
Query the graph from the CLI
codegraph query checkout --limit 5 # find symbols by name (--kind, --json)
codegraph explore "how is the order total computed" # source + call paths in one shot
codegraph node total # one symbol's source plus its callers
codegraph callers total # who calls it
codegraph callees checkout # what it calls
codegraph impact total --depth 3 # everything affected by changing it
codegraph files --max-depth 2 # project structure (--format, --filter, --json)
explore prints the same payload the MCP tool returns. --json on query, callers, callees, impact and files gives machine-readable output.
Find the tests a change affects
affected follows imports transitively from changed files to test files:
codegraph affected src/cart.ts src/order.ts
git diff --name-only HEAD | codegraph affected --stdin --quiet
codegraph affected src/auth.ts --filter "e2e/*" --depth 5
--quiet prints only paths, so the result can be handed to a test runner (npx vitest run $(...)).
Connect an agent over MCP
The documented route is the installer, run in a terminal where you are happy for it to edit agent configuration:
codegraph install # interactive: choose agents and global/local scope
codegraph install --yes --init # non-interactive, then index the current project
codegraph install --target=claude,codex --location=local --yes
It detects Claude Code, Cursor, Codex CLI, opencode, Hermes Agent, Gemini CLI, Antigravity IDE, Kiro and GitHub Copilot, writes each one's MCP entry plus a short marked instructions section, and for Claude Code also adds an auto-allow permission (mcp__codegraph__*) and a UserPromptSubmit hook running codegraph prompt-hook. With --location=local for Claude Code the files are .mcp.json, .claude/settings.json and .claude/CLAUDE.md inside the project; the global location edits files in your home directory. codegraph uninstall reverses all of it. Restart the agent afterwards; it uses CodeGraph automatically in any project that has a .codegraph/ directory.
To see what would be written without touching any file:
codegraph install --print-config claude
codegraph install --print-config codex
For Claude Code the printed entry (the global location is ~/.claude.json; the local one is the project's .mcp.json) is:
{
"mcpServers": {
"codegraph": {
"type": "stdio",
"command": "codegraph",
"args": ["serve", "-
Установить codegraph в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл codegraph?
CodeGraph indexes a source tree into a local SQLite knowledge graph of symbols, calls and imports, and serves it to coding agents over MCP and a CLI. Use it when an agent burns tool calls on grep and file reads to understand a codebase, or when you need callers, callees, blast radius or affected tests for a symbol. Covers install, `codegraph init`, query/explore/impact/affected commands, MCP registration, exclusions and troubleshooting. Triggers: "index my repo for the agent", "who calls this function", "what breaks if I change this", "codegraph".
Как установить скилл codegraph?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл codegraph запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic