cli-anything-mermaid
它能做什么
这个技能让 AI 智能体以 Mermaid 格式制作流程图、时序图等图表。适合希望用纯文本制作清晰图示的人。
适用场景
- ✓当你想制作一张展示流程或决策如何运作的流程图的时候。
- ✓当你需要一张展示人与人或系统之间消息传递的时序图的时候。
- ✓当你想修改现有图表文件并渲染出新图片的时候。
技能链接
https://github.com/HKUDS/CLI-Anything/blob/main/mermaid/agent-harness/cli_anything/mermaid/skills/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我做一张流程图,展示客户订单从下单到送达的过程。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体把图表写成文本,保存在项目文件中,并通过在线渲染器生成渲染图片的链接。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
cli-anything-mermaid
Create, edit, and render Mermaid diagrams via stateful project files and the mermaid.ink renderer. Designed for AI agents and power users who need to generate flowcharts, sequence diagrams, and other visualizations without a GUI.
Installation
This CLI is installed as part of the cli-anything-mermaid package:
pip install cli-anything-mermaid
Prerequisites:
- Python 3.10+
- No external software required (rendering uses mermaid.ink cloud service)
Usage
Basic Commands
# Show help
cli-anything-mermaid --help
# Start interactive REPL mode
cli-anything-mermaid
# Create a new project
cli-anything-mermaid project new -o diagram.json
# Run with JSON output (for agent consumption)
cli-anything-mermaid --json project info
REPL Mode
When invoked without a subcommand, the CLI enters an interactive REPL session:
cli-anything-mermaid
# Enter commands interactively with tab-completion and history
Command Groups
Project
Project lifecycle commands.
| Command | Description |
|---|---|
new |
Create a new Mermaid project with optional sample preset and theme |
open |
Open an existing Mermaid project file |
save |
Save the current project to a file |
info |
Show current project information |
samples |
List available sample diagram presets |
Diagram
Diagram source manipulation commands.
| Command | Description |
|---|---|
set |
Replace the Mermaid source text (inline or from file) |
show |
Print the current Mermaid source code |
Export
Render and share commands.
| Command | Description |
|---|---|
render |
Render the diagram to SVG or PNG via mermaid.ink |
share |
Generate a Mermaid Live Editor URL for sharing |
Session
Session state commands.
| Command | Description |
|---|---|
status |
Show current session state |
undo |
Undo the last diagram source change |
redo |
Redo the last undone change |
Examples
Create and Render a Flowchart
# Create a project with flowchart sample
cli-anything-mermaid project new --sample flowchart -o flow.json
# Replace diagram source
cli-anything-mermaid --project flow.json diagram set --text "graph TD; A-->B; B-->C;"
# Render to SVG
cli-anything-mermaid --project flow.json export render output.svg --format svg
Create a Sequence Diagram
# Create project with sequence sample
cli-anything-mermaid project new --sample sequence -o seq.json
# Set diagram from file
cli-anything-mermaid --project seq.json diagram set --file my_diagram.mmd
# Render to PNG
cli-anything-mermaid --project seq.json export render output.png --format png
Share a Diagram
# Generate an editable Mermaid Live URL
cli-anything-mermaid --project flow.json export share --mode edit
# Generate a view-only URL
cli-anything-mermaid --project flow.json export share --mode view
Interactive REPL Session
cli-anything-mermaid
# new flowchart
# set graph TD; A-->B; B-->C;
# render output.svg
# share
# quit
State Management
The CLI maintains session state with:
- Undo/Redo: Revert or replay diagram source changes
- Project persistence: Save/load project state as JSON
- Session tracking: Track modifications and changes
Output Formats
All commands support dual output modes:
- Human-readable (default): Tables, colors, formatted text
- Machine-readable (
--jsonflag): Structured JSON for agent consumption
# Human output
cli-anything-mermaid project info
# JSON output for agents
cli-anything-mermaid --json project info
For AI Agents
When using this CLI programmatically:
- Always use
--jsonflag for parseable output - Check return codes - 0 for success, non-zero for errors
- Parse stderr for error messages on failure
- Use absolute paths for all file operations
- Verify outputs exist after render operations
More Information
- Full documentation: See README.md in the package
- Test coverage: See TEST.md in the package
- Methodology: See HARNESS.md in the cli-anything-plugin
Version
1.0.0
常见问题
我需要手动画图吗?
不需要。你用日常语言描述步骤,智能体会为你编写图表文本。
渲染需要额外的软件吗?
不需要。该技能说明渲染使用云服务,因此除 Python 外无需其他软件。
我可以保存图表并在以后修改吗?
可以。图表保存在项目文件中,可以再次打开和编辑。
详情
作者的原始描述
Command-line interface for Mermaid Live Editor - Create, edit, and render Mermaid diagrams via stateful project files and mermaid.ink renderer URLs. Designed for AI agents and power users who need to generate flowcharts, sequence diagrams, and other visualizations without a GUI.
repo: HKUDS/CLI-Anything
热度
- GitHub 星标
- 58k
- 排名
- #3223
- 许可证
- Apache-2.0
- 更新时间
- 2026/9/21
评论
- …
同一仓库的更多技能
cli-anything-3mf
58k帮你的智能体检查和修复 3D 打印文件,包括查找圆孔、调整孔径、修复网格,以及比较两个文件。
cli-anything-qgis
58k帮你的智能体在终端中打开、编辑和导出 QGIS 地图项目,包括图层、要素、打印布局和处理工具。
cli-anything-adguardhome
58k帮你的智能体管理 AdGuard Home,这是一款全网络广告拦截器,可管理过滤规则、DNS 重写、客户端和查询日志。
cli-anything-anygen
58k帮你的智能体借助 AnyGen 服务,根据文字提示生成幻灯片、文档、网站和图表。