From codegraph
Use when about to refactor, rename, or change function signatures — runs blast radius and caller analysis before editing to understand cross-file impact. Also use when exploring unfamiliar code to trace call chains and dependencies. Use codegraph_brief at the start of sessions for instant codebase understanding.
How this skill is triggered — by the user, by Claude, or both
Slash command
/codegraph:codegraphThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- **Node.js** >= 20
npm install compiles them)cd <plugin-dir> && npm install && npm run build.claude/.mcp.json or via codegraph setup --claudecodegraph index --project <root> (creates .codegraph/graph.db)Use the CodeGraph MCP tools to understand code relationships before making changes. CodeGraph indexes both code (TS/JS via Tree-sitter + TypeScript LanguageService) and documentation (Markdown files that reference code symbols).
If this is the first time using CodeGraph on a project:
Build the plugin (once, after installation):
cd <plugin-directory>
npm install && npm run build
Index the project:
codegraph index --project <project-root>
This takes 1-5 seconds. Creates .codegraph/ (auto-added to .gitignore).
Also indexes .md/.mdx files — documentation that references code symbols gets linked in the graph.
For Codex CLI / Cursor / Windsurf (not Claude Code):
codegraph setup --codex # or --cursor, --windsurf, --all
codegraph_brief for instant codebase understanding — architecture, hotspots, risk zones, entry pointscodegraph_blast to see full impact radius (code callers + doc references)codegraph_callers to find all call sitescodegraph_callees to trace what a function depends oncodegraph_depends to see import/require treecodegraph_search with a name or substring| Tool | What it does | Key inputs |
|---|---|---|
codegraph_brief | Complete codebase briefing — architecture, hotspots, risk zones, entry points, module map | — |
codegraph_blast | Full impact radius (callers + callees + affected files + doc references) | symbol, optional file/depth |
codegraph_callers | Who calls this symbol? (recursive) | symbol, optional file/qualified_name/symbol_uid/depth |
codegraph_callees | What does this symbol call? (recursive) | symbol, optional file/qualified_name/symbol_uid/depth |
codegraph_depends | File-level dependency tree | file, optional direction (in/out/both) |
codegraph_search | Find symbols by name substring | query, optional kind |
codegraph_status | Index health — file count, stale files, last indexed | — |
CodeGraph indexes .md and .mdx files alongside code. When a doc file references a code symbol in backticks (e.g., `processPayment`), an edge is created linking the doc to the code symbol.
This means:
codegraph_blast shows which docs reference the symbol you're changingExample blast radius output:
### Callers (8)
- handleCheckout → src/checkout/actions.ts:18
- ...
### Documentation referencing this symbol (2)
- docs/TLDR-checkout.md:45 — "The `processPayment` function handles..."
- docs/ADR-0015.md:23 — "We chose `processPayment` because..."
When a symbol name is ambiguous (e.g., multiple render methods), tools return a disambiguation list. Re-query with one of:
file — narrows to a specific filequalified_name — e.g., Foo.render for class methods (resolves same-file ambiguity)symbol_uid — exact match, always unambiguousPriority: symbol_uid > qualified_name + file > symbol + file > symbol
codegraph_brief for full codebase understandingcodegraph_status. If stale files are reported, suggest codegraph index --incrementalcodegraph_search with a substringfile or qualified_namecodegraph_blast for full picture (code + docs), or codegraph_callers/codegraph_callees for directional analysisThese run automatically — no manual action needed:
| Hook | Trigger | What happens |
|---|---|---|
| SessionStart | New session | Checks build, native modules (auto-rebuilds on ABI mismatch), index, staleness |
| PreToolUse (Edit) | Before any edit to TS/JS files | Blast radius gate — warns if edit affects many call sites + docs |
| PreToolUse (Bash) | git pull/merge/rebase/checkout/switch/reset/restore/cherry-pick, stash pop/apply, npm/pnpm/yarn install | Suggests incremental re-index |
| PostToolUse (Edit/Write) | After file edit | Warns if edited file is stale in the index |
| PostToolUse (Bash) | git pull/merge/rebase/checkout/switch/reset/restore/cherry-pick, stash pop/apply, npm/pnpm/yarn install | Triggers incremental re-index automatically |
codegraph index --incremental (<200ms for a few files)codegraph reset (deletes index and rebuilds from scratch)tsconfig.json, package.json, pnpm-workspace.yaml changes trigger full re-index automatically in incremental modenpx claudepluginhub mariogusmao/mg-plugins --plugin codegraphIndexes a codebase as a structural graph for querying callers, callees, inheritance, blast radius, and semantic code search. Useful for understanding code connectivity, impact analysis, and navigating unfamiliar repos.
Queries codebase knowledge graphs to search functions, trace callers/callees, list file entities, analyze impact, and run SurrealQL. Use for code structure, dependencies, and relationships.
AST-aware code search, symbol navigation, and dependency graph analysis via the gcode CLI. Essential for exploring codebases, finding functions/classes, understanding call graphs, and checking blast radius before changes.