Co-Pilot / 辅助式
更新于 a month ago

draw-mcp

Eekusiadadus
0.0k
ekusiadadus/draw-mcp
78
Agent 评分

💡 摘要

生成高质量的 draw.io 图表,具有字体管理和日文支持等功能。

🎯 适合人群

需要图表生成的软件开发人员可视化工作流程的项目经理创建文档的技术写作者设计教学材料的教育工作者映射用户流程的 UX/UI 设计师

🤖 AI 吐槽:该项目可能通过外部依赖和 PNG 生成的 shell 执行暴露风险。确保验证和清理输入以减轻潜在的命令注入漏洞。

安全分析中风险

该项目可能通过外部依赖和 PNG 生成的 shell 执行暴露风险。确保验证和清理输入以减轻潜在的命令注入漏洞。

Claude Skill: draw.io Diagram Generator

A Claude Code skill for generating high-quality draw.io diagrams with proper font settings, arrow placement, and Japanese text support.

Features

  • Font Management: Ensures fontFamily is set on all text elements
  • Arrow Layering: Correct Z-order placement (arrows behind boxes)
  • Japanese Text Support: Proper width allocation for CJK characters
  • PNG Validation: Pre-commit hooks for automatic PNG generation
  • Best Practices: Comprehensive checklist and examples

Installation

Plugin Installation (Recommended)

# Via Claude Code marketplace /plugin marketplace add ekusiadadus/draw-mcp # Or install directly /plugin add https://github.com/ekusiadadus/draw-mcp

Manual Installation

Clone to your Claude Code skills directory:

# Global (personal use) git clone https://github.com/ekusiadadus/draw-mcp ~/.claude/skills/draw-io # Project-specific git clone https://github.com/ekusiadadus/draw-mcp .claude/skills/draw-io

Usage

Once installed, Claude Code will automatically use this skill when you ask to create draw.io diagrams.

Example Prompts

Create a simple flowchart showing: Start -> Process -> End

Draw an architecture diagram with Web Server, API, and Database

Create a sequence diagram for user login flow

Manual Trigger

If needed, you can explicitly request the skill:

Using the draw-io skill, create a flowchart for the authentication process

Requirements

draw.io CLI (for PNG export)

macOS:

brew install --cask drawio

Linux: Download from draw.io Desktop Releases

Python (for tests and validation)

pip install pytest

Project Structure

draw-mcp/
├── .claude-plugin/
│   ├── plugin.json          # Plugin manifest
│   └── marketplace.json     # Marketplace configuration
├── skills/
│   └── draw-io/
│       ├── SKILL.md         # Main skill definition
│       ├── reference.md     # XML structure reference
│       ├── examples.md      # Production-ready examples
│       └── checklist.md     # Validation checklist
├── scripts/
│   └── convert-drawio-to-png.sh
├── tests/
│   └── test_drawio_skill.py
├── docs/
│   └── RULE.md
├── .pre-commit-config.yaml
├── .gitignore
├── LICENSE
└── README.md

Key Rules

1. Font Settings

<!-- In mxGraphModel --> <mxGraphModel defaultFontFamily="Noto Sans JP" ...> <!-- In EVERY text element --> <mxCell style="...fontFamily=Noto Sans JP;fontSize=18;..." />

2. Arrow Placement

Arrows must be declared FIRST in XML to render behind other elements:

<root> <!-- Arrows first (background) --> <mxCell id="arrow1" edge="1" ... /> <!-- Boxes after (foreground) --> <mxCell id="box1" vertex="1" ... /> </root>

3. Japanese Text Width

Allocate 30-40px per Japanese character:

<!-- 6 characters × 35px = 210px --> <mxGeometry width="220" ... />

4. PNG Verification

Always export to PNG and verify visually:

drawio -x -f png -s 2 -t -o diagram.png diagram.drawio

Pre-commit Hooks

This project includes pre-commit hooks for:

  1. XML Validation: Check font settings and structure
  2. PNG Conversion: Auto-generate PNG on commit
  3. Python Tests: Run skill validation tests

Setup:

pip install pre-commit pre-commit install

Running Tests

# Run all tests pytest tests/ -v # Run specific test file pytest tests/test_drawio_skill.py -v

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests: pytest tests/ -v
  5. Submit a pull request

License

MIT License - see LICENSE

Related Resources

Changelog

v1.0.0 (2025-12-16)

  • Initial release
  • Core skill with font, arrow, and text handling
  • Pre-commit hooks for validation
  • Comprehensive documentation and examples
五维分析
清晰度8/10
创新性7/10
实用性9/10
完整性8/10
可维护性7/10
优缺点分析

优点

  • 支持日文文本和正确的字体设置
  • 通过预提交钩子自动生成 PNG
  • 全面的文档和示例

缺点

  • 需要外部 draw.io CLI 进行 PNG 导出
  • 对初学者来说安装可能较复杂
  • 仅限于 draw.io 格式

相关技能

pytorch

S
toolCode Lib / 代码库
92/ 100

“它是深度学习的瑞士军刀,但祝你好运能从47种安装方法里找到那个不会搞崩你系统的那一个。”

agno

S
toolCode Lib / 代码库
90/ 100

“它承诺成为智能体领域的Kubernetes,但得看开发者有没有耐心学习又一个编排层。”

nuxt-skills

S
toolCo-Pilot / 辅助式
90/ 100

“这本质上是一份组织良好的小抄,能把你的 AI 助手变成一只 Nuxt 框架的复读机。”

免责声明:本内容来源于 GitHub 开源项目,仅供展示和评分分析使用。

版权归原作者所有 ekusiadadus.