Generate PlantUML diagrams from text descriptions and convert them to PNG/SVG images. Use when asked to "create a diagram", "generate PlantUML", "convert puml to image", "extract diagrams from markdown", or "prepare markdown for Confluence". Supports all PlantUML diagram types including UML (sequence, class, activity, state, component, deployment, use case, object, timing) and non-UML (ER diagrams, Gantt charts, JSON/YAML visualization, mindmaps, WBS, network diagrams, wireframes, and more).

0 stars
1 forks
Python
1 views

SKILL.md


name: plantuml description: Generate PlantUML diagrams from text descriptions and convert them to PNG/SVG images. Use when asked to "create a diagram", "generate PlantUML", "convert puml to image", "extract diagrams from markdown", or "prepare markdown for Confluence". Supports all PlantUML diagram types including UML (sequence, class, activity, state, component, deployment, use case, object, timing) and non-UML (ER diagrams, Gantt charts, JSON/YAML visualization, mindmaps, WBS, network diagrams, wireframes, and more).

PlantUML Diagram Generation and Conversion

Table of Contents

Purpose

This skill enables comprehensive PlantUML diagram creation and conversion workflows. PlantUML is a text-based diagramming tool that generates professional diagrams from simple, intuitive syntax.

Core capabilities:

  1. Create diagrams from natural language descriptions
  2. Convert source code to architecture diagrams (Spring Boot, FastAPI, Python ETL, Node.js, React)
  3. Convert standalone .puml files to PNG or SVG images
  4. Extract puml code blocks from markdown and convert to images
  5. Process linked .puml files in markdown (![diagram](path/to/diagram.puml))
  6. Validate PlantUML syntax without conversion
  7. Replace markdown diagrams with image links for publication (Confluence, Notion)

When to Use This Skill

Activate for:

  • Diagram creation requests (e.g., "Create a sequence diagram showing authentication flow")
  • Code architecture visualization (e.g., "Create deployment diagram for my Spring Boot app")
  • .puml file to image conversion
  • Markdown files containing ```puml code blocks or linked .puml files
  • Confluence or Notion markdown preparation (documents with PlantUML diagrams require conversion first)
  • Specific diagram types: UML (sequence, class, activity, state, component, deployment, use case, object, timing) or non-UML (ER, Gantt, mindmap, WBS, JSON/YAML, network, Archimate, wireframes)
  • PlantUML syntax validation

Confluence/Notion uploads: If markdown contains PlantUML diagrams, run conversion FIRST before upload.

Prerequisites

Before creating diagrams, verify the PlantUML setup:

python scripts/check_setup.py

Required components:

Component Purpose Installation
Java JRE/JDK 8+ Runtime https://www.oracle.com/java/technologies/downloads/
plantuml.jar Diagram generator https://plantuml.com/download (place in ~/plantuml.jar or set PLANTUML_JAR)
Graphviz (optional) Complex layouts https://graphviz.org/download/

Creating Diagrams

Diagram Type Identification

Identify the appropriate diagram type based on user intent:

User Intent Diagram Type Reference
Interactions over time Sequence references/sequence_diagrams.md
System structure with classes Class references/class_diagrams.md
Workflows, decision flows Activity references/activity_diagrams.md
Object states and transitions State references/state_diagrams.md
Database schemas ER (Entity Relationship) references/er_diagrams.md
Project timelines Gantt references/gantt_diagrams.md
Idea organization MindMap references/mindmap_diagrams.md
System architecture Component references/component_diagrams.md
Actors and features Use Case references/use_case_diagrams.md
All 19 types See navigation hub references/toc.md

Syntax resources:

  • references/toc.md: Navigation hub linking to all diagram types
  • references/common_format.md: Universal elements (delimiters, metadata, comments, notes)
  • references/styling_guide.md: Modern <style> syntax for visual customization

Resilient Workflow (Primary - Recommended)

For reliable diagram generation with error recovery, follow the 4-step resilient workflow:

Step 1: Identify Diagram Type & Load Reference

  • Identify diagram type from user intent
  • Load references/[diagram_type]_diagrams.md for syntax guide
  • Consult references/toc.md if ambiguous

Step 2: Create File with Structured Naming

./diagrams/<markdown_name>_<num>_<type>_<title>.puml

Example: ./diagrams/architecture_001_sequence_user_auth.puml

Step 3: Convert with Error Handling (max 3 retries)

If conversion fails:

  1. Check references/troubleshooting/toc.md for error classification
  2. Load specific guide from references/troubleshooting/[category]_guide.md
  3. Check references/common_syntax_errors.md for diagram type

Step 4: Validate & Integrate

  1. Verify image file exists
  2. Add image link: ![title](diagrams/filename.png)
  3. Keep .puml source file for future edits

Full documentation: references/workflows/resilient-execution-guide.md

Quick Syntax Reference

Common elements:

  • Delimiters: @startuml / @enduml (required)
  • Comments: ' Single line or /' Multi-line '/
  • Relationships: -> (solid), --> (dashed), ..> (dotted)
  • Labels: A -> B : Label text

Minimal examples (see references/[type]_diagrams.md for comprehensive syntax):

' Sequence: references/sequence_diagrams.md
@startuml
Alice -> Bob: Request
Bob --> Alice: Response
@enduml
' Class: references/class_diagrams.md
@startuml
class Animal { +move() }
class Dog extends Animal { +bark() }
@enduml
' ER: references/er_diagrams.md
@startuml
entity User { *id: int }
entity Post { *id: int }
User ||--o{ Post
@enduml

Converting Source Code to Diagrams

The examples/ directory contains language-specific templates for converting common application architectures:

Application Type Directory Key Diagrams
Spring Boot examples/spring-boot/ Deployment, Component, Sequence
FastAPI examples/fastapi/ Deployment, Component (async routers)
Python ETL examples/python-etl/ Architecture with Airflow
Node.js examples/nodejs-web/ Express/Nest.js components
React examples/react-frontend/ SPA deployment, component architecture

Workflow:

  1. Identify application type
  2. Review example in examples/[app-type]/
  3. Map code structure to diagram patterns
  4. Copy and adapt the example .puml file
  5. Use Unicode symbols from references/unicode_symbols.md for semantic clarity

Converting Diagrams to Images

Convert Standalone .puml Files

# Convert to PNG (default)
python scripts/convert_puml.py diagram.puml

# Convert to SVG
python scripts/convert_puml.py diagram.puml --format svg

# Specify output directory
python scripts/convert_puml.py diagram.puml --format svg --output-dir images/

Extract and Convert from Markdown

CRITICAL for Confluence/Notion: Run this FIRST before upload if markdown contains PlantUML diagrams.

# Process embedded ```puml blocks AND linked ![](diagram.puml) files
python scripts/process_markdown_puml.py article.md

