An AGENTS.md block for drawing diagrams with open-diagram
This page is for people who set up coding agents. AGENTS.md (or CLAUDE.md) is a file of instructions for coding agents, kept in your project. The library's own AGENTS.md is a different file: it is for agents that change the open-diagram library itself.
Updated
What do I paste?
Paste this block, as it is, anywhere in the file.
## Diagrams
This project draws its diagrams with open-diagram.
- Install it with `pip install open-diagram`.
- Without installing, put `uvx` in front of each command: `uvx open-diagram check FILE`.
- FILE is `.json`, `.mmd` (Mermaid), or `.py` (a script whose `build()` returns a `Diagram`).
Docs, as Markdown:
- Format guide: https://open-diagram.dev/for-agents/format-guide.md
- JSON: https://open-diagram.dev/docs/json.md
- Python: https://open-diagram.dev/docs/python.md
- Mermaid: https://open-diagram.dev/docs/mermaid.md
- Layout problems: https://open-diagram.dev/problems.md
- All docs in one file: https://open-diagram.dev/llms-full.txt
For each diagram:
1. Run `open-diagram check FILE`.
2. Fix every problem it names.
3. Run the check again. Repeat until it reports `0 layout problem(s)`.
4. Run `open-diagram describe FILE`. Compare the text with the request.
5. Run `open-diagram draw FILE`. It writes the SVG and PNG next to FILE.
6. Tell the user where the SVG and PNG are.How do I change the block for my project?
Edit the lines that differ in your project.
- To write the SVG and PNG to another place, give
drawa path without an extension:open-diagram draw FILE -o docs/diagrams/NAME.drawmakes the folder if it does not exist. - To draw PNG files, the computer needs Chrome, Chromium or Edge. Without one,
drawwrites the SVG only. - If the agent has the MCP server, it can call the
check,describeanddrawtools in place of the commands. MCP tools gives their arguments.