SKILL.md
Kroki Diagram API
Overview
Kroki provides a unified HTTP API to render 20+ text-based diagram formats into images (SVG, PNG, PDF). It supports Mermaid, PlantUML, Graphviz, D2, BPMN, and more — all through a single endpoint. Self-hostable or use the free public instance. No authentication required. Ideal for generating research figures, architecture diagrams, and flowcharts programmatically.
API Usage
GET Request (URL-encoded)
# Graphviz DOT diagram
curl "https://kroki.io/graphviz/svg/digraph{A->B->C}" -o diagram.svg
# Mermaid diagram (base64-encoded)
echo "graph TD; A-->B; B-->C;" | base64 | \
curl "https://kroki.io/mermaid/svg/$(cat -)" -o diagram.svg
POST Request (Recommended)
# PlantUML sequence diagram
curl -X POST "https://kroki.io/plantuml/svg" \
-H "Content-Type: text/plain" \
-d '@startuml
Alice -> Bob: Hello
Bob --> Alice: Hi!
@enduml' -o sequence.svg
# Mermaid flowchart
curl -X POST "https://kroki.io/mermaid/svg" \
-H "Content-Type: text/plain" \
-d 'graph TD
A[Data Collection] --> B[Preprocessing]
B --> C[Model Training]
C --> D[Evaluation]
D -->|Good| E[Deploy]
D -->|Bad| B' -o flowchart.svg
# Graphviz
curl -X POST "https://kroki.io/graphviz/svg" \
-H "Content-Type: text/plain" \
-d 'digraph {
rankdir=LR
"Raw Data" -> "Feature Extraction" -> "Model" -> "Prediction"
}' -o pipeline.svg
# D2 diagram
curl -X POST "https://kroki.io/d2/svg" \
-H "Content-Type: text/plain" \
-d 'Client -> API: Request
API -> Database: Query
Database -> API: Results
API -> Client: Response' -o d2.svg
URL Format
https://kroki.io/{diagram_type}/{output_format}/{encoded_source}
# Or POST to:
https://kroki.io/{diagram_type}/{output_format}
Supported Diagram Types
| Type | Keyword | Best for |
|---|---|---|
| Mermaid | mermaid |