# Convert to SVG format
python scripts/process_markdown_puml.py article.md --format svg

# Validate syntax only (for CI/CD)
python scripts/process_markdown_puml.py article.md --validate

Outputs:

  • article_with_images.md: Markdown with image links
  • images/: Directory with generated images

IDE-Friendly Workflow: Keep diagrams as .puml files during development for IDE preview, then convert for publication.

Direct Command-Line Usage

# Basic conversion
java -jar ~/plantuml.jar diagram.puml

# SVG with custom output
java -jar ~/plantuml.jar --svg --output-dir out/ diagram.puml

# Batch conversion
java -jar ~/plantuml.jar "**/*.puml" --svg

See references/plantuml_reference.md for comprehensive command-line options.

Best Practices

Diagram Quality:

  • Use descriptive filenames from diagram content
  • Add comments with ' for clarity
  • Follow standard UML notation
  • Test incrementally before adding complexity

Format Selection:

  • PNG: Web publishing, smaller files, fixed resolution
  • SVG: Documentation, scalable, supports hyperlinks

Styling: Apply modern <style> syntax from references/styling_guide.md:

@startuml
<style>
classDiagram {
  class { BackgroundColor LightBlue }
}
</style>
' diagram content
@enduml

Themes: !theme cerulean (also: bluegray, plain, sketchy, amiga)

Unicode symbols: Add semantic meaning with symbols from references/unicode_symbols.md:

node "☁️ AWS Cloud" as aws
database "💾 PostgreSQL" as db

Troubleshooting

Quick diagnosis:

  1. Check syntax: java -jar plantuml.jar --check-syntax file.puml
  2. Identify error type
  3. Load troubleshooting guide: references/troubleshooting/toc.md

Common issues:

