
Grepai Trace Graph
- 686 installs
- 18 repo stars
- Updated February 1, 2026
- yoanbernabeu/grepai-skills
grepai-trace-graph is a Claude Code skill that runs `grepai trace graph` to build complete recursive call graphs and dependency trees for any function or method so developers can map impact before refactoring.
About
grepai-trace-graph is a developer skill for the GrepAI CLI that generates recursive call graphs and dependency trees from any entry function or method. It documents the `grepai trace graph` command, which walks callees recursively and renders a tree such as main → initialize → loadConfig → parseYAML for architecture and flow visualization. Developers reach for grepai-trace-graph when mapping complete function dependencies, understanding complex control flow, or scoping impact analysis before major refactors. The skill pairs with other grepai-skills for search and trace workflows and assumes grepai is installed in the environment.
- Builds complete recursive dependency trees showing full call chains
- Supports configurable depth control with --depth flag (1 to 5+ levels)
- Visualizes application architecture and complex code flows
- Enables precise impact analysis before major refactoring
- Outputs structured graphs with node counts and max depth metrics
Grepai Trace Graph by the numbers
- 686 all-time installs (skills.sh)
- +6 installs in the week ending Jul 28, 2026 (Skillselion tracking)
- Ranked #64 of 596 Debugging skills by installs in the Skillselion catalog
- Security screen: MEDIUM risk (skills.sh audit)
- Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/yoanbernabeu/grepai-skills --skill grepai-trace-graphAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 686 |
|---|---|
| repo stars | ★ 18 |
| Security audit | 3 / 3 scanners passed |
| Last updated | February 1, 2026 |
| Repository | yoanbernabeu/grepai-skills ↗ |
How do you map recursive function call dependencies?
Instantly generate complete recursive call graphs and dependency trees for any function or method.
Who is it for?
Backend and full-stack developers tracing call chains in large codebases before refactors or architecture reviews.
Skip if: Developers who only need flat text search without call relationships or who lack the grepai CLI installed.
When should I use this skill?
A developer asks to map function dependencies, visualize call flow, trace callees recursively, or assess refactor blast radius with grepai.
What you get
Recursive ASCII call graph, dependency tree output, and identified callee chain for a chosen function or method.
- recursive call graph tree
- dependency map for entry function
By the numbers
- Builds recursive dependency trees covering all callees from a single entry function
Files
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:
main
├── initialize
│ ├── loadConfig
│ │ └── parseYAML
│ └── connectDB
│ ├── createPool
│ └── ping
├── startServer
│ ├── registerRoutes
│ │ ├── authMiddleware
│ │ └── loggingMiddleware
│ └── listen
└── gracefulShutdown
└── closeDBBasic Usage
grepai trace graph "FunctionName"Example
grepai trace graph "main"Output:
🔍 Call Graph for "main"
main
├── initialize
│ ├── loadConfig
│ └── connectDB
├── startServer
│ ├── registerRoutes
│ └── listen
└── gracefulShutdown
└── closeDB
Nodes: 9
Max depth: 3Depth Control
Limit recursion depth with --depth:
# Default depth (2 levels)
grepai trace graph "main"
# Deeper analysis (3 levels)
grepai trace graph "main" --depth 3
# Shallow (1 level, same as callees)
grepai trace graph "main" --depth 1
# Very deep (5 levels)
grepai trace graph "main" --depth 5Depth Examples
--depth 1 (same as callees):
main
├── initialize
├── startServer
└── gracefulShutdown--depth 2 (default):
main
├── initialize
│ ├── loadConfig
│ └── connectDB
├── startServer
│ ├── registerRoutes
│ └── listen
└── gracefulShutdown
└── closeDB--depth 3:
main
├── initialize
│ ├── loadConfig
│ │ └── parseYAML
│ └── connectDB
│ ├── createPool
│ └── ping
├── startServer
│ ├── registerRoutes
│ │ ├── authMiddleware
│ │ └── loggingMiddleware
│ └── listen
└── gracefulShutdown
└── closeDBJSON Output
grepai trace graph "main" --depth 2 --jsonOutput:
{
"query": "main",
"mode": "graph",
"depth": 2,
"root": {
"name": "main",
"file": "cmd/main.go",
"line": 10,
"children": [
{
"name": "initialize",
"file": "cmd/main.go",
"line": 15,
"children": [
{
"name": "loadConfig",
"file": "config/config.go",
"line": 20,
"children": []
},
{
"name": "connectDB",
"file": "db/db.go",
"line": 30,
"children": []
}
]
},
{
"name": "startServer",
"file": "server/server.go",
"line": 25,
"children": [
{
"name": "registerRoutes",
"file": "server/routes.go",
"line": 10,
"children": []
}
]
}
]
},
"stats": {
"nodes": 6,
"max_depth": 2
}
}Compact JSON
grepai trace graph "main" --depth 2 --json --compactOutput:
{
"q": "main",
"d": 2,
"r": {
"n": "main",
"c": [
{"n": "initialize", "c": [{"n": "loadConfig"}, {"n": "connectDB"}]},
{"n": "startServer", "c": [{"n": "registerRoutes"}]}
]
},
"s": {"nodes": 6, "depth": 2}
}TOON Output (v0.26.0+)
TOON format offers ~50% fewer tokens than JSON:
grepai trace graph "main" --depth 2 --toonNote:--jsonand--toonare mutually exclusive.
Extraction Modes
# Fast mode (regex-based)
grepai trace graph "main" --mode fast
# Precise mode (tree-sitter AST)
grepai trace graph "main" --mode preciseUse Cases
Understanding Application Flow
# Map entire application startup
grepai trace graph "main" --depth 4Impact Analysis
# What depends on this utility function?
grepai trace graph "validateInput" --depth 3
# Full impact of changing database layer
grepai trace graph "executeQuery" --depth 2Code Review
# Is this function too complex?
grepai trace graph "processOrder" --depth 5
# Many nodes = high complexityDocumentation
# Generate architecture diagram data
grepai trace graph "main" --depth 3 --json > architecture.jsonRefactoring Planning
# What would break if we change this?
grepai trace graph "legacyAuth" --depth 3Handling Cycles
GrepAI detects and marks circular dependencies:
main
├── processA
│ └── processB
│ └── processA [CYCLE]In JSON:
{
"name": "processA",
"cycle": true
}Large Graphs
For very large codebases, graphs can be overwhelming:
Limit Depth
# Start shallow
grepai trace graph "main" --depth 2Focus on Specific Areas
# Instead of main, trace specific subsystem
grepai trace graph "authMiddleware" --depth 3Filter in Post-Processing
# Get JSON and filter
grepai trace graph "main" --depth 3 --json | jq '...'Visualizing Graphs
Export to DOT Format (Graphviz)
# Convert JSON to DOT
grepai trace graph "main" --depth 3 --json | python3 << 'EOF'
import json
import sys
data = json.load(sys.stdin)
print("digraph G {")
print(" rankdir=TB;")
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("}")
EOFThen render:
dot -Tpng graph.dot -o graph.pngMermaid Diagram
grepai trace graph "main" --depth 2 --json | python3 << 'EOF'
import json
import sys
data = json.load(sys.stdin)
print("```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("```")
EOFComparing Graph Sizes
Track complexity over time:
# Get node count
grepai trace graph "main" --depth 3 --json | jq '.stats.nodes'
# Compare before/after refactoring
echo "Before: $(grepai trace graph 'main' --depth 3 --json | jq '.stats.nodes') nodes"
# ... refactoring ...
echo "After: $(grepai trace graph 'main' --depth 3 --json | jq '.stats.nodes') nodes"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:
🔍 Call Graph for "main"
Depth: 3
Mode: fast
main
├── initialize
│ ├── loadConfig
│ │ └── parseYAML
│ └── connectDB
│ ├── createPool
│ └── ping
├── startServer
│ ├── registerRoutes
│ │ ├── authMiddleware
│ │ └── loggingMiddleware
│ └── listen
└── gracefulShutdown
└── closeDB
Statistics:
- Total nodes: 12
- Maximum depth reached: 3
- Cycles detected: 0
Tip: Use --json for machine-readable output
Use --depth N to control recursion depthRelated skills
How it compares
Choose grepai-trace-graph when recursive callee trees matter more than one-hop reference lists from plain text search.
FAQ
What does grepai trace graph output?
grepai trace graph outputs a recursive ASCII dependency tree listing every callee reachable from a chosen function or method. The tree uses indented branches so developers can follow nested paths like initialize → loadConfig → parseYAML during impact analysis.
When should developers use grepai-trace-graph?
grepai-trace-graph fits mapping complete function dependencies, understanding complex code flows, and scoping major refactors. The skill wraps the GrepAI CLI trace graph command for agent-driven recursive dependency analysis.
Is Grepai Trace Graph safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.