Guide · Agent skill
How to use the Mermaid Diagram CLI agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The Mermaid Diagram CLI agent skill teaches an AI agent to build Mermaid diagrams such as flowcharts and sequence diagrams through a command-line tool called cli-anything-mermaid, instead of through the Mermaid Live Editor website. This guide explains what agent skills are, how to install this one, how to ask for it in plain language, and what to watch for on privacy and network use. By the end you will be able to set up the skill, run a render, and know when it is the right tool.
Quick start
- 1Check Python. Confirm you have Python 3.10 or newer installed before you begin.
- 2Install the package. Run pip install cli-anything-mermaid to install the command-line tool.
- 3Install the skill. Download the ZIP from this page and unzip it into ~/.claude/skills/ or a project's .claude/skills/ folder, or upload it under Settings → Capabilities → Skills in the Claude apps.
- 4Create a project. Run cli-anything-mermaid project new -o diagram.json, optionally with a sample preset such as flowchart or sequence.
- 5Set the diagram source. Use diagram set with --text or --file to add your Mermaid code to the project.
- 6Render the output. Run export render with an output filename and --format svg or --format png, then confirm the file exists.
What an agent skill is and what this one does
An agent skill is a folder containing a SKILL.md file that gives an AI agent instructions for a specific task. When the skill is installed, the agent can read those instructions and use the tool they describe.
This skill teaches the agent to use cli-anything-mermaid, a command-line interface for Mermaid Live Editor. It lets the agent create a stateful project file, set the diagram source text, undo and redo changes, render the diagram to SVG or PNG through the mermaid.ink renderer, and generate a Mermaid Live Editor URL for sharing.
Install the Mermaid skill
You can install the skill in either of two ways. Download the ZIP from this page and unzip it into ~/.claude/skills/ for a personal install, or into a project's .claude/skills/ folder to limit it to that project. Alternatively, in the Claude apps, upload the ZIP under Settings → Capabilities → Skills.
The CLI itself is a separate Python package. The source gives this install command and prerequisites.
- Python 3.10 or newer is required.
- No other external software is required, because rendering uses the mermaid.ink cloud service.
pip install cli-anything-mermaidTrigger the skill with natural requests
You do not need to name the tool. Ask for a diagram in plain language, describing the type of diagram and its content. The agent should recognise that the task matches the skill's purpose of generating flowcharts, sequence diagrams and other visualisations without a GUI.
Good requests state what you want drawn, the format you need, and where the file should go. For example: create a flowchart of our login process showing the steps from request to session, render it as SVG, and save it in the docs folder.
- Name the diagram type, such as flowchart or sequence diagram.
- Describe the nodes and the order of steps or messages.
- Say whether you need SVG or PNG output and the output path.
Run the CLI directly
You can also run the commands yourself. Check the help, then create a project, set the diagram text and render it. The source shows these basic commands.
Project commands handle the lifecycle of a file: new, open, save, info and samples. Diagram commands set or show the Mermaid source. Export commands render or share. Session commands show status and handle undo and redo.
- cli-anything-mermaid --help shows help.
- cli-anything-mermaid starts an interactive REPL with tab-completion and history.
- cli-anything-mermaid --json project info returns JSON output for agent use.
cli-anything-mermaid --help
cli-anything-mermaid project new -o diagram.json
cli-anything-mermaid --project flow.json diagram set --text "graph TD; A-->B; B-->C;"
cli-anything-mermaid --project flow.json export render output.svg --format svgExamples: flowchart, sequence diagram and sharing
To make a flowchart, start from the flowchart sample, set the source text and render to SVG. To make a sequence diagram, start from the sequence sample, load the source from a .mmd file and render to PNG. To share, generate either an editable or a view-only Mermaid Live URL.
The interactive REPL can run the same steps one line at a time.
- Sequence diagram source can be set from a file with diagram set --file.
- Use export share --mode edit for an editable link or --mode view for a view-only link.
cli-anything-mermaid project new --sample sequence -o seq.json
cli-anything-mermaid --project seq.json diagram set --file my_diagram.mmd
cli-anything-mermaid --project seq.json export render output.png --format png
cli-anything-mermaid --project flow.json export share --mode viewSafety notes: scripts, network and private diagrams
This skill runs scripts and uses the network. Rendering and sharing send your diagram source to the external mermaid.ink service and to Mermaid Live Editor. Do not use it for confidential architecture or data, and do not use it in offline or air-gapped environments, because rendering depends on the cloud service.
The skill's own guidance for agents also matters. It says to use absolute paths for file operations and to verify that outputs exist after rendering.
- Assume any diagram source you render or share leaves your machine.
- Keep private system designs out of this workflow.
- Review the commands the agent runs before approving them.
Tips for reliable results
Use the --json flag when an agent or script reads the output, and check return codes, where 0 means success and non-zero means an error. On failure, read stderr for the error message. Undo and redo let you step back if a source change is wrong, and project files keep state between sessions.
- Always use --json for parseable output.
- Check return codes after each command.
- Parse stderr when a command fails.
- Use absolute paths for all file operations.
- Confirm the output file exists after rendering.
What people use it for
- Generating a flowchart of a process for a technical document from a text description.
- Rendering a sequence diagram of API calls as a PNG image for a design review.
- Creating and editing diagram source inside an automated documentation workflow, with undo if a change is wrong.
- Producing a Mermaid Live Editor link so a colleague can open and edit a diagram.
Frequently asked questions
How do I install the Mermaid CLI agent skill?
Download the ZIP from this page and unzip it into ~/.claude/skills/ for a personal install, or into a project's .claude/skills/ folder. You can also upload the ZIP in the Claude apps under Settings → Capabilities → Skills. The CLI itself is installed separately with pip install cli-anything-mermaid.
What do I need to run cli-anything-mermaid?
You need Python 3.10 or newer and the pip package cli-anything-mermaid. Rendering uses the mermaid.ink cloud service, so you also need internet access for SVG or PNG output. No other external software is required according to the source.
Is the Mermaid CLI skill free?
The source does not state pricing or licence terms for this skill. The directory listing gives its licence as Apache-2.0, so check that licence for the terms that apply to you.
Is my diagram private when I render it?
Not necessarily. Rendering and sharing send the diagram source to the external mermaid.ink service and Mermaid Live Editor. Avoid this workflow for confidential architecture or data.
Can I use this offline?
No. Rendering depends on the mermaid.ink cloud service, so the skill does not suit offline or air-gapped environments.
How is this different from using the Mermaid Live Editor website?
This skill works through text and commands, so an agent or script can create, edit, undo and render diagrams repeatedly without a browser. The Mermaid Live Editor is a website, and the skill is not a full drag-and-drop visual editor.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
This skill suits developers, technical writers and anyone who wants repeatable, scripted Mermaid diagrams rendered to SVG or PNG. Choose a different tool if your diagrams are confidential, you must work offline, or you need a drag-and-drop visual editor.
Download the skill