Issue Solution
"plantuml.jar not found" Download from https://plantuml.com/download, set PLANTUML_JAR
"Graphviz not found" Install from https://graphviz.org/download/
"Syntax Error" Check delimiters match, consult references/common_format.md
"Java not found" Install Java JRE/JDK 8+, verify with java -version

Comprehensive guides (215+ errors documented):

  • references/troubleshooting/toc.md - Navigation hub with error decision tree
  • references/troubleshooting/[category]_guide.md - 12 focused guides by error type

References

Core Syntax References

Resource Purpose
references/toc.md Navigation hub for all 19 diagram types
references/common_format.md Universal elements (delimiters, metadata, comments)
references/styling_guide.md Modern <style> syntax with CSS-like rules
references/plantuml_reference.md Installation, CLI, and troubleshooting

Troubleshooting Guides

Resource Coverage
references/troubleshooting/toc.md Navigation hub with error decision tree
references/troubleshooting/installation_setup_guide.md Setup problems
references/troubleshooting/general_syntax_guide.md Syntax errors
references/troubleshooting/[diagram_type]_guide.md Diagram-specific errors

Enrichment Resources

Resource Purpose
references/unicode_symbols.md Unicode symbols for semantic enrichment
examples/[framework]/ Code-to-diagram patterns

Summary

  1. Verify setup: python scripts/check_setup.py
  2. Navigate types: Start with references/toc.md
  3. Learn syntax: Open references/[diagram_type]_diagrams.md
  4. Apply styling: Use references/styling_guide.md
  5. Add symbols: Use references/unicode_symbols.md
  6. Convert files: scripts/convert_puml.py
  7. Process markdown: scripts/process_markdown_puml.py
  8. Troubleshoot: references/troubleshooting/toc.md

Supported diagrams:

  • UML: sequence, class, activity, state, component, deployment, use case, object, timing
  • Non-UML: ER, Gantt, mindmap, WBS, JSON/YAML, network, Archimate, wireframes

README

PlantUML Claude Skill

Claude Code Skill PlantUML License

A comprehensive Claude Code skill for generating PlantUML diagrams from text descriptions, converting source code to architecture diagrams, and processing markdown files. This skill supports all 19 PlantUML diagram types with enhanced features for real-world development workflows.

Installing with Skilz

Install this skill using the Skilz universal installer:

skilz install SpillwaveSolutions_plantuml/plantuml

Or install directly from GitHub:

skilz install https://github.com/SpillwaveSolutions/plantuml

Browse and explore this skill on the Skilz marketplace: View on Skilz Marketplace

Features

  • Generate diagrams from natural language - Describe what you want, get PlantUML syntax
  • Convert source code to diagrams - Spring Boot, FastAPI, Python ETL, Node.js, React examples
  • Convert .puml files to images - Generate PNG or SVG from standalone PlantUML files
  • Extract diagrams from markdown - Process both embedded puml blocks AND linked .puml files
  • Unicode symbol enrichment - Add semantic meaning with security, data, and system symbols
  • Validate PlantUML syntax - CI/CD-ready validation without conversion
  • IDE-friendly workflow - Link to .puml files for IDE preview, convert for publication
  • Confluence-ready output - Convert PlantUML to images for doc systems without native support
  • Comprehensive diagram support - All UML (sequence, class, activity, state, etc.) and non-UML types (ER, Gantt, mindmap, etc.)
  • Modern styling - CSS-like <style> syntax for professional diagram appearance

Quick Start

1. Verify Setup

Check that Java, Graphviz, and plantuml.jar are installed:

python scripts/check_setup.py

2. Convert a PlantUML File

# Convert to PNG
python scripts/convert_puml.py my_diagram.puml

# Convert to SVG
python scripts/convert_puml.py my_diagram.puml --format svg --output-dir images/

3. Process Markdown with PlantUML

# Process both embedded puml blocks AND linked ![](diagram.puml) files
python scripts/process_markdown_puml.py article.md

# Validate syntax without converting (great for CI/CD)
python scripts/process_markdown_puml.py article.md --validate

# Convert to SVG format
python scripts/process_markdown_puml.py article.md --format svg

Requirements

Prerequisites

  1. Java (JRE 8 or higher)

    • Download from Oracle
    • Verify: java -version
  2. plantuml.jar

    • Download from PlantUML
    • Place in one of these locations:
      • ~/plantuml.jar
      • /usr/local/bin/plantuml.jar
      • Or set PLANTUML_JAR environment variable
  3. Graphviz (recommended, required for most UML diagrams)

    • Download from Graphviz
    • Add dot executable to PATH

