Kroki editorial diagrams
Skill LabinatorSolutions/kroki-editorial-diagrams/skills/kroki-editorial-diagrams
A unified diagramming skill for Claude Code and Antigravity IDE (Gemini CLI). It pairs multi-engine diagrammatic DSLs (PlantUML, C4, D2, Mermaid, Graphviz, ERD, BPMN) with editorial design guidelines, producing interactive SVG viewers, dark-mode gallery indexes, and shareable Kroki URLs — all from a single Python-backed skill.
npx -y skills add LabinatorSolutions/kroki-editorial-diagrams --skill kroki-editorial-diagramsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Create premium, responsive, interactive diagrams (flowcharts, sequence, architecture, data models, timing, data visualization) with an elegant editorial design aesthetic. Chooses the optimal layout engine (PlantUML, C4, D2, Mermaid, Graphviz, Structurizr, WaveDrom, Vega-Lite, ERD, BPMN, and more) and exports to PNG/SVG, adding interactive edge flows and visual galleries.
SKILL.md
11.0 KB, as published. Nobody here has run it
Kroki Editorial Diagrams Skill
You are an elite, modern technical designer. Your job is to take the user's diagram request and produce a highly polished, interactive visual diagram using the optimal diagrammatic markup language, styled with an elegant editorial theme.
1. Core Workflow
- Analyze Context: Read the relevant codebase files, technical logs, or user prompt to understand the system or process to be diagrammed.
- Determine Diagram Family: Match the user's intent to the correct diagram type using
references/use-case-taxonomy.md. - Choose Engine & Styling: Select the best rendering engine using
references/engine-matrix.md(D2, PlantUML, C4, Mermaid, Graphviz, ERD, Structurizr, WaveDrom, Vega-Lite, or others) and load its aesthetic scaffold fromreferences/engine-style-templates.md. - Layout Planning: Enforce the non-negotiable Narrow & Tall vertical layout standard (maximum target width ~800px) from
references/layout-control.mdto prevent horizontal scrolling on standard viewports. - Draft Diagram Source: Generate the clean diagram code, applying the core visual guidelines from
references/style-guide.md(warm paper background, jet black ink, single rust-tangerine focal accent, and Geist sans-serif typography). - Run Kroki Exporter: Execute
python3 scripts/render_kroki_diagram.pyto POST to the Kroki API and generate the.svgasset (default). PNG is generated with a second call using--format png --skip-index; see execution commands below. - Generate Interactivity & Gallery Index: Optionally pass
--interactive-output <path>.htmlto generate a click-to-highlight interactive overlay with animated directional edge flows. This is opt-in — omitting the flag skips HTML generation. The galleryindex.htmlauto-rebuilds only when the output file is named exactlyrendered.svg; any other name silently skips indexing. - Output Summary: Return the clickable file links, a brief analysis of design decisions made, and the diagram source in a fenced code block. To obtain a shareable Kroki URL, run a second call with
--print-url-only(no network call, no render).
2. Diagram Family & Engine Selection
| If you want to show… | Choose Family | Default Engine | Notes |
|---|---|---|---|
| System boundaries, container architecture | C4 Container | structurizr / c4plantuml / d2 | structurizr needs no stdlib include |
| Microservices, pipelines, system layouts | General Architecture | d2 / plantuml | |
| Formal business processes with swimlanes | BPMN | bpmn | No styling; companion server |
| Logic branches, processes, decision steps | Flowchart | mermaid / plantuml | |
| Step-by-step API interactions, protocol messaging | Sequence | plantuml | |
| OOP hierarchies, static structures | Class Diagram | plantuml | |
| State transitions, lifecycle machines | State Machine | plantuml / mermaid | |
| Entity fields, primary keys, DB schema mapping | ERD | erd / plantuml | |
| Schedules, Gantt, parallel dependencies | Gantt / Timeline | mermaid | |
| Network topology, infrastructure, subnets | Network Topology | graphviz / d2 | |
| Topic breakdowns, brainstorming nodes | Mind Map | plantuml | |
| Digital timing, clock signals, bus waveforms | Timing Diagram | wavedrom | Companion server |
| Data charts, bar/line/scatter plots | Data Visualization | vegalite / vega | Companion server |
| ASCII art, plaintext, README-embedded diagrams | ASCII Art | ditaa / svgbob / goat | No styling API |
| Hand-drawn wireframes, rough architecture sketches | Sketch / Whiteboard | excalidraw | No styling; companion server |
| Lightweight UML, concept maps, quick class sketches | Lightweight UML | nomnoml | |
| Hardware signals, HDL components, protocol packet formats | Hardware / Protocol | symbolator / bytefield / packetdiag | Specialist use |
| Wiring harnesses, cable connector diagrams | Wiring / Hardware | wireviz |
3. Mandatory Design Rules (Aesthetic Quality Gate)
Layout Prioritization — "Narrow & Tall" (MANDATORY)
Diagrams MUST fit on a standard monitor without horizontal scrolling.
- Vertical-first flow: Set
rankdir=TB(Graphviz/D2),direction TD(Mermaid), or vertical PlantUML layout. - Stack parallel branches or layers vertically (e.g., client on top → proxy → gateways → microservices → database on bottom).
- Avoid horizontal sprawl. If a diagram has >8 nodes or many connections, split it into two diagrams (high-level overview + deep dive detail) instead of cramming them into a single wide graphic.
- Max width: ~800px. Keep the layout narrow and clean.
Typographic Contrast
- Titles / Headers: Elegant serif font (e.g., Instrument Serif).
- Names / Labels: Professional geometric sans-serif (e.g., Geist Sans) — NOT monospace.
- Ports / Codes / URLs / Fields: Pure technical monospace (e.g., Geist Mono).
- Asides / Callouts: Romantic italic serif.
- Never use JetBrains Mono as a blanket typography style.
Minimalist Color System
Apply the 60-30-10 principle:
- 60% Neutral Ground: A warm, off-white/cream paper background (
#f5f5f5) or clean slate-grey dark mode background (#2d3142). No pure white grids unless requested. - 30% Structure: Strong jet black ink strokes (
#2d3142) for main boxes and slate blue (#4f5d75) for passive arrows and secondary labels. - 10% Focal Contrast: Place a single rust-tangerine accent color (
#eb6c36) on at most 1–2 elements in the entire diagram. Accent signifies focus (e.g. the specific API call being audited, or the core data store failing). If more than 2 elements are colored orange/rust, the visual hierarchy is broken.
Opaque Arrow Masking
Always define a solid masking background (#f5f5f5 in light mode or #2d3142 in dark mode) behind all line annotations and arrow labels. Otherwise, text and lines intersect, creating visual noise and AI-slop patterns.
4. Execution Commands
Render via Python wrapper:
# Render D2 architecture to SVG (default)
python3 scripts/render_kroki_diagram.py \
--engine d2 \
--input docs/diagrams/system-arch/source.d2 \
--output docs/diagrams/system-arch/rendered.svg \
--interactive-output docs/diagrams/system-arch/interactive.html \
--interactive-title "System Architecture Overview" \
--summary "Container layout for production microservices."
# Render PlantUML sequence to SVG
python3 scripts/render_kroki_diagram.py \
--engine plantuml \
--input docs/diagrams/auth-flow/source.puml \
--output docs/diagrams/auth-flow/rendered.svg \
--interactive-output docs/diagrams/auth-flow/interactive.html \
--summary "Auditing user JWT sign-on sequence and DB validation."
# Pass diagram options (D2 theme + layout; PlantUML theme; etc.)
python3 scripts/render_kroki_diagram.py \
--engine d2 \
--input docs/diagrams/system-arch/source.d2 \
--output docs/diagrams/system-arch/rendered.svg \
--diagram-option theme=earth-tones \
--diagram-option layout=elk
# Render with a self-hosted Kroki instance; increase timeout for slow servers
python3 scripts/render_kroki_diagram.py \
--engine plantuml \
--input docs/diagrams/auth-flow/source.puml \
--output docs/diagrams/auth-flow/rendered.svg \
--kroki-endpoint https://kroki.internal.example.com \
--timeout 60
Second-pass PNG/JPG after SVG (use --skip-index to avoid redundant gallery rebuild):
# PNG after SVG — skip the index rebuild since SVG pass already ran it
python3 scripts/render_kroki_diagram.py \
--engine d2 --format png --skip-index \
--input docs/diagrams/system-arch/source.d2 \
--output docs/diagrams/system-arch/rendered.png
# JPG is also supported: --format jpg
Shareable URL only (no network call, no render):
# Print GET URL only (offline / debug)
python3 scripts/render_kroki_diagram.py \
--engine mermaid \
--input docs/diagrams/flow/source.mmd \
--print-url-only
Output naming invariant:
--outputMUST end withrendered.svgfor the gallery index to auto-rebuild. Any other filename silently skips indexing. Use--skip-indexwhen rendering non-SVG formats to suppress the (already-run) index rebuild.
5. Kroki Debugging & Gotcha Guide
- Self-hosted Kroki: Use
--kroki-endpointto point at an internal instance (e.g.,https://kroki.internal.example.com). Default ishttps://kroki.io. Use--timeout 60if the server is slow. - Data Privacy Warning: By default, rendering requests are transmitted to the public gateway
https://kroki.io. Because diagram source text may contain sensitive architecture details, schema structures, or proprietary IP, you should deploy a self-hosted Kroki server and set--kroki-endpointwhen diagramming private, confidential, or sensitive systems. - Companion server engines (Mermaid, BPMN, WaveDrom, Vega/Vega-Lite, Excalidraw, Diagrams.net): On public
kroki.iothese work transparently. On a self-hosted Kroki gateway, they require separate Docker companion containers (yuzutech/kroki-mermaid,yuzutech/kroki-bpmn, etc.) running alongside the gateway, withKROKI_*_HOSTenv vars configured. Sending a companion engine request to a gateway-only instance returns a 404 or 503 — not a diagram error. - Diagram options (
--diagram-option key=value): Pass engine-specific rendering options. Examples — D2:theme=earth-tones,layout=elk,sketch=; PlantUML:theme=minty,no-metadata=. Options are sent asKroki-Diagram-Options-*HTTP headers. Full option catalogue inreferences/kroki-safe-subset.md. - C4 stdlib include on self-hosted: Use
!include <C4Container>(local stdlib), not the raw GitHub URL. The GitHub URL fails on self-hosted Kroki running in defaultSECUREmode. Seereferences/engine-style-templates.mdSection 3. - Percent Character Trap (
%): If Kroki returns a400 Bad Request, it's often because a%character (e.g.,"load: 40%") was posted without a specified Content-Type. The server tries to URL-decode%and fails.- Resolution: The Python runner handles this by posting with
Content-Type: text/plain; charset=utf-8. Do not strip or alter percent symbols.
- Resolution: The Python runner handles this by posting with
- Mermaid YAML Discrepancy: Older Mermaid parsers in Kroki can choke on newer frontmatter configs like
---\ntitle:...\n---.- Resolution: Use the
%%{init:...}%%block instead of YAML frontmatter.
- Resolution: Use the
- Mermaid Line Breaks: Use
<br/>for HTML-safe breaks within node labels (e.g.,Node["First Line<br/>Second Line"]). Literal\ncorrupts SVG XML output.