Prompting AI Agents
If you use Cursor, Copilot, ChatGPT, Claude, or any other coding agent to help author diagrams, the prompt quality matters more than the model brand.
What to ask for
Section titled “What to ask for”Ask the agent for one of these outputs explicitly:
- OpenFlow DSL
- Mermaid
- a diagram plan before code
Do not ask for “a diagram” and hope it guesses the right syntax.
Good prompt structure
Section titled “Good prompt structure”Include all of the following:
- diagram purpose
- intended audience
- required systems or actors
- important branches or failure paths
- preferred direction (
TBorLR) - preferred syntax (
OpenFlow DSLorMermaid)
Example prompt for OpenFlow DSL
Section titled “Example prompt for OpenFlow DSL”Generate OpenFlow DSL for OpenFlowKit.Make a left-to-right payment recovery workflow.Include invoice due, charge attempt, success decision,retry sequence, manual review, customer notification,and terminal success/failure nodes.Use explicit node ids and label every branch edge.Example prompt for Mermaid
Section titled “Example prompt for Mermaid”Generate Mermaid flowchart code for a SaaS onboarding diagram.Use LR layout.Include signup, email verification, workspace provisioning,billing activation, support fallback, and success.Keep labels concise and production-ready.What to avoid
Section titled “What to avoid”Avoid prompts that:
- mix multiple diagram families at once
- ask for visual styling and architecture semantics in the same sentence
- omit failure cases
- omit the target syntax
Best workflow with agents
Section titled “Best workflow with agents”- generate first draft in text
- paste into Studio
- apply to canvas
- fix structure and styling visually
- export in the format your team needs
The secret to perfect AI generation is our llms.txt file. We host a machine-readable set of rules that teaches any AI exactly how to write OpenFlow DSL V2 code.
When prompting an AI agent, just include a reference to this file.
Example Prompt for Cursor IDE
Section titled “Example Prompt for Cursor IDE”Open your Composer or Chat window and type:
"Read https://openflowkit.com/llms.txt and then generate an architecture diagram showing our Next.js frontend connecting to a Supabase backend."
Example Prompt for ChatGPT
Section titled “Example Prompt for ChatGPT”If you are using ChatGPT with web-browsing enabled:
"Go to https://openflowkit.com/llms.txt to learn the OpenFlowKit syntax. Then, write a flowchart detailing an OAuth2 login sequence. Output the result using the \“openflow code block.”`
Best Practices for Prompting
Section titled “Best Practices for Prompting”Even with the rules, LLMs can sometimes get confused. Here are three tips for perfect diagrams every time:
- Be specific about shapes: Instead of just saying “add a database”, say “add a Node with the
[process]type labeled ‘Database’”. - Name your connections: The diagram is much more useful if edges have labels. Example: “Connect the frontend to the backend with the label ‘|REST API|’”.
- Use Groups for clarity: If you have multiple microservices, tell the AI to wrap them in a group: “Put the ‘Auth Service’ and ‘User DB’ inside a group called ‘Backend Infrastructure’.”