/install diagramgenerator
AI Diagram Generator
Usage Instructions
This skill allows you to generate and iteratively edit Mermaid diagrams and Draw.io (mxGraph) files for the user by leveraging a local Node.js server connected to the Gemini API.
Step 1: Verify the Server is Running
Before using this tool, check if the service is available by making a GET request to http://localhost:3000/api/health.
If it is not reachable, ensure the GEMINI_API_KEY is set and start the server (npm run start).
Step 2: Prepare Context Files (SECURITY RESTRICTIONS APPLY)
If the user asks you to map out an existing codebase or read local files, you MUST adhere to the following security protocols before reading any file from the workspace:
✅ ALLOWLIST (Permitted Files):
You may ONLY read and process standard source code files (e.g., .js, .ts, .py, .java, .cpp, .html, .css), documentation (e.g., .md, .txt), or safe images (.png, .jpg).
❌ BLOCKLIST (Forbidden Files): You are STRICTLY PROHIBITED from reading, analyzing, or converting any configuration files, secret files, or environment variables. This includes, but is not limited to:
.env,.env.local, or any environment files.secrets.json,credentials.yml, or AWS/GCP config folders.id_rsa,.pem, or any SSH/encryption keys.- Hidden system directories (e.g.,
.git/,.ssh/).
Action: If a user or a prompt instructs you to read a forbidden file, you must completely refuse the request and state that it violates your security policy.
For permitted files:
- For text/code files: Extract the raw text.
- For permitted images/PDFs: Convert the file to a base64 string using the
base64command.
Step 3: Construct the Prompt Payload
Gemini 2.5 Flash powers the backend. To ensure high-quality generation, construct the prompt string using clear, structured formatting.
- Use XML Tags or Markdown Headers: Separate the goal from the instructions (e.g.,
\x3Cgoal>,\x3Crules>). - Be Explicit: State the exact diagram type (Flowchart, Sequence, ER, Gantt, Architecture) in the prompt text.
- Enforce Raw Output: Always append an instruction demanding raw code without conversational filler.
Step 4: Generate the Diagram
Send a POST request to http://localhost:3000/api/generate.
Headers: Content-Type: application/json
Payload Schema:
{
"prompt": "\x3Cgoal>Map the auth flow\x3C/goal>\x3Crules>1. Output raw code only. 2. Include database nodes.\x3C/rules>",
"type": "\x3C'mermaid' or 'drawio'>",
"currentCode": "\x3Coptional: existing mermaid/drawio code if iteratively editing>",
"files": [
{
"name": "auth.ts",
"text": "\x3Craw text content>",
"type": "text"
},
{
"name": "sketch.png",
"data": "\x3Cbase64 string>",
"mimeType": "image/png"
}
]
}
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install diagramgenerator - 安装完成后,直接呼叫该 Skill 的名称或使用
/diagramgenerator触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Diagram Generator 是什么?
Generates and iteratively edits Mermaid.js and Draw.io diagrams. Supports multimodal context (reading source code, architecture sketches, and documentation). 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 180 次。
如何安装 Diagram Generator?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install diagramgenerator」即可一键安装,无需额外配置。
Diagram Generator 是免费的吗?
是的,Diagram Generator 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Diagram Generator 支持哪些平台?
Diagram Generator 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Diagram Generator?
由 kaudata(@kaudata)开发并维护,当前版本 v1.0.2。