Loading...
Loading...
Generates Mermaid diagrams from Trailmark code graphs. Produces call graphs, class hierarchies, module dependency maps, containment diagrams, complexity heatmaps, and attack surface data flow visualizations. Use when visualizing code architecture, drawing call graphs, generating class diagrams, creating dependency maps, producing complexity heatmaps, or visualizing data flow and attack surface paths as Mermaid diagrams.
npx skill4agent add trailofbits/skills diagramming-codetrailmarkgenotoxicuv run trailmarkuv pip install trailmarkuv run {baseDir}/scripts/diagram.py \
--target {targetDir} --type call-graph \
--focus main --depth 2```mermaid
flowchart TB
...
```├─ "Who calls what?" → --type call-graph
├─ "Class inheritance?" → --type class-hierarchy
├─ "Module dependencies?" → --type module-deps
├─ "Class members and structure?" → --type containment
├─ "Where is complexity highest?" → --type complexity
└─ "Path from input to function?" → --type data-flowDiagram Progress:
- [ ] Step 1: Verify trailmark is installed
- [ ] Step 2: Identify diagram type from user request
- [ ] Step 3: Determine focus node and parameters
- [ ] Step 4: Run diagram.py script
- [ ] Step 5: Verify output is non-empty and well-formed
- [ ] Step 6: Embed diagram in responseuv run trailmark analyze --summary {targetDir}from trailmark.query.api import QueryEngine
engine = QueryEngine.from_directory("{targetDir}", language="{lang}")
engine.preanalysis()data-flow--typecall-graphdata-flow--depth 2--direction LRflowchartclassDiagram```mermaid ```uv run {baseDir}/scripts/diagram.py [OPTIONS]| Argument | Short | Default | Description |
|---|---|---|---|
| | required | Directory to analyze |
| | | Source language |
| | required | Diagram type (see above) |
| | none | Center diagram on this node |
| | | BFS traversal depth |
| | Layout: | |
| | Min complexity for |
# Call graph centered on a function
uv run {baseDir}/scripts/diagram.py -t src/ -T call-graph -f parse_file
# Class hierarchy for a Rust project
uv run {baseDir}/scripts/diagram.py -t src/ -l rust -T class-hierarchy
# Module dependency map, left-to-right
uv run {baseDir}/scripts/diagram.py -t src/ -T module-deps --direction LR
# Class members
uv run {baseDir}/scripts/diagram.py -t src/ -T containment
# Complexity heatmap (threshold 5)
uv run {baseDir}/scripts/diagram.py -t src/ -T complexity --threshold 5
# Data flow from entrypoints to a specific function
uv run {baseDir}/scripts/diagram.py -t src/ -T data-flow -f execute_queryTBLR--depth--focuscall-graphdata-flow