---
title: "Gemini on diagram prompting"
url: https://mdfy.app/qP599HA4
updated: 2026-05-14T18:15:49.480Z
source: "mdfy.app"
---
# Gemini on diagram prompting

> Gemini 2.5 Pro, after I asked it to generate Mermaid for a 3-tier auth flow.

## The first try

I gave Gemini the API endpoints, the role table, and asked for "a Mermaid sequenceDiagram showing how an authenticated request flows through middleware → handler → DB." It produced a diagram that was technically correct but had eight nodes and three crossing edges. Unreadable.

## The reframe

I asked: "Why did you choose that shape?" Its answer was honest — it had matched the prompt syntactically (the words in my ask) to common diagram templates in training data, not to the actual flow. It then suggested I describe the **flow** instead:

> "Describe who calls whom, what data crosses the boundary, what each side is responsible for. The shapes will follow."

I tried that. New prompt: "Auth middleware receives a request with a bearer token. It calls the identity service to resolve the user. The handler then queries the user-scoped DB view." Result: four nodes, two edges, completely legible. Same fidelity, half the cognitive load.

## The takeaway

The order I now use, every time I prompt for a diagram:

1. **Actors.** Who's involved? Name them in the prompt.
2. **Calls.** Who calls whom? Direction matters.
3. **Data.** What crosses each boundary?
4. **Constraints.** What's the failure mode?

Shapes come out of (1) automatically. Edges come out of (2) and (3). Annotations come out of (4).

Gemini was right about the prompt structure even when it was wrong about the first diagram — which I take as the lesson: ask AIs to defend their structural choices, not just the surface output.
