mcpField
G
graphviz

graphviz

github.com/markdown-viewerDevelopment3.4k3.4k installsUpdated 3w ago
Repository

About graphviz

A skill for generating diagrams in Graphviz DOT syntax. It explains directed and undirected graphs, node and edge attributes, layout settings, clusters, and common syntax pitfalls.

Key features

  1. 01Directed and undirected graph syntax
  2. 02Node, edge, and cluster attributes
  3. 03Layout and spacing guidance
  4. 04Rules for valid DOT output

Use cases

  1. 01Mapping dependencies with directed edges
  2. 02Drawing undirected relationship diagrams
  3. 03Grouping diagram nodes into clusters

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/markdown-viewer/skills --skill graphviz

After installing, type/graphvizin Claude Code to confirm it loaded.

Bundled filesreferences/syntax.md

Details

From the project README

Graphviz DOT Diagram Generator

Important: Use ```dot as the code fence identifier, NOT ```graphviz.

Quick Start: Choose digraph (directed) or graph (undirected) → Define nodes with attributes (shape, color, label) → Connect with -> or -- → Set layout (rankdir, spacing) → Wrap in ```dot fence. Default: top-to-bottom (rankdir=TB), cluster names must start with cluster_, use semicolons.


Critical Syntax Rules

Rule 1: Cluster Naming
❌ subgraph backend { }      → Won't render as box
✅ subgraph cluster_backend { }  → Must start with cluster_
Rule 2: Node IDs with Spaces
❌ API Gateway [label="API"];    → Invalid ID
✅ "API Gateway" [label="API"];  → Quote the ID
✅ api_gateway [label="API Gateway"];  → Use underscore ID
Rule 3: Edge Syntax Difference
digraph: A -> B;   → Directed arrow
graph:   A -- B;   → Undirected line
Rule 4: Attribute Syntax
❌ node [shape=box color=red]    → Missing comma
✅ node [shape=box, color=red];  → Comma separated
Rule 5: HTML Labels
✅ shape=plaintext for HTML labels
✅ Use < > not " " for HTML content

Common Pitfalls

IssueSolution
Nodes overlappingIncrease nodesep and ranksep
Poor layoutChange rankdir or add {rank=same}
Edges crossingUse splines=ortho or adjust node order
Cluster not showingName must start with cluster_
Label not displayingCheck quote escaping

Output Format

```dot
digraph G {
    [diagram code]
}
```

Related Files

For advanced layout control and complex styling, refer to references below:

  • syntax.md — Layout control (rankdir, splines, rank), HTML labels, edge styles, cluster subgraphs, and record-based nodes

Comments

Markdown supported