SSkilltecabyclaudinhocode
Enviar skill
← Voltar para o catálogo

plantuml

Design e Frontend

Gera diagramas PlantUML a partir de descrições de texto e os converte em imagens PNG/SVG. Use para criar diagramas, gerar PlantUML, converter puml para imagem, extrair diagramas de markdown ou preparar markdown para Confluence. Suporta todos os tipos de diagramas PlantUML, incluindo UML e não-UML como diagramas ER.

41estrelas
Ver no GitHub ↗Autor: SpillwaveSolutions

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:

ComponentPurposeInstallation
Java JRE/JDK 8+Runtimehttps://www.oracle.com/java/technologies/downloads/
plantuml.jarDiagram generatorhttps://plantuml.com/download (place in ~/plantuml.jar or set PLANTUML_JAR)
Graphviz (optional)Complex layoutshttps://graphviz.org/download/

Creating Diagrams

Diagram Type Identification

Identify the appropriate diagram type based on user intent:

User IntentDiagram TypeReference
Interactions over timeSequencereferences/sequence_diagrams.md
System structure with classesClassreferences/class_diagrams.md
Workflows, decision flowsActivityreferences/activity_diagrams.md
Object states and transitionsStatereferences/state_diagrams.md
Database schemasER (Entity Relationship)references/er_diagrams.md
Project timelinesGanttreferences/gantt_diagrams.md
Idea organizationMindMapreferences/mindmap_diagrams.md
System architectureComponentreferences/component_diagrams.md
Actors and featuresUse Casereferences/use_case_diagrams.md
All 19 typesSee navigation hubreferences/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 TypeDirectoryKey Diagrams
Spring Bootexamples/spring-boot/Deployment, Component, Sequence
FastAPIexamples/fastapi/Deployment, Component (async routers)
Python ETLexamples/python-etl/Architecture with Airflow
Node.jsexamples/nodejs-web/Express/Nest.js components
Reactexamples/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 filenam

Como adicionar

/plugin marketplace add SpillwaveSolutions/plantuml

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Comentários · Nenhum comentário

Entre para comentar. Entrar

  • Ainda não há comentários. Seja o primeiro.