一键导入
graph
Query the CodeGraphContext code graph for cross-cutting analysis (callers, callees, dead code, dependency chains)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Query the CodeGraphContext code graph for cross-cutting analysis (callers, callees, dead code, dependency chains)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | graph |
| description | Query the CodeGraphContext code graph for cross-cutting analysis (callers, callees, dead code, dependency chains) |
| argument-hint | [callers <func>|calls <func>|dead-code|complexity|chain <from> <to>|tree <class>|deps <module>|find <pattern>|reindex|stats] |
| user-invocable | true |
| allowed-tools | Bash, Read |
Query the CGC code graph for structural analysis that complements Serena's symbol-level intelligence.
docker ps | grep cgc-neo4jdocker start cgc-neo4j.venv-cgc/ with codegraphcontext installedThe project .env overrides CGC config. ALL commands MUST use this prefix:
cd "C:/Users/Anirudh Mohan/Desktop/FloodSafe"
source .venv-cgc/Scripts/activate
PYTHONIOENCODING=utf-8 NEO4J_URI=bolt://localhost:7687 NEO4J_USERNAME=neo4j NEO4J_PASSWORD=floodsafe123 cgc -db neo4j <command>
| Need | Use | Why |
|---|---|---|
| Find symbol definition + body | Serena find_symbol | Precise, includes body |
| Find direct references to a symbol | Serena find_referencing_symbols | Language-server powered |
| Transitive call chains (N-hop) | CGC analyze callers / analyze calls | Graph traversal |
| Dead code detection | CGC analyze dead-code | Cross-language, whole-repo |
| Cyclomatic complexity report | CGC analyze complexity | Threshold-based filtering |
| Call chain between two symbols | CGC analyze chain | Graph shortest-path |
| Class inheritance tree | CGC analyze tree | Hierarchy visualization |
| Module dependencies | CGC analyze deps | Import-level relationships |
| Safe refactoring (rename/replace) | Serena editing tools | LSP-powered |
| Impact analysis before refactoring | CGC then Serena | CGC for scope, Serena for execution |
Based on $ARGUMENTS, run the appropriate query:
callers <function_name> — Who Calls This Function?cgc -db neo4j analyze callers "$FUNCTION_NAME"
Shows the full call chain leading to a function. Useful for impact analysis before refactoring.
calls <function_name> — What Does This Function Call? (Callees)cgc -db neo4j analyze calls "$FUNCTION_NAME"
Shows everything a function depends on. Useful for understanding complexity and blast radius.
dead-code — Unreferenced Symbolscgc -db neo4j analyze dead-code
# Exclude FastAPI route decorators (they're entry points, not dead code):
cgc -db neo4j analyze dead-code --exclude route,router,get,post,put,delete,api
Finds unreferenced functions/classes. Review before deleting — some may be:
@router.get/post)complexity — Cyclomatic Complexitycgc -db neo4j analyze complexity --threshold 10
Lists functions exceeding the complexity threshold. Candidates for refactoring.
chain <from> <to> — Call Chain Between Two Symbolscgc -db neo4j analyze chain "$SYMBOL_A" "$SYMBOL_B"
Finds the shortest call chain connecting two symbols. Useful for tracing data flow.
tree <class_name> — Class Inheritance Hierarchycgc -db neo4j analyze tree "$CLASS_NAME"
Shows the inheritance hierarchy for a class.
deps <module_name> — Module Dependenciescgc -db neo4j analyze deps "$MODULE_NAME"
Shows imports and dependencies for a module.
find <pattern> — Pattern Search in Graphcgc -db neo4j find pattern "$PATTERN"
Search for symbols matching a pattern in the graph database. Returns up to 50 matches with type, location, and source.
reindex — Re-index Codebasecgc -db neo4j index apps/backend/src
cgc -db neo4j index apps/frontend/src
cgc -db neo4j index apps/ml-service/src
cgc -db neo4j index apps/iot-ingestion
NOTE: Root cgc index . doesn't work well due to .cgcignore exclusions. Index subdirectories explicitly.
stats — Indexing Statisticscgc -db neo4j stats
Shows files, functions, classes, modules, and repositories in the graph.
Add --viz or -V to any analyze/find command to generate an interactive HTML graph:
cgc -db neo4j analyze callers "FHICalculator" --viz
| Directory | Files | Content |
|---|---|---|
apps/backend/src | ~120 | FastAPI routers, services, models |
apps/frontend/src | ~180 | React components, hooks, contexts |
apps/ml-service/src | ~60 | ML models, FHI calculator |
apps/iot-ingestion | ~6 | IoT data ingestion |
| Total | 366 files, 2082 functions, 339 classes |
Present results as:
| Issue | Fix |
|---|---|
| "Database not configured" / fallback to FalkorDB | Ensure env vars are set: NEO4J_URI, NEO4J_USERNAME, NEO4J_PASSWORD + -db neo4j flag |
| Neo4j container not running | docker start cgc-neo4j |
| Unicode/encoding errors | Ensure PYTHONIOENCODING=utf-8 is set |
| "No indexed repos" / 0 files | Index subdirectories explicitly (see reindex section) |
| Stale results after refactor | Re-index affected directories |
Check health of all production services — frontend (Vercel), backend + domain-specific (Koyeb), ML service, key API endpoints, per-city integrations
Scan codebase for real counts (hotspots, contexts, tables, cities, routers, screens) and compare against FEATURES.md, CLAUDE.md, README.md. Reports drift and optionally applies fixes.
Deploy frontend (Vercel) and/or backend (Koyeb) to production with pre-deploy quality gates
Manage Koyeb backend services - check status, view logs, redeploy, list deployments
Run all quality gates before any major change. Checks TypeScript types, Vite build, ESLint, and backend tests.
Visual verification of frontend UI using Claude-in-Chrome browser automation. Takes screenshots of all screens at desktop and mobile viewports.