CodeGraph
/install codegraph
Code Graph
Analyze project structure via AST parsing instead of reading every file.
Quick Start
Build cache (first time or after changes)
python3 skills/code-graph/scripts/analyze.py \x3Cproject_dir>
Creates .code-graph.json in the project root. Takes seconds for most projects.
Query the cache
python3 skills/code-graph/scripts/analyze.py \x3Cproject_dir> --query \x3Ccommand> [args]
Available Queries
| Query | Description |
|---|---|
stats |
Project overview: file counts, lines, functions, classes |
functions |
List all functions with file + line number |
classes |
List all classes with bases, methods, file + line |
calls \x3Cfunc> |
What does func call? (outgoing edges) |
callers \x3Cfunc> |
Who calls func? (incoming edges) |
file \x3Cpath> |
Full summary of one file (functions, classes, imports, calls) |
imports |
Import graph: file → modules imported |
search \x3Cpattern> |
Find functions/classes matching pattern |
Workflow
- First encounter with a project: run the build to create cache
- Before reading files: query
statsthensearchto find what you need - Before modifying code: query
callersto check impact - After modifying code: rebuild cache with a fresh run (no
--query)
Cache Location
- Default:
\x3Cproject_dir>/.code-graph.json - Override:
--output \x3Cpath>
Rebuild
Re-run without --query to rebuild. The cache includes a fingerprint for staleness detection.
Exclude Directories
python3 skills/code-graph/scripts/analyze.py \x3Cproject_dir> --exclude vendor --exclude tmp
Default excludes: node_modules, .git, pycache, .venv, dist, build, .next, coverage
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install codegraph - 安装完成后,直接呼叫该 Skill 的名称或使用
/codegraph触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
CodeGraph 是什么?
Build and query AST summaries + call graphs for codebases. Use when exploring a project's structure, finding function definitions, tracing call chains, under... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 41 次。
如何安装 CodeGraph?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install codegraph」即可一键安装,无需额外配置。
CodeGraph 是免费的吗?
是的,CodeGraph 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
CodeGraph 支持哪些平台?
CodeGraph 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 CodeGraph?
由 sg345662365-oss(@sg345662365-oss)开发并维护,当前版本 v1.0.0。