Quick Setup

# macOS (with Homebrew)
brew install java graphviz
curl -o ~/plantuml.jar https://downloads.sourceforge.net/project/plantuml/plantuml.jar

# Ubuntu/Debian
sudo apt install default-jre graphviz
wget -O ~/plantuml.jar https://downloads.sourceforge.net/project/plantuml/plantuml.jar

# Verify installation
python scripts/check_setup.py

Code-to-Diagram Examples

Convert real-world application architectures to PlantUML diagrams with comprehensive examples in examples/:

Framework Description Examples
Spring Boot AWS ECS deployment, component architecture, REST API sequence flows examples/spring-boot/
FastAPI Kubernetes deployment, async architecture, Pydantic validation flows examples/fastapi/
Python ETL Complete pipeline with Airflow, data quality, monitoring examples/python-etl/
Node.js Express/Nest.js component diagrams examples/nodejs-web/
React SPA deployment (S3 + CloudFront), component architecture examples/react-frontend/

Each example includes deployment, component, and sequence diagrams with production-ready patterns.

Unicode Symbol Enrichment

Enhance diagrams with semantic Unicode symbols (see references/unicode_symbols.md):

node "AWS Cloud" as aws
component "Security Service" as security
database "PostgreSQL" as db
queue "RabbitMQ" as mq
component "FastAPI App" as api

Symbol categories: Web, Data, Security, System, Messaging, Languages, Cloud, Processing, Monitoring

Linked .puml Files Support

Reference external .puml files in markdown for IDE-friendly workflows:

## Architecture

![Deployment](diagrams/deployment.puml)
![Components](diagrams/components.puml)

Benefits:

  • IDEs with PlantUML support render diagrams in preview
  • Version control tracks diagram changes separately
  • Reuse diagrams across multiple markdown files
  • Better code reviews (diff .puml files directly)
  • Same script converts both embedded and linked diagrams

Usage Examples

Example 1: Create a Sequence Diagram

Create auth_flow.puml:

@startuml
participant User
participant App
participant AuthServer

User -> App: Login Request
activate App
App -> AuthServer: Validate Credentials
activate AuthServer
AuthServer --> App: Token
deactivate AuthServer
App --> User: Success
deactivate App
@enduml

Convert to image:

python scripts/convert_puml.py auth_flow.puml --format svg

Example 2: Create an ER Diagram

Create blog_schema.puml:

@startuml
entity "User" {
  *id: int
  username: string
  email: string
  created_at: datetime
}

entity "Post" {
  *id: int
  user_id: int
  title: string
  content: text
  published_at: datetime
}

entity "Comment" {
  *id: int
  post_id: int
  user_id: int
  content: text
  created_at: datetime
}

