grepai-trace-graph
Build complete call graphs with GrepAI trace. Use this skill for recursive dependency analysis.
By yoanbernabeu · 730 installs
npx skills add yoanbernabeu/grepai-skills --skill grepai-trace-graph
Source repository · Upstream listing
GrepAI Trace Graph
This skill covers using grepai trace graph to build complete call graphs showing all dependencies recursively.
When to Use This Skill
Mapping complete function dependencies
Understanding complex code flows
Impact analysis for major refactoring
Visualizing application architecture
What is Trace Graph?
grepai trace graph builds a recursive dependency tree:
Basic Usage
Example
Output:
Depth Control
Limit recursion depth with depth :
Depth Examples
depth 1 (same as callees):
depth 2 (default):
depth 3 :
JSON Output
Output:
Compact JSON
Output:
TOON Output (v0.26.0+)
TOON format offers ~50% fewer tokens than JSON:
Note: json and toon are mutually exclusive.
Extraction Modes
Use Cases
Understanding Application Flow
Impact Analysis
Code Review
Documentation
Refactoring Planning
Handling Cycles
GrepAI detects and marks circular dependencies:
In JSON:
Large Graphs
For very large codebases, graphs can be overwhelming:
Limit Depth
Focus on Specific Areas
Filter in Post Processing
Visualizing Graphs
Export to DOT Format (Graphviz)
Then render:
Mermaid Diagram
mermaid")
print("graph TD")
def traverse(node, parent=None):
name = node.get('name') or node.get('n')
if parent:
print(f" {parent} {name}")
children = node.get('children') or node.get('c') or []
for child in children:
traverse(child, name)
traverse(data.get('root') or data.get('r'))
print("
Comparing Graph Sizes
Track complexity over time:
Common Issues
❌ Problem: Graph too large / timeout
✅ Solutions:
Reduce depth: depth 2
Trace specific function instead of main
Use mode fast
❌ Problem: Many cycles detected
✅ Solution: This indicates circular dependencies in code. Consider refactoring.
❌ Problem: Missing branches
✅ Solutions:
Try mode precise
Check if files are indexed
Verify language is enabled
Best Practices
1. Start shallow: Begin with depth 2 , increase as needed
2. Focus analysis: Trace specific functions, not always main
3. Export for docs: Use JSON for generating diagrams
4. Track over time: Monitor node count as complexity metric
5. Investigate cycles: Circular dependencies are code smells
Output Format
Trace graph result: