Skip to main content

Write prompts for diagrams in AI assistants

How your AI assistant turns a prompt into a draw.io diagram, and how to steer it.

The two formats​

The assistant writes each diagram in one of two formats. It picks one by itself, and you can ask for the other.

Mermaiddraw.io XML
What the assistant writesA short text description: Order --> PaymentEvery shape with its position, size and style
LayoutAutomaticPlaced by the assistant, following a pattern for each diagram type
Typical time10–20 s35–60 s
Output tokensAbout 1,500About 7,500
StylesColours by roleAny draw.io style: colour themes, fonts, shadows, hand-drawn, gradients
IconsNone from the draw.io librariesMore than 10,000 draw.io shapes: AWS, Azure, Google Cloud, Cisco, Kubernetes, P&ID and more
Diagram types28, including sequence diagrams, Gantt charts and chartsAnything made of shapes and connectors
After Open in draw.ioKeeps its Mermaid text: double-click the diagram to edit the textNative draw.io shapes, each editable on its own

Which format the assistant uses​

draw.io XML: for diagrams of boxes and lines up to about 30 shapes. These are flowcharts, decision trees, swimlane processes, org charts, ER diagrams, UML class, state and use case diagrams, mind maps, timelines, and architecture, cloud and network diagrams.

Mermaid: for the diagram types only Mermaid draws, and for large flowcharts. These are sequence diagrams, Gantt charts, pie, XY, quadrant and Sankey charts, git graphs, kanban boards, user journeys and the other Mermaid types, and flowcharts with more than about 30 shapes, which get an automatic layout.

Ask for a format​

You wantAdd to your prompt
A faster result, or a diagram you edit as text later"Use Mermaid."
Your own styling, exact placement or icons"Use draw.io shapes, not Mermaid."
Official icons"Use AWS icons." · "Use Cisco shapes." · "Use Kubernetes icons."

For example, a 20-step insurance claim process placed as draw.io XML took 4–7 minutes. The same prompt ending in "Use Mermaid." took 15 seconds.

Choose a model​

ModelResult
Claude Sonnet 5.5Recommended. The times above are for this model.
Claude Opus 5.5The best layouts and the most complete content, in about twice the time (draw.io XML: 115 s).
Claude Haiku 5.5Not faster: it wrote 2–3 times as many tokens (draw.io XML: 75 s), and chose the wrong format in 2 of 10 runs.
Other models, such as GPT and GeminiThey use the same drawing guide, but weren't measured.

Write the prompt​

  • Name the diagram type: "a swimlane process", "an ER diagram", "a sequence diagram".
  • List the content: the steps, components, tables or people. The assistant adds what is obviously missing, such as the start and end or error paths, but your list decides what appears.
  • Say what connects to what where it matters: "the API gateway calls the order and payment services".
  • Say where the diagram goes: "for a board slide" gets a corporate look, "a rough first sketch" a hand-drawn one. See colour themes.
  • Name the icon set when you want icons: AWS, Azure, Google Cloud, Cisco, Kubernetes, P&ID.
  • Write in any language: the labels will be in the same language.

When the result is off​

Ask for the change in the same chat. The assistant sees the diagram as it is shown, and changes only what you name:

Make it left to right.

Add a Redis cache between the application servers and the database.

Highlight the photo upload path in orange and label each connector with what it carries.

Specific requests work better than "try again". For many small changes, click Open in draw.io and edit the diagram in the draw.io editor.