plantuml-image-generator
PlantUML Image Generator
When to Apply
- When the user asks "draw a diagram for me" or "I need an architecture/flowchart/sequence/state-machine diagram".
- When the user requires inserting an illustration of business processes or structural diagrams into development documents, READMEs, or any Markdown files.
- When you need to visually explain complex code logic to the user for better understanding.
Execution Rules
-
Requirement Analysis & Code Generation:
- Extract the elements and relationships that need visualization based on the user's context.
- Write standard PlantUML syntax code (must start with
@startumland end with@enduml).
-
Core Encoding Logic (URL Generation): Convert the generated PlantUML code into
ENCODED_TEXTusing specific encoding rules:- First, encode the PlantUML source code into
UTF-8. - Compress it using the
zlib/Deflatealgorithm. - Re-encode the compressed result using PlantUML's specialized Base64 dictionary (variant:
0-9, A-Z, a-z, -, _).
- First, encode the PlantUML source code into
-
URL Assembly: Append the generated
ENCODED_TEXTto the official main service URL, supporting two mainstream formats:- PNG Raster Image:
http://www.plantuml.com/plantuml/png/{ENCODED_TEXT} - SVG Vector Image (Recommended, scales without distortion):
http://www.plantuml.com/plantuml/svg/{ENCODED_TEXT}
- PNG Raster Image:
-
Rendering & Insertion:
- Wrap the assembled URL using standard Markdown image syntax:
 - Reply directly to the user with this Markdown line, or use file editing tools to insert it into the appropriate location in the document.
- Wrap the assembled URL using standard Markdown image syntax:
Code Reference (Auto-Helper Script / Python Example)
If you need to write a script to quickly verify the encoding process, refer to the following conversion logic:
import zlib
import base64
def generate_plantuml_url(uml_text: str, output_format: str = "svg") -> str:
utf8_data = uml_text.encode('utf-8')
compressor = zlib.compressobj(9, zlib.DEFLATED, -zlib.MAX_WBITS)
compressed_data = compressor.compress(utf8_data) + compressor.flush()
b64_str = base64.b64encode(compressed_data)
trans = bytes.maketrans(
b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
b"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"
)
encoded_str = b64_str.translate(trans).decode('utf-8').rstrip('=')
return f"http://www.plantuml.com/plantuml/{output_format}/{encoded_str}"
Input/Output Example (Edge Cases & Examples)
Input Context: "Boss: Add a sequence diagram to the README explaining the user login process."
Internal Execution (PlantUML Source):
@startuml
User -> Server: Send username and password
Server -> Database: Validate credentials
Database --> Server: Return UserID and Token
Server --> User: Login successful
@enduml
Your Final Output (Written directly in the document or feedback message):

More from imhansiy/my-skills
localtunnel-auto-expose
Automatically exposes local services using LocalTunnel via npx and provides the public URL along with the access password. Use when starting a new service or when external web access is requested.
13cliproxy-manager
Unified management skill for CLIProxyAPI, enabling AI to dynamically update service configurations (API Keys, model aliases, proxy rules) and monitor usage statistics.
7odoo-dev-assistant
Odoo 开发与运维辅助技能。用于处理 Odoo 模块开发、配置排查、数据库操作、账号与权限修复、文档生成等任务。当前已内置重置 Odoo 登录用户 admin 密码、生成模块介绍页文档、识别当前运行数据库与 addons 路径、恢复 Odoo.sh 备份并配置 odoo.conf 等工作流,后续可继续扩展更多 Odoo 场景。
2odoorpc-agent-skill
>-
1hexo-blog-manager
Handles the creation workflow for Hexo blog posts and the uploading of images/covers to GitHub_Oss using the jsDelivr CDN. Use exclusively for publishing or updating Hexo blog content with images.
1cliproxyapi-manager-skill
>-
1