跳到正文
cccskills
免费在 GitHub 公开

code-graph-context

Structural code graph queries via CodeGraphContext MCP (tree-sitter + KuzuDB). Find callers, callees, class hierarchies, dead code, and module dependencies.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(10)

  • SKILL.md6.4 KB
  • commands/code-graph-context.md118 B
  • hooks/post-execute.cjs189 B
  • hooks/pre-execute.cjs295 B
  • references/research-requirements.md946 B
  • rules/code-graph-context.md474 B
  • schemas/input.schema.json819 B
  • schemas/output.schema.json510 B
  • scripts/main.cjs626 B
  • templates/implementation-template.md351 B

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

CodeGraphContext Skill

Structural code graph queries using the CodeGraphContext MCP server (tree-sitter AST + KuzuDB property graph).

When to Use vs Other Search Tools

NeedTool
Who calls foo()?find_callers (this skill)
What does foo() call?find_callees (this skill)
Class hierarchy / interface implementorsget_class_hierarchy (this skill)
Dead code / unreachable functionsfind_dead_code (this skill)
Module-level import graphget_module_deps (this skill)
Keyword / regex searchpnpm search:code or ripgrep
Semantic / conceptual searchcode-semantic-search skill
AST shape matchingcode-structural-search skill
Compiler-verified definition/referenceslsp-navigator skill

Use this skill when you need relationship traversal across the call graph or import graph, not text matching.

MCP Tool Reference

ToolPurposeKey Parameters
find_callersAll functions/methods that call a symbolsymbol, file?, depth?
find_calleesAll symbols called by a functionsymbol, file?, depth?
get_class_hierarchySuperclasses, subclasses, interfacesclass_name, direction?
find_dead_codeFunctions with no callers in graphscope?, min_confidence?
get_module_depsImport/require dependency graphmodule, direction?, depth?
query_graphRaw Cypher query against KuzuDBcypher, params?

Setup

# Install CodeGraphContext MCP server
npm install -g @codetiger/code-graph-context-mcp

# Index your codebase (run from project root)
code-graph-context index --root . --lang typescript,javascript

Add to .claude/settings.json under mcpServers:

"CodeGraphContext": {
  "command": "code-graph-context-mcp",
  "args": ["--db", ".claude/context/data/code-graph.kuzu"]
}

Usage Pattern

// 1. Find all callers of a function
mcp__CodeGraphContext__find_callers({ symbol: 'shouldUseWorktree', depth: 2 });

// 2. Trace what a function depends on
mcp__CodeGraphContext__find_callees({ symbol: 'routeRequest', file: 'routing-table.cjs' });

// 3. Dead code candidates (low confidence = more results)
mcp__CodeGraphContext__find_dead_code({ scope: 'src/', min_confidence: 0.8 });

// 4. Raw Cypher for custom traversal
mcp__CodeGraphContext__query_graph({
  cypher: 'MATCH (a:Function)-[:CALLS]->(b:Function) WHERE b.name = $name RETURN a',
  params: { name: 'handleAuth' },
});

Integration with Agent-Studio Memory

After graph analysis, record structural findings:

MemoryRecord({
  type: 'pattern',
  content: 'routeRequest has 12 callers — high-risk refactor target',
  area: 'architecture',
});
MemoryRecord({
  type: 'gotcha',
  content: 'worktree-utils dead code: shouldPruneWorktree() never called',
  area: 'cleanup',
});

MCP Server Mode (Dual CLI + MCP)

CodeGraphContext supports two operation modes:

CLI mode (batch indexing, one-shot queries):

code-graph-context index --root . --lang typescript,javascript
code-graph-context query --cypher "MATCH (f:Function) RETURN f.name LIMIT 10"

MCP server mode (live, incremental — recommended for agent use):

npx @codetiger/code-graph-context-mcp --watch --db .claude/context/data/code-graph.kuzu

With --watch, the server monitors file changes and re-indexes incrementally. No manual re-index after refactors.

Neo4j Enterprise Option

For large codebases (>100K nodes), replace KuzuDB with Neo4j:

code-graph-context index --root . --backend neo4j --uri bolt://localhost:7687

Add to settings.json:

"CodeGraphContext": {
  "command": "code-graph-context-mcp",
  "args": ["--backend", "neo4j", "--uri", "bolt://localhost:7687"]
}

Interactive HTML Visualization

Generate a browsable call graph:

code-graph-context visualize --output .claude/context/tmp/call-graph.html

Pre-Indexed Bundles

For CI/CD pipelines, ship a pre-built graph bundle with the repo:

# In CI: build + archive
code-graph-context index --root . --export .claude/context/data/code-graph.bundle.gz

# In agent startup: restore
code-graph-context restore --bundle .claude/context/data/code-graph.bundle.gz

Complexity Analysis

// Find high-complexity functions (cyclomatic > 10)
mcp__CodeGraphContext__query_graph({
  cypher:
    'MATCH (f:Function) WHERE f.complexity > $threshold RETURN f.name, f.file, f.complexity ORDER BY f.complexity DESC',
  params: { threshold: 10 },
});

Anti-Patterns

  • Do not use query_graph raw Cypher before checking if a purpose-built tool covers the need
  • Do not treat find_dead_code results as certain — dynamic dispatch and reflection create false positives
  • With --watch MCP mode, manual re-index is not needed — avoid running index --incremental during active MCP sessions
  • Graph queries do not cross language boundaries (TypeScript ≠ Python in same repo)
  • Do not use KuzuDB for >100K node graphs in production — switch to Neo4j backend

When to Invoke

Skill({ skill: 'code-graph-context' });

Invoke for: impact analysis before refactoring, call chain debugging, dead code audits, module dependency reviews, and architectural dependency mapping.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Ensure accessibility in UI components including semantic HTML, ARIA attributes, keyboard navigation, and WCAG 2.2 AA compliance.

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

Use when you want to improve response quality through meta-cognitive reasoning. Applies 15+ reasoning methods to reconsider and refine initial outputs.

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

N-round opposing-stance debates for trade-off analysis. Assigns pro/con roles to agents, runs structured debate rounds with quality scoring, and produces a moderator synthesis with confidence-rated recommendation. Generalizable to architecture, technology, security, and design decisions.

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

Force adversarial code review stance that eliminates confirmation bias — reviewer must find issues or re-analyze

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

Creates specialized AI agents on-demand when no existing agent matches a request. Use when the Router cannot find a suitable agent for a task. Enables self-evolution by generating persistent agents.

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

LLM-as-judge evaluation framework with 5-dimension rubric (accuracy, groundedness, coherence, completeness, helpfulness) for scoring AI-generated content quality with weighted composite scores and evidence citations

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio422026年7月14日 更新

查看 oimiragieo 的全部技能

报告此技能的问题