# 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](https://github.com/lukendeasy/open-diagram/blob/main/AGENTS.md) is a different file: it is for agents that change the open-diagram library itself.

## What do I paste?

Paste this block, as it is, anywhere in the file.

```markdown
## 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 `draw` a path without an extension: `open-diagram draw FILE -o docs/diagrams/NAME`. `draw` makes the folder if it does not exist.
- To draw PNG files, the computer needs Chrome, Chromium or Edge. Without one, `draw` writes the SVG only.
- If the agent has the MCP server, it can call the `check`, `describe` and `draw` tools in place of the commands. [MCP tools](https://open-diagram.dev/for-agents/mcp-tools.md) gives their arguments.

Updated November 25, 2026. Web page: https://open-diagram.dev/for-agents/agents-md-block.html

See also:

- [The open-diagram format guide, as the MCP server returns it](https://open-diagram.dev/for-agents/format-guide.md)
- [open-diagram layout problem messages and their fixes](https://open-diagram.dev/for-agents/layout-problem-messages.md)
- [Draw architecture diagrams with Claude Code and an MCP server](https://open-diagram.dev/guides/draw-diagrams-with-claude-code.md)
