MCPInstall

codegraph

Pre-indexed code knowledge graph (MCP, SQLite + tree-sitter) for faster, lower-token exploration of brownfield codebases. Use when starting work on a repo larger than 500 files or when the task involves cross-file traversal — "where is X used", "what calls Y", "what breaks if I change Z", "trace flow from A to B", "explain this subsystem". Skip for single-file edits or sessions shorter than the cold-start cost. Triggers include "codegraph", "code graph", "index this repo", "where is X defined", "find callers of", "callees of", "blast radius of changing X", "explore this codebase". Cuts the grep + Read loops needed to orient, via O(1) SQLite lookups and FTS5 search over 8 MCP tools — but it's an unsound tree-sitter approximation, so grep stays the completeness backstop for renames/exhaustive callers.

Installs
819
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/onsager-ai/dev-skills --skill codegraph
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads codegraph automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

codegraph

Local code graph exposed as 8 MCP tools. Accelerates exploration with O(1) SQLite lookups and FTS5 search — slashing the grep + Read loops needed to orient in a codebase.

It does not replace grep. Codegraph is a tree-sitter approximation of the call graph, not a compiler-grade one: it is fast and low-token but unsound (it has false negatives). Treat it as the accelerator for orientation and traversal, and keep grep as the source of truth for completeness. See Soundness & limits below — this distinction is load-bearing, not a footnote.

When to use

  • Brownfield repo where structure is non-obvious
  • Task involves: "where is X used", "what breaks if I change Y", "trace flow from A to B"
  • Long-running session — cold-start cost amortizes over multiple queries

When NOT to use

  • Single-file edits or trivial lookups
  • Session likely shorter than cold-start cost (see references/spike.md for per-repo numbers)
  • Repo not initialized AND no cached .codegraph/ AND short session

Soundness & limits — read before trusting a result

Codegraph is built on tree-sitter, not the compiler, so its call/reference edges are an approximation. It fails in three confirmed ways. The governing rule falls out of them:

Grep is the source of truth for completeness. Codegraph is the accelerator for orientation and traversal. Never invert these.

The asymmetry is the whole argument: for a refactor, a false negative is dangerous (you miss a caller, ship a break); a false positive is merely annoying (you glance and discard). Codegraph has false negatives; grep does not. So codegraph may propose and rank, but grep confirms whenever the answer must be exhaustive.

