Install
openclaw skills install @samonysh/plantuml-skillTurn natural language into uml-diagrams.org style PlantUML diagrams (sequence, class, activity, use case, component, state…) and render to SVG/PNG/PDF. Use when the user asks to draw a UML diagram.
openclaw skills install @samonysh/plantuml-skillGenerate professional PlantUML diagrams from natural language descriptions. This skill handles the full pipeline: requirement analysis → PlantUML code generation → image rendering.
Use this skill when the user asks to:
ALL diagrams generated by this skill MUST adhere to the uml-diagrams.org reference style — strict OMG UML 2.x rendered with Visio UML 2.x stencils (black-and-white, no decoration). This is the canonical style used throughout https://www.uml-diagrams.org and serves as the authoritative visual reference for every diagram this skill produces. No exceptions unless the user explicitly requests otherwise.
#000000) on a pure white background (#FFFFFF). No colors, no grayscale fills, no gradients, no themed accents.skinparam classAttributeIconSize 0. Use + - # ~ text markers only.skinparam style strictuml (which degrades actors into plain text and use cases into rectangles — see Common Failure Patterns), we suppress the circle adornments purely at the syntax level: always declare interfaces / abstract classes / enumerations via a class <<interface>> / class <<abstract>> / class <<enumeration>> text stereotype — never use the interface / abstract class / enum keywords, which are what trigger the circle icons in the first place.<<abstract>> text stereotype combined with {abstract} method markers renders correctly without needing strictuml.skinparam shadowing false).--cjk flag to switch to a CJK-compatible font (see CJK Font Support).--no-fix to disable this behavior (see Step 3).scale N directive and re-renders up to once. The default body font of 12 px (from the mandatory preamble) shrinks proportionally; if the estimated on-paper font drops below --min-font-pt (default 8 pt), the script prints a legibility warning — at that point no further down-scaling helps and the user must split the diagram or abbreviate labels. A4 fit is ON by default; disable with --no-a4-check.X at the bottom of the lifeline (PlantUML <participant> ! syntax).«include» / «extend» as dashed open arrows.Every .puml file MUST include the mandatory uml-diagrams.org-style preamble as its first lines after @startuml (see Style Configuration).
Extract from the user's description:
If the diagram type is not explicitly stated, infer it from the description:
| Description signals | Recommended diagram |
|---|---|
| "A sends X to B", "request/response", "handshake" | Sequence |
| "inherits from", "has many", "belongs to", entities & fields | Class |
| "if/then", "approve/reject", workflow, pipeline | Activity |
| "user can", "admin manages", roles & permissions | Use Case |
| "depends on", "connects to", services & interfaces | Component |
| "deployed on", "hosted on", nodes & servers | Deployment |
| "transitions from", "changes state", lifecycle | State |
| timeline, milestones, phases, schedule | Gantt |
| hierarchy, brainstorming, tree structure | Mind Map |
If ambiguous, ask the user to clarify the diagram type before proceeding.
Write the PlantUML source following these rules:
@startuml:
skinparam preamble — see OMG-UML / uml-diagrams.org Style Configuration.
Maximum backward compatibility, used by every example except #07.
(Example #07 is a legacy alias of #01_css — same OAuth2 sequence diagram, same CSS preamble.)<style> preamble — see Alternative — CSS-style Preamble.
Recommended on PlantUML ≥ 1.2019.9 where skinparam is being phased out.
Pick ONE per file — never mix both inside the same .puml.@startuml / @enduml delimiterstitleSave the PlantUML source to a .puml file in the working directory.
Use the bundled conversion script. It is a single, unified Python 3.8+ script
that works identically on Linux, macOS, and Windows (native PowerShell, cmd,
Git Bash, WSL — anywhere python is on PATH):
python skills/plantuml/scripts/generate_plantuml.py <input.puml> <output_dir> --format <svg|png|pdf|txt>
On Windows PowerShell / cmd the invocation is identical (use backslashes if you prefer):
python skills\plantuml\scripts\generate_plantuml.py <input.puml> <output_dir> --format <svg|png|pdf|txt>
Historical note — earlier versions shipped a
generate-plantuml.sh/generate-plantuml.ps1pair. Those have been consolidated into this single Python script. All flags use the same--kebab-casenames on every OS; the previous PowerShell-style-CamelCaseflag names are no longer used.
The script tries three backends in strict priority order — local-first. Docker and the local JAR are tried first; the Kroki public server is OPT-IN ONLY because it uploads your diagram source to a third-party service (kroki.io by default):
plantuml/plantuml:latest) — preferred default, fully localplantuml.jar (requires Java) — offline fallback--use-public-server. Override the host with the
PLANTUML_PUBLIC_SERVER=<url> environment variable to point at a
self-hosted Kroki instance.⚠ Privacy notice — passing
--use-public-serverPOSTs the entire.pumlsource tokroki.io(or your override host). Never enable this flag for diagrams containing confidential architecture, credentials, customer data, or proprietary business logic. When in doubt, stay with the default (Docker / local JAR). See the Privacy & Backend Selection section below for the full data-flow contract.
CJK font support: When the .puml contains Chinese, Japanese, or Korean characters, add the --cjk flag:
python skills/plantuml/scripts/generate_plantuml.py diagram.puml ./output --format svg --cjk
The --cjk flag:
Helvetica with WenQuanYi Micro Hei (a CJK-compatible font)/usr/share/fonts, /usr/local/share/fonts) into the container and refreshes the font cache before renderingsudo apt install fonts-wqy-zenheisudo dnf install wqy-zenhei-fontsAspect ratio validation: After rendering (SVG or PNG), the script measures width/height and checks whether it sits inside the configured band. The default band is 0.7–1.4 (width/height), i.e. diagrams should be neither extremely tall nor extremely wide. If the output falls outside the band, the script injects layout corrections and re-renders:
--min-aspect): applies left to right direction and adds spacing guards so labels do not crowd.--max-aspect): applies top to bottom direction and adds spacing guards.Spacing guards added during auto-fix include Padding, BoxPadding, ParticipantPadding, MinClassWidth, WrapWidth, NodeSep, and RankSep. These prevent text from becoming cramped when the layout is re-directed.
To disable automatic correction:
python skills/plantuml/scripts/generate_plantuml.py diagram.puml ./output --no-fix
To set a custom band:
python skills/plantuml/scripts/generate_plantuml.py diagram.puml ./output --min-aspect 0.6 --max-aspect 1.5
Dark mode (opt-in): The default output follows the strict uml-diagrams.org black-and-white style. When the user explicitly asks for a dark variant, add --dark-mode. This emits both the regular light output and a dark companion named <basename>.dark.<fmt>:
python skills/plantuml/scripts/generate_plantuml.py diagram.puml ./output --format svg --dark-mode
Behaviour:
@media (prefers-color-scheme: dark) block into the SVG, which automatically adapts to the user's system theme.convert is available. PDF/TXT dark companions are not generated because there is no reliable local post-processor.#1e1e2e canvas, #c9d1d9 text/strokes, #f0f6fc bold text, and #6e7681 lifelines.fill="none" and no stroke attribute. The script injects CSS rules to add strokes to these elements in both light (#000000) and dark (#c9d1d9) variants.skinparam style strictuml is FORBIDDEN — despite past documentation claiming it was "essential", strictuml actively degrades key UML shapes: actors collapse into plain-text labels, use cases collapse from ellipses into rectangles, and classes lose their header separator. The correct fix is a complete per-element skinparam block (see OMG-UML Style Configuration) that explicitly sets BackgroundColor/BorderColor/FontColor for every element category. The render script also defensively strips any leftover skinparam style strictuml line before dispatching to the backend, so even if a diagram source accidentally re-introduces it, the rendering pipeline will remove it.A4 paper fit validation: After the aspect-ratio check passes, the render script validates the diagram's pixel dimensions against A4 paper. PlantUML writes SVG in CSS pixels at the 96 DPI standard, so A4 (210×297 mm = 8.27×11.69 in) maps to 794×1123 px portrait or 1123×794 px landscape. The check is ON by default and runs right after the aspect check.
Behaviour:
≤1.0 and a hard floor of 0.15, injects a scale N directive into a working copy of the .puml, then re-renders once.scale × 12 px × 0.75 ≈ pt (the 0.75 factor converts px to pt at 96 DPI). If this is below --min-font-pt it prints a legibility warning — at that point further down-scaling cannot help; the user must split the diagram, shorten labels, or switch to a smaller font.Flags:
| Flag | Purpose | Default |
|---|---|---|
--no-fix | Disable automatic aspect-ratio correction | off (correction ON) |
--min-aspect N | Lower bound of acceptable width/height band | 0.7 |
--max-aspect N | Upper bound of acceptable width/height band | 1.4 |
--no-a4-check | Disable A4 fit validation entirely | off (check ON) |
--min-font-pt N | Minimum legible on-paper font size in pt | 8.0 |
--dark-mode | Also emit a dark companion (<basename>.dark.<fmt>) with CSS @media theme | off |
Examples:
# Disable A4 fit
python skills/plantuml/scripts/generate_plantuml.py diagram.puml ./output --no-a4-check
# Tighten legibility threshold (warn if effective font drops below 10 pt)
python skills/plantuml/scripts/generate_plantuml.py diagram.puml ./output --min-font-pt 10
# Allow narrower diagrams and also emit a dark SVG companion
python skills/plantuml/scripts/generate_plantuml.py diagram.puml ./output --format svg --min-aspect 0.5 --dark-mode
On Windows the same commands work verbatim in PowerShell / cmd — just swap forward slashes for backslashes if you prefer native path style. There is no longer a separate PowerShell flag namespace.
A4 fit is skipped automatically for txt and pdf output (TXT has no image dimensions; PDF is already a print-oriented format the PlantUML renderer pages itself). The check shares the same 3-attempt auto-fix budget as aspect-ratio correction — running both does not double the cap.
After rendering, show the user the output. If SVG is generated, read and display it inline. If PNG/PDF is generated, tell the user where the file is saved.
This skill is local-first. By default, all rendering happens on the user's own machine — diagram source code never leaves the host.
.puml ──► Docker (plantuml/plantuml) ──► output.svg [LOCAL, preferred]
└────► local plantuml.jar (Java) ──► output.svg [LOCAL, fallback]
No network calls are made; nothing is uploaded.
The Kroki public server (https://kroki.io) can render diagrams without any
local installation, but doing so POSTs the full .puml source to a third
party. To use it you must explicitly opt in:
# Explicit opt-in required (same flag on every OS)
python skills/plantuml/scripts/generate_plantuml.py diagram.puml ./output --use-public-server
When opt-in is active, the script:
.puml contents to kroki.io (or your override host)Kroki is open source and self-hostable
(github.com/yuzutech/kroki). To route
opt-in traffic to your own instance instead of the public kroki.io, set the
PLANTUML_PUBLIC_SERVER env var to your base URL:
# Linux / macOS / Git Bash / WSL
PLANTUML_PUBLIC_SERVER=https://kroki.internal.example.com \
python skills/plantuml/scripts/generate_plantuml.py diagram.puml ./output --use-public-server
# Windows PowerShell
$env:PLANTUML_PUBLIC_SERVER = 'https://kroki.internal.example.com'
python skills\plantuml\scripts\generate_plantuml.py diagram.puml .\output --use-public-server
The runtime privacy warning surfaces the resolved host name so you can confirm
the traffic destination before any data leaves the machine. Custom hosts must
expose the standard Kroki endpoint shape <base>/plantuml/<format>.
Earlier versions of this script POSTed to
https://www.plantuml.com/plantuml/<format>. That endpoint now sits behind a
Cloudflare + Ezoic consent wall: a POST returns 302 redirecting to a
JavaScript-only HTML consent page, making non-browser automation impossible.
Kroki replaces it because:
--use-public-serverNever enable remote rendering for diagrams that contain any of the following:
If you are unsure whether the diagram is safe to upload, don't opt in —
install Docker (one command: docker pull plantuml/plantuml:latest) or
download plantuml.jar and render locally.
When --cjk is combined with the Docker backend, the script mounts
host font directories read-only into the container so PlantUML can
discover system-installed CJK fonts. The mounts are:
/usr/share/fonts, /usr/local/share/fonts, /System/Library/Fonts/c/Windows/Fonts or /mnt/c/Windows/Fonts%WINDIR%\FontsThese mounts are read-only (:ro), are scoped to font directories only, and
are used only inside the throwaway PlantUML container. No font data is
written back to the host. If you do not need CJK rendering, omit the flag
and no host directories are mounted.
If the user requests changes:
.puml fileNote: All examples below omit the mandatory monochrome preamble for brevity. In actual generated code, EVERY file MUST include the OMG-UML style preamble immediately after
@startuml. The class diagram example shows the full preamble inline as a reference.
@startuml
title Authentication Flow
actor User
participant "Web App" as App
participant "Auth Service" as Auth
database "User DB" as DB
User -> App: Login (email, password)
App -> Auth: POST /auth/login
Auth -> DB: SELECT user WHERE email
DB --> Auth: user record
Auth -> Auth: Verify password hash
alt Success
Auth --> App: JWT token
App --> User: Dashboard
else Failure
Auth --> App: 401 Unauthorized
App --> User: Error message
end
@enduml
Key syntax: -> sync message, --> async/return, ->> async, alt/else/end branching,
loop/end loops, opt/end optional, activate/deactivate lifeline, note left/right
@startuml
' OMG-UML Monochrome Style — CSS variant
<style>
root {
FontName Helvetica
FontSize 12
FontColor #000000
BackGroundColor #FFFFFF
LineColor #000000
LineThickness 0.75
RoundCorner 0
Shadowing 0
}
title {
FontSize 14
FontStyle bold
FontColor #000000
BackGroundColor transparent
LineColor transparent
LineThickness 0
}
note {
BackGroundColor #FFFFFF
LineColor #000000
FontColor #000000
}
classDiagram {
class { BackGroundColor #FFFFFF; LineColor #000000; FontColor #000000 }
arrow { LineColor #000000; LineThickness 0.75 }
}
</style>
skinparam classAttributeIconSize 0
title Payment System
class User {
+id: UUID
+email: String
+name: String
+register()
}
class Order {
+id: UUID
+total: Decimal
+status: OrderStatus
+calculateTotal()
}
class PaymentProcessor <<interface>> {
+processPayment(amount: Decimal): Boolean
+refund(transactionId: UUID): Boolean
}
class NotificationService <<abstract>> {
#enabled: Boolean
+{abstract} send(to: String, body: String)
}
enum OrderStatus {
PENDING
CONFIRMED
SHIPPED
DELIVERED
}
User "1" -- "*" Order : places
Order ..|> PaymentProcessor
NotificationService <|-- EmailNotifier
@enduml
Key syntax: + public, - private, # protected, {abstract} abstract method,
class Foo <<interface>> (interface via text stereotype — NOT interface Foo),
class Bar <<abstract>> (abstract class — NOT abstract class Bar),
enum, relationships: -- association, *-- composition, o-- aggregation,
<|-- inheritance, ..|> realization
@startuml
title Order Processing
start
:Receive Order;
if (Payment Valid?) then (yes)
:Reserve Inventory;
if (Inventory Available?) then (yes)
:Confirm Order;
:Ship Order;
stop
else (no)
:Notify Customer;
:Cancel Order;
stop
endif
else (no)
:Reject Order;
stop
endif
@enduml
Key syntax: start/stop/end, if/then/else/endif, repeat/repeat while,
fork/fork again/end fork (parallel), split/split again/end split,
partition "name" { ... } (swimlane), :Text; action
@startuml
title E-Commerce System
left to right direction
actor Customer
actor Admin
rectangle "E-Commerce" {
usecase "Browse Products" as UC1
usecase "Place Order" as UC2
usecase "Manage Inventory" as UC3
usecase "Process Returns" as UC4
}
Customer --> UC1
Customer --> UC2
Admin --> UC3
Admin --> UC4
UC2 ..> UC1 : <<include>>
@enduml
Key syntax: actor, usecase, rectangle/package for system boundary,
--> association, ..> dependency, <<include>> / <<extend>> stereotypes
@startuml
title Microservice Architecture
package "Frontend" {
[Web App]
[Mobile App]
}
package "API Gateway" {
[Gateway]
}
package "Services" {
[User Service]
[Order Service]
[Payment Service]
}
database "PostgreSQL" as DB
cloud "Message Queue" as MQ
[Web App] --> [Gateway]
[Mobile App] --> [Gateway]
[Gateway] --> [User Service]
[Gateway] --> [Order Service]
[Order Service] --> [Payment Service]
[User Service] --> DB
[Order Service] --> DB
[Order Service] --> MQ
@enduml
Key syntax: [Component], package "name" { }, database, cloud, node,
frame, interface, ()-- required interface, --() provided interface
@startuml
title Production Deployment
node "AWS us-east-1" {
node "VPC" {
node "Public Subnet" {
[Load Balancer]
[Bastion Host]
}
node "Private Subnet" {
node "App Server 1" {
[Application]
}
node "App Server 2" {
[Application]
}
database "RDS Primary"
}
}
cloud "CDN"
}
@enduml
Key syntax: node "name" { }, nested node, database, cloud, actor
@startuml
title Order Lifecycle
[*] --> Draft
Draft --> Submitted : submit()
Submitted --> Paid : processPayment()
Submitted --> Cancelled : cancel()
Paid --> Shipped : ship()
Shipped --> Delivered : confirmDelivery()
Delivered --> [*]
Cancelled --> [*]
state Paid {
[*] --> Authorizing
Authorizing --> Captured : success
Authorizing --> Failed : decline
Captured --> [*]
}
@enduml
Key syntax: [*] start/end, --> transition with optional : label,
state Name { } composite state, state "Name" as Alias
@startuml
title Project Roadmap
project starts 2025-01-06
[Design] lasts 10 days
[Development] lasts 20 days
[Development] starts at [Design]'s end
[Testing] lasts 10 days
[Testing] starts at [Development]'s end
[Deployment] lasts 3 days
[Deployment] starts at [Testing]'s end
[Frontend] lasts 12 days
[Frontend] starts at [Design]'s end
[Backend] lasts 15 days
[Backend] starts at [Design]'s end
@enduml
Key syntax: project starts YYYY-MM-DD, [Task] lasts N days,
[Task] starts at [Other]'s end, -- separator for dependency,
printscale weekly/monthly, @dailymail, @weeklymail
@startmindmap
title System Architecture
* Root Node
** Level 1 A
*** Level 2 A1
*** Level 2 A2
** Level 1 B
*** Level 2 B1
**** Level 3 B1a
**** Level 3 B1b
** Level 1 C
@endmindmap
Key syntax: * root, ** level 1, *** level 2, etc.
Use @startmindmap / @endmindmap (not @startuml).
Affix _ to markdown-style side notation, e.g., ***_ Right side node.
Colors: <style> * { BackgroundColor lightblue } </style>
Every generated .puml file MUST include this CSS-style preamble immediately after @startuml.
It locks PlantUML's rendering to the uml-diagrams.org reference style (strict OMG UML 2.x,
black-and-white Visio stencils).
Since PlantUML 1.2019.9 the project officially recommends the CSS-like <style> block
(plantuml.com/style-evolution) as the preferred
styling mechanism — "skinparam is being phased out … users should migrate to style".
Do NOT mix both inside the same .puml file. Pick one preamble per diagram.
<style> Preamble (recommended)@startuml
<style>
root {
FontName Helvetica
FontSize 12
FontColor #000000
BackGroundColor #FFFFFF
LineColor #000000
LineThickness 0.75
RoundCorner 0
Shadowing 0
}
title {
FontSize 14
FontStyle bold
FontColor #000000
BackGroundColor transparent
LineColor transparent
LineThickness 0
}
note {
BackGroundColor #FFFFFF
LineColor #000000
FontColor #000000
}
sequenceDiagram {
actor { BackGroundColor #FFFFFF; LineColor #000000; FontColor #000000 }
participant { BackGroundColor #FFFFFF; LineColor #000000; FontColor #000000 }
lifeLine { BackGroundColor #FFFFFF; LineColor #000000; LineStyle 5-5; LineThickness 0.75 }
reference { BackGroundColor #FFFFFF; LineColor #000000 }
group { BackGroundColor #FFFFFF; LineColor #000000 }
arrow { LineColor #000000; LineThickness 0.75; FontColor #000000 }
}
classDiagram {
class { BackGroundColor #FFFFFF; LineColor #000000; FontColor #000000 }
arrow { LineColor #000000; LineThickness 0.75 }
}
activityDiagram {
activity { BackGroundColor #FFFFFF; LineColor #000000; FontColor #000000; RoundCorner 10 }
arrow { LineColor #000000; LineThickness 0.75 }
diamond { BackGroundColor #FFFFFF; LineColor #000000 }
}
useCaseDiagram {
actor { BackGroundColor #FFFFFF; LineColor #000000 }
usecase { BackGroundColor #FFFFFF; LineColor #000000 }
rectangle { BackGroundColor #FFFFFF; LineColor #000000 }
}
componentDiagram {
component { BackGroundColor #FFFFFF; LineColor #000000 }
package { BackGroundColor #FFFFFF; LineColor #000000 }
}
stateDiagram {
state { BackGroundColor #FFFFFF; LineColor #000000; FontColor #000000 }
arrow { LineColor #000000 }
}
</style>
' ── Per-element skinparam fallback (mandatory) ─────────────────────────────
' The CSS <style> block above does NOT cover every PlantUML element category.
' Without the following block, some shapes fall back to PlantUML defaults
' (yellow activation bars, coloured actors, grey component fills, etc.).
' NEVER add `skinparam style strictuml` — it degrades actors into plain text
' and use cases into rectangles.
skinparam classAttributeIconSize 0
skinparam shadowing false
skinparam backgroundColor #FFFFFF
skinparam defaultFontColor #000000
skinparam actor { BackgroundColor #FFFFFF; BorderColor #000000; FontColor #000000 }
skinparam usecase { BackgroundColor #FFFFFF; BorderColor #000000; FontColor #000000 }
skinparam rectangle { BackgroundColor #FFFFFF; BorderColor #000000; FontColor #000000 }
skinparam class { BackgroundColor #FFFFFF; BorderColor #000000; FontColor #000000 }
skinparam object { BackgroundColor #FFFFFF; BorderColor #000000; FontColor #000000 }
skinparam component { BackgroundColor #FFFFFF; BorderColor #000000; FontColor #000000 }
skinparam interface { BackgroundColor #FFFFFF; BorderColor #000000; FontColor #000000 }
skinparam package { BackgroundColor #FFFFFF; BorderColor #000000; FontColor #000000 }
skinparam node { BackgroundColor #FFFFFF; BorderColor #000000; FontColor #000000 }
skinparam database { BackgroundColor #FFFFFF; BorderColor #000000; FontColor #000000 }
skinparam cloud { BackgroundColor #FFFFFF; BorderColor #000000; FontColor #000000 }
skinparam state { BackgroundColor #FFFFFF; BorderColor #000000; FontColor #000000 }
skinparam activity { BackgroundColor #FFFFFF; BorderColor #000000; FontColor #000000 }
skinparam sequence { ArrowColor #000000; LifeLineBorderColor #000000; LifeLineBackgroundColor #FFFFFF; ParticipantBackgroundColor #FFFFFF; ParticipantBorderColor #000000; ActorBackgroundColor #FFFFFF; ActorBorderColor #000000; BoxBackgroundColor #FFFFFF; BoxBorderColor #000000 }
skinparam note { BackgroundColor #FFFFFF; BorderColor #000000; FontColor #000000 }
What each CSS block does (mapped to uml-diagrams.org figures):
| CSS Block | Effect / uml-diagrams.org reference |
|---|---|
root | Global defaults: Helvetica 12px black-on-white, 0.75pt lines, no shadows, square corners. Matches Visio UML 2.x stencil look. |
root > Shadowing 0 | Disables drop shadows — uml-diagrams.org figures never have shadows. |
root > RoundCorner 0 | Square corners on rectangles (matches Visio stencils). activityDiagram.activity overrides to 10 for round-cornered actions. |
title | Bold 14px black text, transparent background/border. |
note | White fill, black border, black text — matches uml-diagrams.org note style. |
sequenceDiagram.lifeLine | Dashed black lines (LineStyle 5-5) — exactly the lifeline notation on uml-diagrams.org/sequence-diagrams.html. |
sequenceDiagram.arrow | Thin black arrows (0.75pt) — matches Visio stencil hair-line strokes. |
classDiagram.class | White fill, black border — no grey fills. |
activityDiagram.activity | White fill with round corners (RoundCorner 10) — matches uml-diagrams.org activity shape. |
activityDiagram.diamond | White fill, black border for decision/merge diamonds. |
useCaseDiagram | White actors, use cases, and rectangles — no colored fills. |
componentDiagram | White components and packages — no colored fills. |
stateDiagram.state | White fill, black border — no grey fills. |
STYLING POLICY — keep the FULL preamble, NEVER use strictuml
The CSS <style> block above tells PlantUML how to render CSS-aware elements
(sequence lifelines, class boxes, activity nodes, notes). It does NOT cover
every PlantUML element category — actor stick-figures, use case ellipses,
component silhouettes, database cylinders and cloud shapes still fall back to
PlantUML's built-in defaults (colored fills, yellow activation bars, missing
borders on white canvas) when only a <style> block is present.
The per-element skinparam block immediately after </style> is therefore
mandatory — treat CSS and skinparam as complementary layers, not
alternatives. Together they guarantee black borders + white fills for actor /
usecase / rectangle / class / component / interface / package / node / database
/ cloud / state / activity / sequence / note across every diagram type and both
light and dark backgrounds.
The only allowed skinparam ... style value is the default — do NOT add
skinparam style strictuml. Even though strictuml sounds like a "make it
more UML-compliant" flag, in practice it:
actor Foo from a stick figure into a plain text labelusecase "X" as UC from an ellipse into a plain rectangleThe render script also defensively strips any leftover
skinparam style strictuml line before dispatching to the backend, so
accidental re-introductions from user edits or LLM output are neutralized at
the pipeline level.
skinparam classAttributeIconSize 0 is retained separately because it only
removes the colored visibility dots (●/◐/○) and has no side effects on shapes.
Symptoms and their root cause — check this list first if a rendered diagram looks visually wrong:
| Symptom | Root cause | Fix |
|---|---|---|
| Actor rendered as bare text, no stick figure | skinparam style strictuml in the source | Remove the line; rely on the per-element skinparam fallback (the render script also auto-strips it). |
| Use case rendered as a plain rectangle instead of an ellipse | Same as above (strictuml) | Same as above. |
| Class header separator line missing / name+attributes merged | Same as above (strictuml) | Same as above. |
| Ellipses / actor paths lose their black border on light background | CSS <style> alone is used; the per-element skinparam actor/usecase block is missing | Restore the full preamble including the per-element skinparam fallback block. |
| Sequence activation bar rendered yellow instead of white | Missing skinparam sequence { ActorBackgroundColor #FFFFFF ... } | Restore the full preamble. |
Class attributes show ● / ◐ / ○ visibility icons | Missing skinparam classAttributeIconSize 0 | Add the line. |
Header header sub-elements show Ⓒ/Ⓘ/Ⓐ/Ⓔ circle icons | Diagram used interface Foo / abstract class Foo / enum Foo keywords | Rewrite as class Foo <<interface>> / class Foo <<abstract>> / class Foo <<enumeration>>. |
| Any decorative color / gradient / drop shadow appears | A !theme directive or extra skinparam ...Color overrides sneaked in | Remove them; the mandatory preamble is the single source of styling truth. |
skinparam Preamble (backward-compatible)Use this preamble only when you need maximum backward compatibility with PlantUML < 1.2019.9. Both preambles produce the same uml-diagrams.org reference look.
' uml-diagrams.org reference style — strict OMG UML 2.x, monochrome
skinparam monochrome true
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Helvetica
skinparam defaultFontSize 12
skinparam shadowing false
skinparam classAttributeIconSize 0
skinparam sequenceMessageAlign center
skinparam roundCorner 0
' Force every fill to white so monochrome never falls back to grey
skinparam ActorBackgroundColor #FFFFFF
skinparam ParticipantBackgroundColor #FFFFFF
skinparam NoteBackgroundColor #FFFFFF
skinparam SequenceGroupBackgroundColor #FFFFFF
skinparam PackageBackgroundColor #FFFFFF
skinparam ClassBackgroundColor #FFFFFF
skinparam ObjectBackgroundColor #FFFFFF
skinparam StateBackgroundColor #FFFFFF
skinparam UsecaseBackgroundColor #FFFFFF
skinparam ComponentBackgroundColor #FFFFFF
skinparam ActivityBackgroundColor #FFFFFF
skinparam NodeBackgroundColor #FFFFFF
skinparam DatabaseBackgroundColor #FFFFFF
skinparam StereotypeCBackgroundColor #FFFFFF
skinparam StereotypeIBackgroundColor #FFFFFF
skinparam StereotypeABackgroundColor #FFFFFF
skinparam StereotypeEBackgroundColor #FFFFFF
' Sequence diagrams — match the lifeline / activation look on uml-diagrams.org:
' * lifeline = dashed black vertical line
' * activation bar = thin WHITE rectangle with black border (NOT yellow)
skinparam SequenceLifeLineBorderColor #000000
skinparam SequenceLifeLineBackgroundColor #FFFFFF
skinparam SequenceLifeLineBorderThickness 0.75
skinparam SequenceActivationBackgroundColor #FFFFFF
skinparam SequenceActivationBorderColor #000000
skinparam SequenceArrowColor #000000
skinparam SequenceArrowThickness 0.75
skinparam SequenceBoxBackgroundColor #FFFFFF
' Default arrow / border colour everywhere
skinparam ArrowColor #000000
skinparam ArrowThickness 0.75
skinparam DefaultTextColor #000000
NEVER apply colored themes (!theme blueprint, !theme cerulean, etc.), custom colors,
gradients, shadows, or decorative styling — doing so breaks compliance with the
uml-diagrams.org reference style. If a user explicitly and unambiguously requests colour,
add it on top of this preamble rather than removing the preamble.
When diagrams contain CJK characters, Helvetica cannot render them — characters will appear as empty boxes (□) or tofu (▯).
In .puml files: Replace FontName Helvetica in the CSS <style> block with a CJK-compatible font:
root {
FontName "WenQuanYi Micro Hei"
}
For the skinparam preamble (backward-compatible):
skinparam defaultFontName "WenQuanYi Micro Hei"
When rendering: Use the --cjk flag, which automatically applies the font substitution and configures Docker font mounting if needed:
python skills/plantuml/scripts/generate_plantuml.py diagram.puml ./output --cjk
Host prerequisites for CJK rendering:
/usr/share/fonts (or /usr/local/share/fonts, /System/Library/Fonts). The script mounts these into the container.Common CJK font packages:
| OS | Package |
|---|---|
| Debian/Ubuntu | fonts-wqy-zenhei |
| Fedora/RHEL | wqy-zenhei-fonts |
| Arch | wqy-zenhei |
| Alpine | font-wqy-zenhei |
| macOS | Built-in (PingFang SC / Hiragino Sans) |
If the PlantUML server returns an error:
.puml file@startuml / @enduml are properly paired@startmindmap for mind maps)docker pull plantuml/plantuml:latest && python skills/plantuml/scripts/generate_plantuml.py ...If CJK characters render as empty boxes (□):
--cjk flag was passed when renderingfc-list :lang=zh--cjk)If aspect ratio warnings appear:
.puml:
top to bottom direction and reduce skinparam BoxPaddingleft to right direction and reduce skinparam ParticipantPaddingscale 0.75 or scale 0.5 for extreme casesIf A4 fit warnings appear (the script prints 📄 A4 fit: ... exceeds A4 ...):
scale N directive computed from the smaller required factor. Check the loop output for "A4 fit ✓" on the second render — if present, the diagram now fits within A4.--min-font-pt threshold (default 8 pt), further down-scaling will not make the diagram readable on print. To fix manually:
client_id, redirect_uri with shortened param names.--no-a4-check to keep the larger original.--min-font-pt 6 (or lower) and accept reduced legibility — the script will warn but still emit the smaller-than-A4 final image.After successful generation:
.puml and the rendered imagescale N factor and the post-fix dimensions), or skipped due to legibility threshold; if the legibility warning fired, surface it and propose splitting the diagram