User ||--o{ Post : writes
User ||--o{ Comment : writes
Post ||--o{ Comment : has
@enduml

Example 3: Process Markdown with Multiple Diagrams

Create article.md:

# System Architecture

## Authentication Flow

```puml
@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
@enduml
```

## Database Schema

```puml
@startuml
entity "User" {
  *id: int
  name: string
}
entity "Order" {
  *id: int
  user_id: int
}
User ||--o{ Order
@enduml
```

Process the file:

python scripts/extract_and_convert_puml.py article.md --format png

This creates:

  • article_with_images.md - Updated markdown with image links
  • images/diagram_1_uml.png - First diagram
  • images/diagram_2_uml.png - Second diagram

Supported Diagram Types

UML Diagrams

Type Description
Sequence Interactions between participants over time
Use Case System features and actors
Class Object-oriented structure
Object Runtime instances
Activity Workflows and processes
Component System modules
Deployment Physical architecture
State State machines and transitions
Timing State changes over time

Non-UML Diagrams

Type Description
Entity-Relationship (ER) Database schemas
Network Network topology
Wireframes (Salt) UI mockups
Ditaa ASCII art diagrams
Work Breakdown Structure (WBS) Project tasks
MindMap Hierarchical information
Gantt Project timelines
JSON/YAML Data visualization
Archimate Enterprise architecture
Timeline Chronological events

Scripts Reference

check_setup.py

Validates PlantUML environment setup.

python scripts/check_setup.py

Checks:

  • Java installation and version
  • Graphviz availability
  • plantuml.jar location
  • Runs test diagram conversion

convert_puml.py

Converts standalone .puml files to images.

python scripts/convert_puml.py <file.puml> [options]

Options:
  --format png|svg       Output format (default: png)
  --output-dir <path>    Directory for output images (default: same as input)

process_markdown_puml.py

Enhanced markdown processor supporting both embedded code blocks AND linked .puml files.

python scripts/process_markdown_puml.py <file.md> [options]

Options:
  --format png|svg       Output format (default: png)
  --output-dir <path>    Directory for images (default: images/)
  --validate             Validate syntax without converting (CI/CD mode)

Key advantages:

  • Supports IDE-friendly workflow (link to external .puml files)
  • Validates syntax before conversion
  • CI/CD ready with --validate flag
  • Processes both embedded and linked diagrams in single pass
  • Better error messages with line numbers

extract_and_convert_puml.py (Legacy)

Note: Consider using process_markdown_puml.py for enhanced features.

Extracts PlantUML diagrams from markdown and converts to images.

python scripts/extract_and_convert_puml.py <file.md> [options]

Options:
  --format png|svg       Output format (default: png)
  --output-dir <path>    Directory for images (default: images/)

Advanced Usage

Direct PlantUML Commands

# Basic PNG conversion
java -jar ~/plantuml.jar diagram.puml

# SVG output
java -jar ~/plantuml.jar --svg diagram.puml

# Batch convert all .puml files
java -jar ~/plantuml.jar "**/*.puml" --svg --output-dir images/

# Check syntax without converting
java -jar ~/plantuml.jar --check-syntax diagram.puml

# Pipe input
echo "@startuml Alice->Bob @enduml" | java -jar ~/plantuml.jar -pipe --svg > output.svg

Modern Styling

Use CSS-like <style> syntax for professional appearance:

@startuml
<style>
classDiagram {
  class {
    BackgroundColor LightBlue
    BorderColor Navy
    FontColor DarkBlue
    FontSize 14
  }
  arrow {
    LineColor SeaGreen
    LineThickness 2
  }
}
</style>

class Animal {
  -name: String
  +move()
}
class Dog extends Animal {
  +bark()
}
Animal <|-- Dog
@enduml

Themes

Quick styling with built-in themes:

@startuml
!theme cerulean

' Your diagram content
@enduml

Available themes: cerulean, bluegray, plain, sketchy, amiga

Documentation

The references/ directory contains comprehensive guides:

Core References

Diagram Type Guides

Code Examples

Directory Description
examples/spring-boot/ Spring Boot deployment, component, and sequence diagrams
examples/fastapi/ FastAPI Kubernetes deployment and async architecture
examples/python-etl/ Python ETL pipeline architecture with Airflow
examples/nodejs-web/ Node.js/Express component diagrams
examples/react-frontend/ React SPA deployment diagrams

Troubleshooting

"plantuml.jar not found"

  • Download from https://plantuml.com/download
  • Place in ~/plantuml.jar or set PLANTUML_JAR environment variable
  • Verify: python scripts/check_setup.py

"Graphviz not found"

"Syntax Error?"

  • Verify @start/@end delimiters match
  • Check diagram-specific syntax in references/[diagram_type].md
  • Use java -jar plantuml.jar --check-syntax file.puml

"Java not found"

  • Install Java JRE/JDK 8+
  • Add to PATH
  • Verify: java -version

Tips and Best Practices

  1. Use descriptive filenames - user_auth_sequence.puml instead of diagram1.puml
  2. Add comments - Use ' for single-line comments to document complex logic
  3. Choose SVG for documentation - Scalable, better quality, supports hyperlinks
  4. Use PNG for web - Smaller file sizes, fixed resolution
  5. Start simple - Test basic diagrams before adding complexity
  6. Version control - Commit .puml source files to Git
  7. Prefer modern styling - Use <style> tags instead of legacy skinparam

Use with Claude Code

This is a Claude Code skill. When loaded, Claude can:

  • Generate PlantUML syntax from natural language descriptions
  • Select the appropriate diagram type for your use case
  • Create properly formatted .puml files
  • Convert diagrams to images
  • Extract and process diagrams from markdown files
  • Apply modern styling for professional appearance

Simply describe what you want: "Create a sequence diagram for user authentication" or "Extract all diagrams from my article.md and convert to SVG".

Resources

License

This skill is provided as-is for use with Claude Code.