mcpField
P
puml-plantuml

puml-plantuml

github.com/kaerezDevelopment0161 installsUpdated 21w ago
Repository

About puml-plantuml

A skill for creating and maintaining PlantUML diagrams, covering syntax guidance, code generation, diagnosis, and local rendering. It also supports reconstructing PUML from images and provides cross-platform setup and rendering scripts.

Key features

  1. 01Syntax reference for many diagram types
  2. 02Generates PUML from descriptions
  3. 03Reconstructs PUML from images
  4. 04Checks and fixes PUML errors
  5. 05Renders PNG, SVG, and PDF locally
  6. 06Detects or installs rendering dependencies

Use cases

  1. 01Create architecture or flow diagrams from text
  2. 02Convert a diagram screenshot into PUML
  3. 03Check syntax and render an image or PDF locally

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/kaerez/skills-plugins --skill puml-plantuml

After installing, type/puml-plantumlin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

LICENSE
puml-plantuml.skill
README.md
references/
image-to-puml.md
local-rendering.md
syntax-quick-ref.md
scripts/
bootstrap.ps1
bootstrap.sh
render.py
setup.py

Details

From the project README

PUML-PlantUML Expert Skill

Deep PlantUML knowledge (all 27 chapters from official reference) + cross-platform local rendering + image→PUML reverse engineering. Offline rendering. Any OS. No assumed paths. Full Python + Java + PlantUML auto-detection and installation.


Quick Decision Tree

User request
├── "Create/draw a diagram from description"   → § Generate PUML
├── "Convert image/screenshot to PUML"         → § Image → PUML
├── "Render/preview/generate image from code"  → § Render Locally
├── "Fix/debug my PUML"                        → § Diagnose & Fix
└── "Explain syntax / how do I..."             → references/syntax-quick-ref.md

§ First Run — Bootstrap from Zero

The bootstrap scripts require no pre-installed tools — they install Python → Java → PlantUML in the correct order. Run once per machine.

macOS / Linux
bash scripts/bootstrap.sh           # install everything
bash scripts/bootstrap.sh --verify  # install + test render
Windows (PowerShell — built into Windows 10/11)
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\scripts\bootstrap.ps1
.\scripts\bootstrap.ps1 -Verify
If Python is already available
python3 scripts/render.py --detect      # show what's detected
python3 scripts/setup.py               # install Java + PlantUML
python3 scripts/setup.py --java        # ensure Java only
python3 scripts/setup.py --jar         # force JAR download
python3 scripts/setup.py --verify      # install + test render
python3 scripts/render.py --install-hint  # show manual steps

What gets installed:

ComponentmacOSLinuxWindows
Python 3.9+brewapt/dnf/pacman/snapwinget/choco/scoop
Java JRE 11+brew cask temurinapt/dnf/pacmanwinget Temurin/Zulu
PlantUMLbrewapt/dnf/pacman/snapwinget/choco/scoop
Fallback—~/.plantuml/plantuml.jar~/.plantuml/plantuml.jar