The three failure modes (measured on a ~580-file Rust+TS repo):

  1. Unsound edges → false negatives. callers/callees/impact miss real call sites when the receiver type can't be resolved from syntax alone (calls on locals, generics, trait objects). Measured: a method with 8 real callers returned 2 — the 5 dropped were local.method() and generic-dispatch sites, with no warning. Exact on unique free-functions + direct calls (verified 1/1, 2/2); unreliable on method dispatch.
  2. Name resolution is fuzzy and overload-blind. Bare-name queries prefix-match (useWorkspace answered for useWorkspacesQuery — a different symbol) and conflate overloads (execute, with 19 definitions, returned sqlx's .execute() DB calls, not the trait method). For any name with multiple definitions, drop to codegraph_node on a specific symbol id; bare callers/callees are unattributable.
  3. The index lags the disk. CLI sees nothing until codegraph sync (~0.3s); the MCP file-watcher closes the gap to ~1–2s. Right after an edit, the index is wrong — grep/Read is ground truth until it catches up.

Decision matrix

TaskToolWhy
Orient / "explain subsystem X" / first surveycodegraph exploreOne call, ranked, verbatim source — far less context than grep+Read
Callers of a uniquely-named free functioncodegraph callers (trust it)Exact on unique names + direct calls
Find ALL callers before a signature change / renamegrep authoritative; codegraph only to pre-rankCodegraph is unsound here — completeness can't depend on it
Anything with an overloaded name (execute, lookup, run, new)grep, or codegraph node on a specific idBare-name codegraph conflates / under-resolves unpredictably
Impact of a core typecodegraph impact --depth 1 to pre-rank, then grep to confirmDefault depth-2 inflates (test fns + one file entry per file) and isn't depth-ranked
Just-edited codegrep (or codegraph sync first)Index is stale until reindex
Trait-dispatch / generic call sitesgrep + readingBoth weak; codegraph silently drops them, grep at least surfaces the text

Workflow: start with explore for the map and callers/impact for direction — but the moment the answer must be complete (a rename, "did I get everyone?"), confirm with grep and treat any codegraph-vs-grep delta as "codegraph missed it," not "grep over-matched."

Prerequisites

  • Node 18+ on PATH
  • Project has .codegraph/ (run codegraph init if not)
  • For cloud sessions: cold-start cost verified via references/spike.md for the target repo

Files

  • references/install.md — installation for local / Claude Code Cloud / devcontainer
  • references/usage.md — which of the 8 MCP tools to use when, with main-session vs subagent rules
  • references/spike.md — cold-start measurement protocol; run once per new target repo before relying on codegraph in cloud sessions

Known integration targets

Cold-start measured locally (Node 22, 4 cores). Cloud cold-start still pending — re-run references/spike.md in a cloud session before relying on these numbers there.

RepoIndexed filesNodes / edgesDB sizeCold init+indexQuery wall
onsager-ai/onsager578 (rust + tsx/ts)8.6k / 20k24 MB12s~0.9s
crawlab-team/crawlab644 (go)6.8k / 15k11 MB6s~0.9s
codervisor/leanspec695 (tsx/rust/ts)8.9k / 21k23 MB10s~0.9s

Per-query wall is dominated by Node startup — the SQLite work itself is milliseconds. End-to-end cold-start including one-shot npx install is ~13–19s for repos in this size class.

FAQ

What does the codegraph skill do?

Pre-indexed code knowledge graph (MCP, SQLite + tree-sitter) for faster, lower-token exploration of brownfield codebases. Use when starting work on a repo larger than 500 files or when the task involves cross-file traversal — "where is X used", "what calls Y", "what breaks if I change Z", "trace flow from A to B", "explain this subsystem". Skip for single-file edits or sessions shorter than the cold-start cost. Triggers include "codegraph", "code graph", "index this repo", "where is X defined", "find callers of", "callees of", "blast radius of changing X", "explore this codebase". Cuts the grep + Read loops needed to orient, via O(1) SQLite lookups and FTS5 search over 8 MCP tools — but it's an unsound tree-sitter approximation, so grep stays the completeness backstop for renames/exhaustive callers.

How do I install codegraph?

Run npx skills add https://github.com/onsager-ai/dev-skills --skill codegraph in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/codegraph/ (personal) or .claude/skills/codegraph/ (project).

Which AI agents can use codegraph?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is codegraph safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains codegraph?

It is published by onsager-ai in onsager-ai/dev-skills. It has 819 recorded installs.

More from onsager-ai/dev-skills

View all →

github-integration

onsager-ai/dev-skills

Open the skill to read its SKILL.md instructions.

66 installs

git-commit

onsager-ai/dev-skills

Open the skill to read its SKILL.md instructions.

agent-browser

onsager-ai/dev-skills

Open the skill to read its SKILL.md instructions.

issue-spec

onsager-ai/dev-skills

Open the skill to read its SKILL.md instructions.

plan-dag

onsager-ai/dev-skills

Open the skill to read its SKILL.md instructions.

rust-node-ci

onsager-ai/dev-skills

Open the skill to read its SKILL.md instructions.

Backend & APIs61 installs

Popular data & databases skills

View category →

Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.

OfficialData & Databases462.2K installs

prisma-client-api

prisma/skills

Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".

OfficialData & Databases393.5K installs

Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.

OfficialData & Databases392.3K installs

prisma-cli

prisma/skills

Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.

OfficialData & Databases390.8K installs

prisma-postgres

prisma/skills

Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.

OfficialData & Databases384.4K installs

Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.

OfficialData & Databases378.9K installs