---
title: "Gemini on diagram prompting"
url: https://memory.wiki/qP599HA4
updated: 2026-05-14T18:15:49.480Z
hub: https://memory.wiki/hub/demo
concept_count: 11
source: "memory.wiki"
---
# 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.


---

## Concepts in this document
- **Mermaid** _(entity)_
  Diagram rendering library that handles six core diagram types with auto-layout limitations.
- **Gemini 2.5 Pro** _(entity)_
  Specialized AI tool for diagrams and image-based tasks where Claude's multimodal capabilities are weaker.
- **Diagram prompting** _(concept)_
  The core practice of crafting prompts to guide AI generation of visual diagrams by describing structure rather than syntax.
- **Call relationships** _(concept)_
  Second step specifying directional interactions between actors; determines diagram edges.
- **Data boundaries** _(concept)_
  Third step identifying what information crosses between actors; provides edge annotations and clarity.
- **Prompt reframing** _(concept)_
  The key technique of shifting from syntactic matching to semantic description of actual system behavior.
- **Actor identification** _(concept)_
  First step in the prompting sequence; naming involved parties drives correct diagram node structure.
- **Authentication flow** _(concept)_
  The specific domain problem used to test and validate the diagram prompting methodology.
- **Cognitive load reduction** _(concept)_
  The measurable outcome of applying the prompting methodology: simplified, more readable diagrams.
- **AI structural reasoning** _(concept)_
  The broader insight that asking AI to defend design choices improves output quality beyond surface fixes.
- **Constraint modeling** _(concept)_
  Fourth step capturing failure modes and edge cases; informs diagram annotations and completeness.

## Concept relations (within this doc's concepts)
- **Prompt reframing** enables **Actor identification**
- **Data boundaries** followed by **Constraint modeling**
- **Constraint modeling** contributes to **Cognitive load reduction**
- **Prompt reframing** exemplifies **AI structural reasoning**
- **Actor identification** precedes **Call relationships**
- **Diagram prompting** achieved through **Prompt reframing**
- **Call relationships** followed by **Data boundaries**
- **Diagram prompting** tested with **Gemini 2.5 Pro**
- **Diagram prompting** targets output in **Mermaid**
- **Authentication flow** validates **Diagram prompting**

_Hub canonical:_ https://memory.wiki/hub/demo
_Concept digest:_ https://memory.wiki/raw/hub/demo?digest=1&compact=1
