How to Let AI Instantly Draw Professional UML Diagrams with Mermaid

This article walks through using large language models such as Claude, Gemini, DeepSeek, and Kimi to generate accurate, colorful UML diagrams via Mermaid syntax, covering model selection, prompt engineering, step‑by‑step demonstrations, and practical tips for reliable AI‑driven diagram creation.

Wuming AI
Wuming AI
Wuming AI
How to Let AI Instantly Draw Professional UML Diagrams with Mermaid

Background

Colleague created a professional UML diagram using Mermaid syntax generated entirely by AI from a brief description.

Model Selection

Large language models that understand Mermaid syntax include Claude Sonnet 4.5, Gemini 2.5 Pro (Gemini 3 upcoming), DeepSeek‑V3.2, and Kimi‑K2. Prefer the latest version of any model.

Prompt Engineering

请使用 Mermaid 的语法,帮我生成最适合的 UML 类型的图。

要求:
1 不同的颜色之间尽量通过不同的颜色进行区分。
2 可以适当加一些emoji,以便让图形更有趣。
3 生成时务必检查语法正确性,避免出现任何语法错误。

你只需要输出 Mermaid 源码即可,不需要任何解释。

The prompt forces the model to output only Mermaid source, enforce correct syntax, use distinct colors, and optionally add emojis.

Demonstration

Gemini

In Gemini, create a new application, paste the prompt, and preview the result. Gemini does not render Mermaid natively, so copy the generated code to an external renderer such as https://mermaid-drawing.com/ or https://mermaid-live.nodejs.cn/.

Cherry Studio

After installing Cherry Studio, create an intelligent agent, set a name, paste the same prompt, select the desired model, and add the agent to the assistant. Sending a description like “draw an e‑commerce customer‑service architecture diagram” triggers automatic diagram generation and rendering.

The resulting diagram can be copied directly or downloaded as SVG or PNG.

Tips for Better Results

Specify Diagram Type Explicitly

State the exact diagram type (e.g., flowchart, sequence diagram) to avoid unintended styles.

绘制流程图
流程为:
1 xxx
2 xxx
3 xxx

List All Objects for Sequence Diagrams

Enumerate participating objects to ensure correct naming and count.

时序图
3 个对象,分别为:
A
B
C
时序描述:
1 xxx
2 xxx
3 xxx

Conclusion

By selecting an appropriate model, crafting a precise prompt, and following the demonstrated steps, AI can rapidly produce high‑quality, colorful UML diagrams suitable for reports and technical designs.

automationprompt engineeringlarge language modelsUMLMermaidAI-generated diagrams
Wuming AI
Written by

Wuming AI

Practical AI for solving real problems and creating value

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.