Java detected from: $JAVA_HOME, PATH, macOS /usr/libexec/java_home, Azul/Zulu (zulu*), Temurin, Homebrew OpenJDK, SDKMAN, /usr/lib/jvm/*.


§ Generate PUML from Description

Step 1 — Identify diagram type:

Keywords in requestTypeTag
sequence of calls, API flow, messagesSequence@startuml
classes, OOP, inheritance, methodsClass@startuml
process, workflow, flowchart, stepsActivity (new)@startuml
architecture, services, componentsComponent@startuml
database, schema, tables, entitiesER@startuml
states, lifecycle, status transitionsState@startuml
use cases, actors, user storiesUse Case@startuml
objects, instances, runtime snapshotObject@startuml
timing, signals, waveformsTiming@startuml
brainstorm, concept map, topicsMindMap@startmindmap
project timeline, schedule, milestonesGantt@startgantt
work breakdown, project phasesWBS@startwbs
UI form, wireframe, mockupSalt@startsalt
JSON data structureJSON@startjson
YAML data structureYAML@startyaml
network topology, servers, subnetsnwdiag@startuml + nwdiag {}
enterprise architecture, ArchiMateArchimate@startuml + archimate kw
math formula, equation, LaTeXMaths@startmath / @startlatex
ASCII art diagramDitaa@startditaa

Step 2 — Generate using the full syntax in references/syntax-quick-ref.md. Always include: a title line, skinparam shadowing false, labels on all arrows.

Step 3 — Write, validate & render:

cat > /tmp/diagram.puml << 'PUML'
@startuml
title My Diagram
... generated code ...
@enduml
PUML

python3 scripts/render.py /tmp/diagram.puml --check   # validate
python3 scripts/render.py /tmp/diagram.puml -f svg -o /tmp/  # render

§ Image → PUML (Reverse Engineering)

  1. View the image — use the view tool or examine the upload
  2. Identify the diagram type — references/image-to-puml.md
  3. Extract elements — names, labels, arrows, relationships, cardinality
  4. Generate PUML — reproduce faithfully, correct arrow types
  5. Validate & render — compare against original; refine if needed

Visual analysis guide: references/image-to-puml.md


§ Render Locally

Use scripts/render.py — auto-detects binary vs JAR+Java, any OS.

# macOS / Linux
python3 scripts/render.py diagram.puml                        # PNG
python3 scripts/render.py diagram.puml -f svg -o ./output/   # SVG
python3 scripts/render.py diagram.puml -f pdf -o ./output/   # PDF
cat diagram.puml | python3 scripts/render.py --stdin -f svg -n "name" -o /tmp/

# Windows
py scripts\render.py diagram.puml
py scripts\render.py diagram.puml -f svg -o .\output\

Direct CLI (if plantuml is in PATH):

plantuml -tsvg diagram.puml
plantuml -tpng -o ./output/ *.puml
plantuml -checkonly diagram.puml

Present the output file to the user after rendering using present_files.

Full options, env vars, formats, troubleshooting: references/local-rendering.md


§ Diagnose & Fix PUML

python3 scripts/render.py diagram.puml --check
ErrorCauseFix
No @startuml foundMissing wrapperAdd @startuml / @enduml
Unknown commandTypo or wrong diagram typeCheck syntax-quick-ref.md
Arrow → (Unicode)ASCII requiredUse -> not →
Cannot find classForward referenceDeclare before use
Graphviz errordot not installedbrew/apt install graphviz OR add !pragma layout smetana
PlantUML not foundNot installedbash scripts/bootstrap.sh
Java not detectedNon-standard JDKSet JAVA_HOME env var
Python not foundPython missingbash scripts/bootstrap.sh
Unicode brokenCharset issueplantuml -charset UTF-8 file.puml

§ Syntax Cheatsheet (Ultra-Quick)

Full reference (all 27 chapters, 2700+ lines): references/syntax-quick-ref.md

Sequence arrows:

->   sync          -->  response/dashed
->>  thin           -->> thin dashed
->x  lost           ->o  open arrowhead
<->  bidirectional  ->+  activate   -->-  deactivate
[->  incoming      ->]   outgoing

Class relationships:

<|--  inheritance    <|..  realization
o--   aggregation    *--   composition
-->   dependency     ..>   usage
--    association    --()  lollipop (provided interface)
"1" *-- "0..*"  : label  (with cardinality and label)

ER cardinality (crow's foot):

||   exactly one    o|   zero or one
o{   zero or more   |{   one or more

All @start tags:

@startuml          most diagrams
@startmindmap      mind maps
@startgantt        gantt charts
@startwbs          work breakdown
@startsalt         wireframes
@startjson         JSON display
@startyaml         YAML display
@startmath         AsciiMath
@startlatex        LaTeX formula
@startditaa        Ditaa ASCII art

Universal formatting:

title My Title
skinparam shadowing false
skinparam monochrome true
!theme cerulean
left to right direction
!pragma layout smetana    ' no Graphviz needed

Complete Diagram Coverage (All 27 Chapters from PDF)

ChTypeNotes
1SequenceFull: arrows, groups, activation, notes, autonumber, mainframe, parallel, stereotypes/spots, anchors, encompass, hide footbox
2Use CaseFull: actors, extends/include, notes, packages, business UC, JSON overlay
3ClassFull: visibility, stereotypes, spots, generics, lollipop, extends/implements keywords, hide/show/remove, $tags, namespaces
4ObjectInstances, relations, maps, association objects
5Activity (Legacy)Old (*) --> syntax, branches, synchronization bars, partitions
6Activity (New)start/stop, if/else/elseif, switch/case, while, repeat, fork, split, swimlanes, SDL shapes, goto/label, connectors, condition style
7ComponentComponents, interfaces, ball-socket, grouping, ports, hide unlinked
8DeploymentAll element types, nesting, ports, round corners, orientation
9StateNested, concurrent, fork/join, history, choice, pin, expansion, note on link, inline colour
10Timingrobust, concise, binary, clock, analog; relative time, anchors, highlights
11JSONDisplay, highlight, styles, minimal examples
12YAMLDisplay, highlight, aliases, Creole
13Network (nwdiag)Networks, nodes, addresses, grouping, sprites, peer networks
14Wireframe (Salt)All widgets: button, input, dropdown, radio, checkbox, grid, tree, tabs, group box, scrollbox
15Archimatearchimate keyword, junctions, macros, StdLib integration
16GanttTasks, constraints, milestones, colours, completion %, hyperlinks, closed days, zoom, scale
17MindMapOrgMode and Markdown syntax, left branches, multiroot, colours, direction
18WBSOrgMode syntax, direction, colours, arrows, word wrap
19MathsAsciiMath (@startmath), LaTeX/JLaTeXMath (@startlatex), inline <math> tags
20ER (Info Engineering)Entities, attributes, PK/FK markers, crow's foot relations
21Common Commandscomments, scale/zoom, title, caption, header, footer, legend, newpage, mainframe, appendix, pragma
22CreoleBold, italic, mono, strike, underline, wave; lists, headings, tables, links, emoji, HTML tags, Unicode
23SpritesDefine hex sprites, inline SVG sprites, import from StdLib, OpenIconic, Font Awesome
24SkinparamFull per-element skinparam + modern <style> CSS-like alternative + all themes
25PreprocessingVariables, conditions, while/loop, procedures, functions, default args, unquoted, keyword args, includes, subparts, themes, define, builtins (%string, %strlen, %date, %random, %hsl_color, etc.)
26UnicodeNative UTF-8, &#XXXX; and <U+XXXX> references, emoji <:name:>, charset flag
27StdLibArchiMate, AWS, Azure, C4, Kubernetes, Elastic, GCP, CloudOgu, Tupadr3/FontAwesome, EDGY
—Ditaa@startditaa ASCII art to diagram

Reference Files

FileContent
references/syntax-quick-ref.md2700+ lines — complete syntax for all 27 chapters
references/image-to-puml.mdVisual analysis guide for image→PUML reverse engineering
references/local-rendering.mdSetup, CLI flags, formats, env vars, troubleshooting

Scripts

ScriptPurpose
scripts/bootstrap.shStart here — macOS/Linux — installs Python→Java→PlantUML (no deps)
scripts/bootstrap.ps1Start here — Windows — PowerShell 5+, no deps required
scripts/setup.pyPython setup: detect/install Java + PlantUML; also reports Python
scripts/render.pyCross-platform render: auto-detects Python/binary/JAR/Java

Comments

Markdown supported