graphviz
28
总安装量
28
周安装量
#7380
全站排名
安装命令
npx skills add https://github.com/markdown-viewer/skills --skill graphviz
Agent 安装分布
github-copilot
26
opencode
26
gemini-cli
25
codex
25
amp
24
kimi-cli
24
Skill 文档
Graphviz DOT Diagram Generator
Important: Use
```dotas 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
| Issue | Solution |
|---|---|
| Nodes overlapping | Increase nodesep and ranksep |
| Poor layout | Change rankdir or add {rank=same} |
| Edges crossing | Use splines=ortho or adjust node order |
| Cluster not showing | Name must start with cluster_ |
| Label not displaying | Check 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