Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Generate diagrams from text via Kroki's multi-format rendering API
.claude/skills/brycewang-stanford-kroki-diagram-api/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | 83% | 0% |
| case-05 | ✗→✓ | ▲ Improved | -58% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 26% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 35% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 28% | 0% |
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.
bash# 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
bash# 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
https://kroki.io/{diagram_type}/{output_format}/{encoded_source}
# Or POST to:
https://kroki.io/{diagram_type}/{output_format}| Type | Keyword | Best for | |------|---------|----------| | Mermaid | mermaid | Flowcharts, sequences, Gantt | | PlantUML | plantuml | UML, sequences, class diagrams | | Graphviz | graphviz | Network graphs, DAGs | | D2 | d2 | Modern text-to-diagram | | Ditaa | ditaa | ASCII art diagrams | | BlockDiag | blockdiag | Block diagrams | | Nomnoml | nomnoml | UML-like diagrams | | WaveDrom | wavedrom | Digital timing diagrams | | Vega | vega | Data visualizations | | Vega-Lite | vegalite | Simplified data viz | | C4 PlantUML | c4plantuml | C4 architecture | | BPMN | bpmn | Business processes | | Bytefield | bytefield | Protocol/byte diagrams | | Excalidraw | excalidraw | Hand-drawn style |
| Format | Extension | Use case | |--------|-----------|----------| | SVG | /svg | Web, scalable | | PNG | /png | Documents, slides | | PDF | /pdf | Papers, print | | JPEG | /jpeg | Compatibility |
pythonimport requests import base64 import zlib KROKI_URL = "https://kroki.io" def render_diagram(source: str, diagram_type: str = "mermaid", output_format: str = "svg") -> bytes: """Render a text diagram to image via Kroki.""" resp = requests.post( f"{KROKI_URL}/{diagram_type}/{output_format}", headers={"Content-Type": "text/plain"}, data=source, ) resp.raise_for_status() return resp.content def save_diagram(source: str, output_path: str, diagram_type: str = "mermaid", output_format: str = "svg"): """Render and save a diagram to file.""" content = render_diagram(source, diagram_type, output_format) with open(output_path, "wb") as f: f.write(content) def render_research_pipeline(steps: list) -> bytes: """Create a research pipeline flowchart.""" nodes = [] for i, step in enumerate(steps): node_id = chr(65 + i) nodes.append(f" {node_id}[{step}]") if i > 0: prev_id = chr(65 + i - 1) nodes.append(f" {prev_id} --> {node_id}") mermaid = "graph TD\n" + "\n".join(nodes) return render_diagram(mermaid, "mermaid", "svg") # Example: create a research workflow diagram workflow = """graph TD A[Literature Review] --> B[Hypothesis] B --> C[Data Collection] C --> D[Statistical Analysis] D --> E{Significant?} E -->|Yes| F[Write Paper] E -->|No| G[Revise Hypothesis] G --> B F --> H[Peer Review]""" save_diagram(workflow, "research_workflow.svg", "mermaid") # Example: Graphviz citation network citation_graph = """digraph { rankdir=BT node [shape=box, style=rounded] "Vaswani 2017" -> "BERT 2018" "Vaswani 2017" -> "GPT 2018" "BERT 2018" -> "RoBERTa 2019" "GPT 2018" -> "GPT-2 2019" "GPT-2 2019" -> "GPT-3 2020" }""" save_diagram(citation_graph, "citations.svg", "graphviz") # Example: research pipeline helper pipeline_svg = render_research_pipeline([ "Raw Data", "Cleaning", "Feature Engineering", "Model Training", "Evaluation", "Deployment" ])
bash# Run Kroki locally via Docker docker run -d -p 8000:8000 yuzutech/kroki # Then use http://localhost:8000 instead of https://kroki.io
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | pass→pass | 40,566 | 33,760 | -17% | 1 | 1 | 0% | 1,604 | 2,403 | +50% | 0 | 0 | — |
case-02 | pass→pass | 39,935 | 4,532 | -89% | 1 | 1 | 0% | 1,417 | 2,308 | +63% | 0 | 0 | — |
case-03 | pass→pass | 8,651 | 2,813 | -67% | 1 | 1 | 0% | 1,261 | 2,304 | +83% | 0 | 0 | — |
case-04 | fail→pass | 9,234 | 3,871 | -58% | 1 | 1 | 0% | 1,319 | 2,410 | +83% | 0 | 0 | — |
case-05 | fail→pass | 25,642 | 2,948 | -89% | 1 | 1 | 0% | 5,290 | 2,226 | -58% | 0 | 0 | — |
case-06 | pass→pass | 15,343 | 39,855 | +160% | 1 | 1 | 0% | 2,676 | 2,918 | +9% | 0 | 0 | — |
case-07 | fail→pass | 10,959 | 5,131 | -53% | 1 | 1 | 0% | 2,232 | 2,815 | +26% | 0 | 0 | — |
case-08 | pass→pass | 10,377 | 6,402 | -38% | 1 | 1 | 0% | 2,098 | 3,004 | +43% | 0 | 0 | — |
case-09 | fail→pass | 12,905 | 7,648 | -41% | 1 | 1 | 0% | 2,531 | 3,411 | +35% | 0 | 0 | — |
case-10 | pass→pass | 4,839 | 1,932 | -60% | 1 | 1 | 0% | 612 | 1,947 | +218% | 0 | 0 | — |
case-11 | pass→pass | 4,363 | 2,475 | -43% | 1 | 1 | 0% | 702 | 2,080 | +196% | 0 | 0 | — |
case-12 | pass→pass | 6,240 | 2,941 | -53% | 1 | 1 | 0% | 1,029 | 2,065 | +101% | 0 | 0 | — |
case-13 | pass→pass | 7,858 | 3,880 | -51% | 1 | 1 | 0% | 1,221 | 2,200 | +80% | 0 | 0 | — |
case-14 | pass→pass | 4,187 | 1,766 | -58% | 1 | 1 | 0% | 566 | 2,000 | +253% | 0 | 0 | — |
case-15 | fail→pass | 9,931 | 2,814 | -72% | 1 | 1 | 0% | 1,661 | 2,119 | +28% | 0 | 0 | — |
case-16 | pass→pass | 6,781 | 4,430 | -35% | 1 | 1 | 0% | 913 | 2,311 | +153% | 0 | 0 | — |
case-17 | pass→pass | 2,907 | 2,732 | -6% | 1 | 1 | 0% | 382 | 2,099 | +449% | 0 | 0 | — |
case-18 | pass→pass | 5,066 | 2,228 | -56% | 1 | 1 | 0% | 820 | 2,085 | +154% | 0 | 0 | — |
case-19 | pass→pass | 6,529 | 2,535 | -61% | 1 | 1 | 0% | 852 | 2,158 | +153% | 0 | 0 | — |
case-20 | pass→pass | 2,924 | 2,464 | -16% | 1 | 1 | 0% | 515 | 2,121 | +312% | 0 | 0 | — |
case-21 | pass→pass | 13,546 | 12,897 | -5% | 1 | 1 | 0% | 2,589 | 4,200 | +62% | 0 | 0 | — |
case-22 | pass→pass | 6,560 | 5,742 | -12% | 1 | 1 | 0% | 1,312 | 2,911 | +122% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +23 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.