with one click
codegraphcontext-cli
// Use CodeGraphContext (cgc) CLI to index repos and answer structural code questions (callers/callees, call chains, inheritance, dependencies, search), especially when plain text search is too noisy.
// Use CodeGraphContext (cgc) CLI to index repos and answer structural code questions (callers/callees, call chains, inheritance, dependencies, search), especially when plain text search is too noisy.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | codegraphcontext-cli |
| description | Use CodeGraphContext (cgc) CLI to index repos and answer structural code questions (callers/callees, call chains, inheritance, dependencies, search), especially when plain text search is too noisy. |
Use this skill by default for structural code questions, or when plain text search would require opening many files or large files: callers/callees, call chains, inheritance, overrides, symbol ownership, module dependencies, dead-code triage, or complexity hotspots.
Do not default to cgc for simple literal-text lookups. Use direct text search and targeted file reads when the task is just finding exact text, a short string, or a small unambiguous file match. For structure or relationship questions, or when plain text search would force broad file reads, prefer cgc first and fall back only if cgc is unavailable or clearly too noisy for the query.
cgc help | cat and cgc <command> --help | cat instead of guessing flags from memory.cgc ... commands you ran and summarize results with concrete identifiers: symbol names, file paths, relationship direction.find and analyze before query.find and analyze commands search across all indexed repositories, not just the current repo. This is the main source of confusion. Narrow by file when supported, or fall back to repo-scoped Cypher.cgc query only for read-only Cypher. It is the escape hatch when high-level commands are too broad.-V / --visual and cgc visualize are for interactive graph views.cgc versioncgc doctorcgc listcgc stats . or cgc stats /abs/repo/pathcgc config show when backend, ignore settings, or indexing behavior matterscgc index .cgc index . --forcecgc watch .cgc find name SYMBOL --type function|class|module|filecgc find pattern authcgc find content "retry backoff"cgc find variable NAME or cgc analyze variable NAMEcgc find argument user_idcgc find decorator app.routecgc analyze callers FUNCTIONcgc analyze calls FUNCTIONcgc analyze chain FROM_FUNC TO_FUNCcgc analyze deps MODULE_NAMEcgc analyze tree CLASS_NAMEcgc analyze overrides METHOD_NAMEcgc analyze complexity --limit 20cgc analyze dead-code--file, use it when the symbol name is common.cgc query and scope by path.Use these when high-level commands are too broad. Prefer path-based filtering because it is simple and avoids multi-repo ambiguity.
List indexed repositories:
cgc query "MATCH (r:Repository) RETURN r.name, r.path ORDER BY r.name"Find an exact function inside one repo:
cgc query "MATCH (f:Function {name: 'main'}) WHERE f.path STARTS WITH '/abs/repo/' RETURN DISTINCT f.name, f.path ORDER BY f.path"Find matching classes/functions/modules inside one repo:
cgc query "MATCH (n) WHERE (n:Function OR n:Class OR n:Module) AND n.name CONTAINS 'Auth' AND n.path STARTS WITH '/abs/repo/' RETURN DISTINCT labels(n), n.name, n.path ORDER BY n.name LIMIT 50"Find callers of a function inside one repo:
cgc query "MATCH (caller:Function)-[:CALLS]->(target:Function {name: 'process_data'}) WHERE caller.path STARTS WITH '/abs/repo/' RETURN DISTINCT caller.name, caller.path ORDER BY caller.path LIMIT 50"Find callees of a function in a specific file:
cgc query "MATCH (caller:Function {name: 'process_data'})-[:CALLS]->(callee:Function) WHERE caller.path = '/abs/repo/src/main.py' RETURN DISTINCT callee.name, callee.path ORDER BY callee.path"Notes:
DISTINCT liberally in Cypher output. Variable-length traversals and duplicate edges can otherwise repeat rows.cgc list.| cat.find type or find pattern result is exhaustive or repo-local.cgc query returns JSON-like rows and is often easier to summarize precisely than table output.cgc version before relying on examples. Installed behavior may lag or differ from the latest upstream docs.cgc config show for the real local backend and indexing settings. On some installations the docs/help may disagree about backend defaults or available values.IGNORE_DIRSIGNORE_HIDDEN_FILESIGNORE_TEST_FILESMAX_DEPTHMAX_FILE_SIZE_MBINDEX_VARIABLESSCIP_INDEXERSCIP_LANGUAGESIf structural answers look incomplete or wrong, mention these settings explicitly in your response.
cgc start is deprecated. Use cgc mcp start only when MCP server mode is explicitly needed.cgc watching lists background watch state; it will not show foreground CLI cgc watch sessions.cgc analyze dead-code [PATH] advertises a path argument, but the help text says that path-specific analysis is not yet implemented. Treat it as whole-database analysis.cgc config db --help may show fewer backend options than cgc config show suggests. Do not assume cross-version consistency here.Do not run these unless the user explicitly asks:
cgc deletecgc delete --allcgc bundle import --clearcgc config resetcgc index --force when a normal cgc index . is sufficientUse caution with:
cgc clean because it mutates the database state, even though it is housekeeping rather than full deletioncgc config set / cgc config db because they change persistent local defaultsIf destructive or stateful maintenance is genuinely needed, explain why first and suggest a backup path such as cgc bundle export /tmp/repo-backup.cgc.
These are not the default path for answering code questions, but they matter when the user asks for environment setup, AI-assistant integration, or portable graph snapshots:
cgc mcp ...: configure/start the MCP server and list available MCP toolscgc bundle ...: export or import portable .cgc graph snapshotscgc registry ...: browse/download/request published bundlescgc config ...: inspect or change persistent settingsIf the user only wants an answer about code structure, stay in the CLI analysis/query path and avoid drifting into setup/admin commands.