跳到正文
Skillpedia
图片与图标58k · #3201

cli-anything-drawio

它能做什么

这个技能让你的智能体通过文本命令用 Draw.io 制作和修改图表。适合需要快速制作流程图或示意图的人。

适用场景

  • ✓当你想根据文字描述制作一个流程图的时候。
  • ✓当你想在现有图表中添加、移动或更改图形样式的时候。
  • ✓当你想把图表导出为文件的时候。

技能链接

https://github.com/HKUDS/CLI-Anything/blob/main/drawio/agent-harness/cli_anything/drawio/skills/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/HKUDS/CLI-Anything/blob/main/drawio/agent-harness/cli_anything/drawio/skills/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我画一个客户注册步骤的流程图,并把它导出为文件。”

每周 5 个新技能,1 分钟读完。

工作原理

这个技能会把每个图表保存为项目文件,并通过命令编辑图形、样式和布局。它使用 drawio 程序导出完成的图表。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

cli-anything-drawio

A CLI harness for Draw.io — create, edit, and export diagrams from the command line.

Installation

This CLI is installed as part of the cli-anything-drawio package:

pip install cli-anything-drawio

Prerequisites:

  • Python 3.10+
  • drawio must be installed on your system

Usage

Basic Commands

# Show help
cli-anything-drawio --help

# Start interactive REPL mode
cli-anything-drawio

# Create a new project
cli-anything-drawio project new -o project.json

# Run with JSON output (for agent consumption)
cli-anything-drawio --json project info -p project.json

REPL Mode

When invoked without a subcommand, the CLI enters an interactive REPL session:

cli-anything-drawio
# Enter commands interactively with tab-completion and history

Command Groups

Project

Project management: new, open, save, info.

Command Description
new Create a new blank diagram
open Open an existing .drawio project file
save Save the current project
info Show detailed project information
xml Print the raw XML of the current project
presets List available page size presets

Shape

Shape operations: add, remove, move, resize, style.

Command Description
add Add a shape to the diagram
remove Remove a shape by ID
list List all shapes on a page
label Update a shape's label text
move Move a shape to new coordinates
resize Resize a shape
style Set a style property on a shape
info Show detailed info about a shape
types List all available shape types

Connect

Connector operations: add, remove, style.

Command Description
add Add a connector between two shapes
remove Remove a connector by ID
label Update a connector's label
style Set a style property on a connector
list List all connectors on a page
styles List available edge styles

Page

Page operations: add, remove, rename, list.

Command Description
add Add a new page
remove Remove a page by index
rename Rename a page
list List all pages

Export

Export operations: render to PNG, PDF, SVG.

Command Description
render Export the diagram to a file
formats List available export formats

Session

Session management: status, undo, redo.

Command Description
status Show current session status
undo Undo the last operation
redo Redo the last undone operation
save-state Save session state to disk
list List all saved sessions

Examples

Create a New Project

Create a new drawio project file.

cli-anything-drawio project new -o myproject.json
# Or with JSON output for programmatic use
cli-anything-drawio --json project new -o myproject.json

Interactive REPL Session

Start an interactive session with undo/redo support.

cli-anything-drawio
# Enter commands interactively
# Use 'help' to see available commands
# Use 'undo' and 'redo' for history navigation

Export Project

Export the project to a final output format.

cli-anything-drawio --project myproject.json export render output.pdf --overwrite

State Management

The CLI maintains session state with:

  • Undo/Redo: Up to 50 levels of history
  • 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 (--json flag): Structured JSON for agent consumption
# Human output
cli-anything-drawio project info -p project.json

# JSON output for agents
cli-anything-drawio --json project info -p project.json

For AI Agents

When using this CLI programmatically:

  1. Always use --json flag for parseable output
  2. Check return codes - 0 for success, non-zero for errors
  3. Parse stderr for error messages on failure
  4. Use absolute paths for all file operations
  5. Verify outputs exist after export operations

More Information

  • Full documentation: See README.md in the package
  • Test coverage: See TEST.md in the package
  • Me
常见问题

我需要安装 Draw.io 吗?

需要,你的系统中必须安装 drawio 程序。

它可以显示图表的原始代码吗?

可以,它可以打印当前图表的原始 XML。

我可以选择页面大小吗?

可以,这个技能列出了可供选择的页面大小预设。

详情

作者的原始描述

Command-line interface for Drawio - A CLI harness for **Draw.io** — create, edit, and export diagrams from the command line....

repo: HKUDS/CLI-Anything

热度

GitHub 星标
58k
排名
#3201
许可证
Apache-2.0
更新时间
2026/9/21

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能