Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Ai Generation

БесплатноБез исполняемых скриптовНе проверен

AI-powered diagram generation using draw.io's built-in AI features and LLM integration

TheLobbiот TheLobbi★ 22 звезды на GitHub

Об этом скилле

AI-Powered Diagram Generation

draw.io Built-in AI Generate Tool

draw.io includes a native AI diagram generation feature accessible from the editor.

Accessing the AI Generator

  1. Open draw.io (app.diagrams.net or desktop)
  2. Click Extras > AI Diagram or the AI icon in the toolbar
  3. Enter a natural language prompt
  4. Select the AI model/provider
  5. Click Generate

Supported AI Models

Provider Models Notes
Google Gemini 2.0 Flash, 2.5 Pro, 2.5 Flash Free tier available
Anthropic Claude 3.7 Sonnet, 4.0 Sonnet, 4.5 Sonnet Requires API key
OpenAI GPT 4o, 4.1, 4.1-mini, 5.1 Requires API key

Configuration

Configure AI in draw.io via Extras > Configuration (JSON editor):

{
  "enableAi": true,
  "gptApiKey": "sk-...",
  "geminiApiKey": "AIza...",
  "claudeApiKey": "sk-ant-...",
  "defaultAiModel": "claude-sonnet-5"
}

Or set via URL parameters:

https://app.diagrams.net/?enableAi=1

AI Actions

Action Description
createPublic Generate a new public diagram from prompt
create Generate a new diagram (private)
update Modify an existing diagram based on instructions
assist Get suggestions for improving the current diagram

Custom LLM Backend

Point draw.io to a custom/self-hosted LLM endpoint:

{
  "enableAi": true,
  "aiBaseUrl": "https://your-llm-proxy.example.com/v1",
  "aiApiKey": "your-key",
  "aiModel": "your-model-name"
}

The endpoint must be compatible with the OpenAI Chat Completions API format.


AI Diagram Generation Best Practices

Use Simplified mxGraphModel Format

When generating diagrams via LLM, always use the simplified format without the mxfile wrapper. This reduces complexity and error rates:

<!-- CORRECT: Simplified format for AI generation -->
<mxGraphModel>
  <root>
    <mxCell id="0"/>
    <mxCell id="1" parent="0"/>
    <!-- diagram content -->
  </root>
</mxGraphModel>
<!-- AVOID: Full mxfile wrapper adds unnecessary complexity -->
<mxfile host="..." modified="..." agent="..." version="..." type="...">
  <diagram id="..." name="...">
    <mxGraphModel dx="..." dy="..." grid="..." ...>
      <root>
        <!-- diagram content -->
      </root>
    </mxGraphModel>
  </diagram>
</mxfile>

Always Include Structural Cells

Every generated diagram must start with the two mandatory structural cells:

<mxCell id="0"/>                <!-- Root cell -->
<mxCell id="1" parent="0"/>     <!-- Default layer -->

Omitting these causes the diagram to fail to load.

Use Uncompressed XML

Always output uncompressed, human-readable XML. Never generate the base64-compressed format that draw.io uses internally for storage. draw.io imports uncompressed XML without issue.

Reference Valid Style Properties

Only use documented style property names. Common mistakes:

Wrong Correct
fill fillColor
stroke strokeColor
color fontColor
border strokeWidth
background fillColor
bold fontStyle=1
italic fontStyle=2
font-size fontSize
text-align align
border-radius rounded=1;arcSize=N;

Ensure Unique IDs

Every cell must have a unique id. Use descriptive IDs for clarity:

<!-- GOOD: Descriptive IDs -->
<mxCell id="api-gateway" value="API Gateway" .../>
<mxCell id="auth-service" value="Auth Service" .../>
<mxCell id="edge-gw-to-auth" edge="1" source="api-gateway" target="auth-service" .../>

<!-- ACCEPTABLE: Sequential IDs -->
<mxCell id="2" value="API Gateway" .../>
<mxCell id="3" value="Auth Service" .../>
<mxCell id="e1" edge="1" source="2" target="3" .../>

<!-- BAD: Duplicate IDs -->
<mxCell id="node" value="API Gateway" .../>
<mxCell id="node" value="Auth Service" .../>  <!-- DUPLICATE -->

Match Perimeter to Shape

When using non-rectangular shapes, set the matching perimeter:

Shape Required Perimeter
shape=ellipse perimeter=ellipsePerimeter
shape=rhombus perimeter=rhombusPerimeter
shape=hexagon perimeter=hexagonPerimeter2
shape=triangle perimeter=trianglePerimeter
shape=parallelogram perimeter=parallelogramPerimeter
shape=trapezoid perimeter=trapezoidPerimeter
shape=step perimeter=stepPerimeter

Mismatched perimeters cause connection points to appear in wrong positions.


Prompt Engineering for Diagram Generation

Effective Prompt Structure

A good diagram generation prompt includes:

  1. Diagram type: Explicitly state what kind of diagram
  2. Entities/components: List the key elements
  3. Relationships: Describe how elements connect
  4. Style preferences: Colors, themes, layout direction
  5. Detail level: High-level overview vs. detailed implementation

Example Prompts

System Archi

Полный SKILL.md на GitHub

Установить Ai Generation в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Ai Generation?

AI-powered diagram generation using draw.io's built-in AI features and LLM integration

Как установить скилл Ai Generation?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Ai Generation запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Ai Generation с