Agent skill that turns natural language, code, Terraform/K8s, SQL, OpenAPI, AsyncAPI, Protobuf and GraphQL sources into editable, tested draw.io architecture diagrams: incremental sync, multi-view projection, drift diff, CI architecture tests, whiteboard derasterize, interactive HTML/PPTX/Mermaid exports.
Python agent-skillsarchitecturearchitecture-diagramasyncapibpmnc4-modelclaude-codediagramdiagrams-as-codedrawioflowchartgithub-actionsgraphqlimage-to-diagramkubernetesmcp-serverprotobufsysmlterraformuml
refactor: restructure for 365-skills umbrella submodule
Agents365-ai265b4f324c23
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsondeleted file mode 100644index ada7354..0000000--- a/.claude-plugin/marketplace.json+++ /dev/null@@ -1,32 +0,0 @@-{- "name": "365-skills",- "owner": {- "name": "Agents365-ai"- },- "metadata": {- "description": "Production-grade Claude Code skills"- },- "plugins": [- {- "name": "drawio",- "source": "./plugins/drawio",- "description": "Draw.io diagrams — generates .drawio XML, exports to PNG/SVG/PDF via local CLI, with visual review loop and editable embedded XML",- "version": "1.5.0",- "author": {- "name": "Agents365-ai"- },- "repository": "https://github.com/Agents365-ai/drawio-skill",- "license": "MIT",- "keywords": [- "drawio",- "diagram",- "flowchart",- "architecture",- "visualization",- "uml",- "erd",- "sequence"- ]- }- ]-}diff --git a/README.md b/README.mdindex 2fa90a3..be91da0 100644--- a/README.md+++ b/README.md@@ -143,7 +143,7 @@ xvfb-run -a drawio --version```bash# Plugin marketplace (recommended)-# In Claude Code: /plugin marketplace add Agents365-ai/drawio-skill+# In Claude Code: /plugin marketplace add Agents365-ai/365-skills# Then: /plugin install drawio# Manual global installdiff --git a/README_CN.md b/README_CN.mdindex 6c01563..1a8fc24 100644--- a/README_CN.md+++ b/README_CN.md@@ -143,7 +143,7 @@ xvfb-run -a drawio --version```bash# 插件市场安装(推荐)-# 在 Claude Code 中输入:/plugin marketplace add Agents365-ai/drawio-skill+# 在 Claude Code 中输入:/plugin marketplace add Agents365-ai/365-skills# 然后:/plugin install drawio# 手动全局安装(所有项目可用)diff --git a/evals/trigger_eval.json b/evals/trigger_eval.jsonnew file mode 100644index 0000000..b2337b0--- /dev/null+++ b/evals/trigger_eval.json@@ -0,0 +1,82 @@+[+ {+ "query": "i'm presenting our new microservices architecture to the eng leadership team next thursday and need a clean diagram with the api gateway, auth service, payment service, kafka, and the postgres + redis stores. can you put it in ./docs/arch/ as both png and the editable drawio file?",+ "should_trigger": true+ },+ {+ "query": "我刚把后端从单体拆成了 3 个服务(user / order / catalog),用 grpc 互相调用,rabbitmq 做异步,前端是 nextjs。能画一张架构图吗?保存到当前目录就行",+ "should_trigger": true+ },+ {+ "query": "we're writing the technical appendix for our IEEE submission and the reviewer asked for a clearer figure of our model — it's a transformer encoder (12 layers) feeding into a contrastive head plus a classification head, with a frozen vision tower as input. need svg for latex",+ "should_trigger": true+ },+ {+ "query": "could you put together an ER diagram for the new posts/comments/users schema? users have many posts, posts have many comments (cascade delete), and there's a likes join table between users and posts. PK on id, FK on author_id",+ "should_trigger": true+ },+ {+ "query": "we need a flowchart of the refund decision logic: check if order < 30 days old, if yes auto-approve under 50 USD else route to manager; if older deny unless customer is gold tier. needs to go in the runbook as a PDF",+ "should_trigger": true+ },+ {+ "query": "draw a sequence diagram for the OAuth2 PKCE flow we're implementing — client, auth server, resource server, with the code_verifier/code_challenge dance",+ "should_trigger": true+ },+ {+ "query": "okay so my coworker's been complaining she can't visualize how the data flows in our pipeline. we ingest from kafka -> spark structured streaming -> s3 raw -> dbt models -> snowflake -> looker. can u sketch this out for her?",+ "should_trigger": true+ },+ {+ "query": "我需要给老板讲一下我们 RAG pipeline 的架构:embedding 模型、向量库(qdrant)、检索器、reranker、LLM 调用层。最好分层画出来,导出 png",+ "should_trigger": true+ },+ {+ "query": "remember the style preset i saved as 'corporate-v2'? use it to draw a deployment diagram showing our k8s pods (api, worker, scheduler), services, and the postgres rds",+ "should_trigger": true+ },+ {+ "query": "i made some changes to my style preset — can we re-render the architecture diagram from yesterday with the new colors? the source is at ./diagrams/system.drawio",+ "should_trigger": true+ },+ {+ "query": "can you visualize this dataset i just loaded from /tmp/signups.csv? it's user signup counts per day for the last 6 months — i'm thinking a line chart with maybe a 7-day rolling average overlay",+ "should_trigger": false+ },+ {+ "query": "draw me a picture of a golden retriever sitting in a flower garden, late afternoon light, photorealistic 4k",+ "should_trigger": false+ },+ {+ "query": "我有一份 PDF 论文,里面有一张架构图,能不能帮我把它改写成 mermaid 代码?我们 readme 用 mermaid",+ "should_trigger": false+ },+ {+ "query": "explain how kubernetes pods, services, and deployments relate to each other — i'm prepping for a platform engineering interview tomorrow morning",+ "should_trigger": false+ },+ {+ "query": "i need a class diagram with these 4 classes — User, Order, Product, ShoppingCart. plantuml please, the team uses it for everything and we have it in CI",+ "should_trigger": false+ },+ {+ "query": "我需要画一张白板风格的草图来 brainstorm 这个产品流程,最好是手绘感觉的,方便分享给设计同事",+ "should_trigger": false+ },+ {+ "query": "i want to add a diagram to my open source project's README — must be text-defined, no binaries in the repo, git-friendly diff, render natively on github",+ "should_trigger": false+ },+ {+ "query": "我看到一个图标库 mxgraph.aws4 — drawio desktop 这个程序怎么从命令行直接装一个新的形状库?",+ "should_trigger": false+ },+ {+ "query": "convert this PNG screenshot at ~/Desktop/old-org-chart.png into editable drawio XML so I can modify the boxes — basically OCR + reverse extraction",+ "should_trigger": false+ },+ {+ "query": "我现在 vscode 里装了 hediet.vscode-drawio 这个插件,正在编辑 ./arch.drawio。能给我点建议怎么把鉴权那一层加进去吗?我自己来改",+ "should_trigger": false+ }+]diff --git a/plugins/drawio/hooks/hooks.json b/plugins/drawio/hooks/hooks.jsondeleted file mode 100644index 2fed838..0000000--- a/plugins/drawio/hooks/hooks.json+++ /dev/null@@ -1,3 +0,0 @@-{- "hooks": {}-}diff --git a/plugins/drawio/skills/drawio-skill/SKILL.md b/plugins/drawio/skills/drawio-skill/SKILL.mddeleted file mode 100644index cce4fe2..0000000--- a/plugins/drawio/skills/drawio-skill/SKILL.md+++ /dev/null@@ -1,456 +0,0 @@-----name: drawio-skill-description: Use when user requests diagrams, flowcharts, architecture charts, or visualizations. Also use proactively when explaining systems with 3+ components, complex data flows, or relationships that benefit from visual representation. Generates .drawio XML files and exports to PNG/SVG/PDF locally using the native draw.io desktop CLI.-license: MIT-homepage: https://github.com/Agents365-ai/drawio-skill-compatibility: Requires draw.io desktop app CLI on PATH (macOS/Linux/Windows). Self-check step requires a vision-enabled model (e.g., Claude Sonnet/Opus); gracefully skipped if unavailable.-platforms: [macos, linux, windows]-metadata: {"openclaw":{"requires":{"anyBins":["draw.io","drawio"]},"emoji":"📐","os":["darwin","linux","win32"],"install":[{"id":"brew-drawio","kind":"brew","formula":"drawio","bins":["draw.io"],"label":"Install draw.io via Homebrew","os":["darwin"]}]},"hermes":{"tags":["drawio","diagram","flowchart","architecture","visualization","uml"],"category":"design","requires_tools":["draw.io"],"related_skills":["mermaid","excalidraw","plantuml"]},"author":"Agents365-ai","version":"1.5.0"}------# Draw.io Diagrams--## Overview--Generate `.drawio` XML files and export to PNG/SVG/PDF/JPG locally using the native draw.io desktop app CLI.--**Supported formats:** PNG, SVG, PDF, JPG — no browser automation needed.--PNG, SVG, and PDF exports support `--embed-diagram` (`-e`) — the exported file contains the full diagram XML, so opening it in draw.io recovers the editable diagram. Use double extensions (`name.drawio.png`) to signal embedded XML.--## Bundled resources--When the workflow references one of these, read it on demand — none of them need to be in context up front.--| File | Read it when |-|---|---|-| `references/diagram-types.md` | The user names a specific diagram type (ERD, UML class, sequence, architecture, ML/DL, flowchart) |-| `references/style-presets.md` | The user asks to learn / save / list / set-default / delete a style preset, or you've resolved an active preset and need the application rules |-| `references/style-extraction.md` | You're inside the Learn flow and need the extraction procedure (called from `style-presets.md`) |-| `references/troubleshooting.md` | An export fails, vision rejects a PNG, or a rendering looks wrong |-| `scripts/repair_png.py` | After every `-e` PNG export — fixes draw.io's truncated IEND chunk (issue #8) |-| `scripts/encode_drawio_url.py` | The CLI is unavailable and you need a browser-fallback diagrams.net URL |--## Prerequisites--The draw.io desktop app must be installed and the CLI accessible:--```bash-# macOS (Homebrew — recommended)-brew install --cask drawio-draw.io --version--# macOS (full path if not in PATH)-/Applications/draw.io.app/Contents/MacOS/draw.io --version--# Windows-"C:\Program Files\draw.io\draw.io.exe" --version--# Linux-draw.io --version-```--Install draw.io desktop if missing:-- macOS: `brew install --cask drawio` or download from https://github.com/jgraph/drawio-desktop/releases-- Windows: download installer from https://github.com/jgraph/drawio-desktop/releases-- Linux: download `.deb`/`.rpm` from https://github.com/jgraph/drawio-desktop/releases — **do not use snap** (AppArmor sandbox denies secrets/keyring on servers, causes crash)--## Workflow--Before starting the workflow, assess whether the user's request is specific enough. If key details are missing, ask 1-3 focused questions:-- **Diagram type** — which preset? (ERD, UML, Sequence, Architecture, ML/DL, Flowchart, or general)-- **Output format** — PNG (default), SVG, PDF, or JPG?-- **Output location** — default is the user's working dir; honor any explicit path the user gives (e.g. "put it in `./artifacts/`"). Don't ask if they didn't mention one.-- **Scope/fidelity** — how many components? Any specific technologies or labels?--Skip clarification if the request already specifies these details or is clearly simple (e.g., "draw a flowchart of X").--0. **Update check (notify, don't pull)** — first use per conversation. Throttle to once per 24 h via `<this-skill-dir>/.last_update`; never mutate the skill directory without explicit user consent.-- - If `.last_update` exists and is <24 h old, skip this step entirely.- - Otherwise, fetch the latest tag from upstream:- ```bash- git -C <this-skill-dir> ls-remote --tags origin 'v*' 2>/dev/null \- | awk '{print $2}' | sed 's|refs/tags/||' | sort -V | tail -1- ```- - Compare with this skill's `metadata.version` from the frontmatter. If the upstream tag is strictly newer (semver), tell the user one line and ask:- > "A newer version of this skill is available: vX.Y.Z → vA.B.C. Want me to `git pull`?"-- If they say yes, run `git -C <this-skill-dir> pull --ff-only`. Refresh `.last_update` either way so the prompt doesn't repeat for 24 hours.- - If upstream is the same or older, refresh `.last_update` silently and continue.- - On any failure (offline, not a git checkout — e.g. ClawHub-installed copy, read-only path, no permission), swallow the error silently and continue with the user's task. Do not mention the failure.--**Step 0.5 — Resolve active preset.** Determine which (if any) user-defined style preset applies to this generation.--- Scan the user's message for a phrase that clearly names a style preset: "use my `<name>` style", "with my `<name>` style", "in `<name>` mode", "in the style of `<name>`". A bare `with <name>` does **not** count — "draw a diagram with redis" names a component, not a style. If a clear match is found → active preset = `<name>`.-- Else, check `~/.drawio-skill/styles/` for any file with `"default": true`. If found → active preset = that one.-- Else → no preset active; fall through to the built-in color/shape/edge conventions for the rest of the workflow.--Load the preset JSON from `~/.drawio-skill/styles/<name>.json`, falling back to `<this-skill-dir>/styles/built-in/<name>.json`. If the named preset exists in neither location, tell the user the name is unknown, list the available presets (user dir + built-in), and stop — do **not** silently fall back to defaults.--When a preset loads successfully, mention it in the first line of the reply: *"Using preset `<name>` (confidence: `<level>`)."* See the **Applying a preset** subsection below for how the preset changes color/shape/edge/font decisions.--1. **Check deps** — verify `draw.io --version` succeeds; note platform for correct CLI path-2. **Plan** — identify shapes, relationships, layout (LR or TB), group by tier/layer-3. **Generate** — write `.drawio` XML file to disk. Default output dir is the user's working dir; if the user specified an output path or directory (e.g. `./artifacts/`, `docs/images/`), use that instead — `mkdir -p` the target dir first. Apply the same dir choice to PNG/SVG/PDF exports in steps 4 and 7.-4. **Export draft** — run CLI to produce a preview PNG. **Do NOT pass `-e`** at this step — the embedded `zTXt mxGraphModel` chunk it adds causes vision APIs (Claude included) to return 400 "Could not process image" in step 5. Save the clean preview as `<name>.png` (single extension). Embedding is for the final export only (step 7).-5. **Self-check** — use the agent's built-in vision capability to read the exported PNG, catch obvious issues, auto-fix before showing user (requires a vision-enabled model such as Claude Sonnet/Opus). If reading the PNG returns a 400 / "Could not process image" error, you almost certainly exported with `-e` by mistake — re-export without `-e` and retry once. If it still fails, skip self-check and continue to step 6.-6. **Review loop** — show image to user, collect feedback, apply targeted XML edits, re-export, repeat until approved-7. **Final export** — re-export the approved version to all requested formats. Use `-e` here (PNG/SVG/PDF) so the deliverable stays editable in draw.io; save as `<name>.drawio.png` to signal embedded XML. **For PNG with `-e`, run `python3 <this-skill-dir>/scripts/repair_png.py <name>.drawio.png` immediately after** — draw.io's CLI truncates the IEND chunk in `-e` PNG output (8 bytes missing), producing a corrupt file that vision APIs and strict PNG decoders reject (issue #8). Report file paths.--### Step 5: Self-Check--After exporting the draft PNG, use the agent's vision capability (e.g., Claude's image input) to read the image and check for these issues before showing the user. If the agent does not support vision, skip self-check and show the PNG directly.--**Important:** the draft PNG read here must have been exported **without** `-e`. Draw.io's `-e` flag emits a PNG with a truncated IEND chunk (8 bytes of type+CRC missing) that the Anthropic vision API rejects with 400 "Could not process image" (issue #8). The simplest fix for the preview step is to skip `-e` entirely; the final export in step 7 keeps `-e` and runs the repair snippet. If you see the 400 error here, re-export without `-e` and retry once; if it still fails (any other reason), skip self-check and proceed to step 6.--| Check | What to look for | Auto-fix action |-|-------|-----------------|-----------------|-| Overlapping shapes | Two or more shapes stacked on top of each other | Shift shapes apart by ≥200px |-| Clipped labels | Text cut off at shape boundaries | Increase shape width/height to fit label |-| Missing connections | Arrows that don't visually connect to shapes | Verify `source`/`target` ids match existing cells |-| Off-canvas shapes | Shapes at negative coordinates or far from the main group | Move to positive coordinates near the cluster |-| Edge-shape overlap | An edge/arrow visually crosses through an unrelated shape | Add waypoints (`<Array as="points">`) to route around the shape, or increase spacing between shapes |-| Stacked edges | Multiple edges overlap each other on the same path | Distribute entry/exit points across the shape perimeter (use different exitX/entryX values) |--- Max **2 self-check rounds** — if issues remain after 2 fixes, show the user anyway-- Re-export after each fix and re-read the new PNG--### Step 6: Review Loop--After self-check, show the exported image and ask the user for feedback.--**Targeted edit rules** — for each type of feedback, apply the minimal XML change:--| User request | XML edit action |-|-------------|----------------|-| Change color of X | Find `mxCell` by `value` matching X, update `fillColor`/`strokeColor` in `style` |-| Add a new node | Append a new `mxCell` vertex with next available `id`, position near related nodes |-| Remove a node | Delete the `mxCell` vertex and any edges with matching `source`/`target` |-| Move shape X | Update `x`/`y` in the `mxGeometry` of the matching `mxCell` |-| Resize shape X | Update `width`/`height` in the `mxGeometry` of the matching `mxCell` |-| Add arrow from A to B | Append a new `mxCell` edge with `source`/`target` matching A and B ids |-| Change label text | Update the `value` attribute of the matching `mxCell` |-| Change layout direction | **Full regeneration** — rebuild XML with new orientation |--**Rules:**-- For single-element changes: edit existing XML in place — preserves layout tuning from prior iterations-- For layout-wide changes (e.g., swap LR↔TB, "start over"): regenerate full XML-- Overwrite the same `{name}.png` (no `-e`) each iteration — do not create `v1`, `v2`, `v3` files. `-e` is reserved for the final export in step 7.-- After applying edits, re-export and show the updated image-- Loop continues until user says approved / done / LGTM-- **Safety valve:** after 5 iteration rounds, suggest the user open the `.drawio` file in draw.io desktop for fine-grained adjustments--### Step 7: Final Export--Once the user approves:-- Export to all requested formats (PNG, SVG, PDF, JPG) — default to PNG if not specified-- Report file paths for both the `.drawio` source file and exported image(s)-- **Auto-launch:** offer to open the `.drawio` file in draw.io desktop for fine-tuning — `open diagram.drawio` (macOS), `xdg-open` (Linux), `start` (Windows)-- Confirm files are saved and ready to use--## Style Presets--A **style preset** is a named JSON file capturing a user's visual preferences (palette, shapes, font, edges). When active, it fully replaces the built-in color/shape conventions in this skill.--**Lookup order** when SKILL.md's step 0.5 resolves a preset name:-1. `~/.drawio-skill/styles/<name>.json` — user presets (survive `git pull`)-2. `<this-skill-dir>/styles/built-in/<name>.json` — shipped built-ins (`default`, `corporate`, `handdrawn`)--Always lowercase the user-provided name before any file operation — the schema enforces lowercase.--**For everything else — Learn flow (extracting a preset from a file), management ops (list/default/delete/rename), application rules (color lookup, shape keywords, edges, fonts, extras, interaction with diagram-type presets), and validation — read `references/style-presets.md`.** It's only needed when the user invokes those flows or when an active preset must be applied to the current generation.--## Draw.io XML Structure--### File skeleton--```xml-<?xml version="1.0" encoding="UTF-8"?>-<mxfile host="drawio" version="26.0.0">- <diagram name="Page-1">- <mxGraphModel>- <root>- <mxCell id="0" />- <mxCell id="1" parent="0" />- <!-- user shapes start at id="2" -->- </root>- </mxGraphModel>- </diagram>-</mxfile>-```--**Rules:**-- `id="0"` and `id="1"` are required root cells — never omit them-- User shapes start at `id="2"` and increment sequentially-- All shapes have `parent="1"` (unless inside a container — then use container's id)-- All text uses `html=1` in style for proper rendering-- **Never use `--` inside XML comments** — it's illegal per XML spec and causes parse errors-- Escape special characters in attribute values: `&`, `<`, `>`, `"`-- **Multi-line text in labels:** use `
` for line breaks inside `value` attributes (not literal `\n`). Example: `value="Line 1
Line 2"`--### Shape types (vertex)--| Style keyword | Use for |-|--------------|---------|-| `rounded=0` | plain rectangle (default) |-| `rounded=1` | rounded rectangle — services, modules |-| `ellipse;` | circles/ovals — start/end, databases |-| `rhombus;` | diamond — decision points |-| `shape=mxgraph.aws4.resourceIcon;` | AWS icons |-| `shape=cylinder3;` | cylinder — databases |-| `swimlane;` | group/container with title bar |--### Required properties--```xml-<!-- Rectangle / rounded box -->-<mxCell id="2" value="Label" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">- <mxGeometry x="100" y="100" width="160" height="60" as="geometry" />-</mxCell>--<!-- Cylinder (database) -->-<mxCell id="3" value="DB" style="shape=cylinder3;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333;" vertex="1" parent="1">- <mxGeometry x="350" y="100" width="120" height="80" as="geometry" />-</mxCell>--<!-- Diamond (decision) -->-<mxCell id="4" value="Check?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" vertex="1" parent="1">- <mxGeometry x="100" y="220" width="160" height="80" as="geometry" />-</mxCell>-```--### Containers and groups--For architecture diagrams with nested elements, use draw.io's parent-child containment — do **not** just place shapes on top of larger shapes.--| Type | Style | When to use |-|------|-------|-------------|-| **Group** (invisible) | `group;pointerEvents=0;` | No visual border needed, container has no connections |-| **Swimlane** (titled) | `swimlane;startSize=30;` | Container needs a visible title bar, or container itself has connections |-| **Custom container** | Add `container=1;pointerEvents=0;` to any shape | Any shape acting as a container without its own connections |--**Key rules:**-- Add `pointerEvents=0;` to container styles that should not capture connections between children-- Children set `parent="containerId"` and use coordinates **relative to the container**--```xml-<!-- Swimlane container -->-<mxCell id="svc1" value="User Service" style="swimlane;startSize=30;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">- <mxGeometry x="100" y="100" width="300" height="200" as="geometry"/>-</mxCell>-<!-- Child inside container — coordinates relative to parent -->-<mxCell id="api1" value="REST API" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="svc1">- <mxGeometry x="20" y="40" width="120" height="60" as="geometry"/>-</mxCell>-<mxCell id="db1" value="Database" style="shape=cylinder3;whiteSpace=wrap;html=1;" vertex="1" parent="svc1">- <mxGeometry x="160" y="40" width="120" height="60" as="geometry"/>-</mxCell>-```--### Connector (edge)--**CRITICAL:** Every edge `mxCell` must contain a `<mxGeometry relative="1" as="geometry" />` child element. Self-closing edge cells (`<mxCell ... edge="1" ... />`) are **invalid** and will not render. Always use the expanded form.--```xml-<!-- Directed arrow — always include rounded, orthogonalLoop, jettySize for clean routing -->-<mxCell id="10" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="2" target="3">- <mxGeometry relative="1" as="geometry" />-</mxCell>--<!-- Arrow with label + explicit entry/exit points to control direction -->-<mxCell id="11" value="HTTP/REST" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="2" target="4">- <mxGeometry relative="1" as="geometry" />-</mxCell>--<!-- Arrow with waypoints — use when edge must route around other shapes -->-<mxCell id="12" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="3" target="5">- <mxGeometry relative="1" as="geometry">- <Array as="points">- <mxPoint x="500" y="50" />- </Array>- </mxGeometry>-</mxCell>-```--**Edge style rules:**-- **Animated connectors:** add `flowAnimation=1;` to any edge style to show a moving dot animation along the arrow. Works in SVG export and draw.io desktop — ideal for data-flow and pipeline diagrams. Example: `style="edgeStyle=orthogonalEdgeStyle;flowAnimation=1;rounded=1;..."`-- **Always** include `rounded=1;orthogonalLoop=1;jettySize=auto` — these enable smart routing that avoids overlaps-- Pin `exitX/exitY/entryX/entryY` on every edge when a node has 2+ connections — distributes lines across the shape perimeter-- Add `<Array as="points">` waypoints when an edge must detour around an intermediate shape-- **Leave room for arrowheads:** the final straight segment between the last bend and the target shape must be ≥20px long. If too short, the arrowhead overlaps the bend and looks broken. Fix by increasing node spacing or adding explicit waypoints--### Distributing connections on a shape--When multiple edges connect to the same shape, assign different entry/exit points to prevent stacking:--| Position | exitX/entryX | exitY/entryY | Use when |-|----------|-------------|-------------|----------|-| Top center | 0.5 | 0 | connecting to node above |-| Top-left | 0.25 | 0 | 2nd connection from top |-| Top-right | 0.75 | 0 | 3rd connection from top |-| Right center | 1 | 0.5 | connecting to node on right |-| Bottom center | 0.5 | 1 | connecting to node below |-| Left center | 0 | 0.5 | connecting to node on left |--**Rule:** if a shape has N connections on one side, space them evenly (e.g., 3 connections on bottom → exitX = 0.25, 0.5, 0.75)--### Color palette (fillColor / strokeColor)--*Used only when no preset is active (see "Applying a preset" above).*--| Color name | fillColor | strokeColor | Use for |-|-----------|-----------|-------------|---------|-| Blue | `#dae8fc` | `#6c8ebf` | services, clients |-| Green | `#d5e8d4` | `#82b366` | success, databases |-| Yellow | `#fff2cc` | `#d6b656` | queues, decisions |-| Orange | `#ffe6cc` | `#d79b00` | gateways, APIs |-| Red/Pink | `#f8cecc` | `#b85450` | errors, alerts |-| Grey | `#f5f5f5` | `#666666` | external/neutral |-| Purple | `#e1d5e7` | `#9673a6` | security, auth |--### Layout tips--**Spacing — scale with complexity:**--| Diagram complexity | Nodes | Horizontal gap | Vertical gap |-|-------------------|-------|----------------|--------------|-| Simple | ≤5 | 200px | 150px |-| Medium | 6–10 | 280px | 200px |-| Complex | >10 | 350px | 250px |--**Routing corridors:** between shape rows/columns, leave an extra ~80px empty corridor where edges can route without crossing shapes. Never place a shape in a gap that edges need to traverse.--**Grid alignment:** snap all `x`, `y`, `width`, `height` values to **multiples of 10** — this ensures shapes align cleanly on draw.io's default grid and makes manual editing easier.--**General rules:**-- Plan a grid before assigning x/y coordinates — sketch node positions on paper/mentally first-- Group related nodes in the same horizontal or vertical band-- Use `swimlane` cells for logical grouping with visible borders-- Place heavily-connected "hub" nodes centrally so edges radiate outward instead of crossing-- To force straight vertical connections, pin entry/exit points explicitly on edges:- `exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0`-- Always center-align a child node under its parent (same center x) to avoid diagonal routing-- **Event bus pattern**: place Kafka/bus nodes in the **center of the service row**, not below — services on either side can reach it with short horizontal arrows (`exitX=1` left side, `exitX=0` right side), eliminating all line crossings-- Horizontal connections (`exitX=1` or `exitX=0`) never cross vertical nodes in the same row; use them for peer-to-peer and publish connections--**Avoiding edge-shape overlap:**-- Before finalizing coordinates, trace each edge path mentally — if it must cross an unrelated shape, either move the shape or add waypoints-- For tree/hierarchical layouts: assign nodes to layers (rows), connect only between adjacent layers to minimize crossings-- For star/hub layouts: place the hub center, satellites around it — edges stay short and radial-- When an edge must span multiple rows/columns, route it along the outer corridor, not through the middle of the diagram--## Export--### Commands--There are **two** export modes:--- **Preview / self-check** (step 4 of the workflow) — no `-e`. Output `diagram.png`. Required for vision self-check; using `-e` here triggers a 400 "Could not process image" error from the vision API (issue #8).-- **Final / deliverable** (step 7) — pass `-e`. Output `diagram.drawio.png`. The embedded XML keeps the file editable in draw.io.--```bash-# Preview PNG (use this in step 4, before self-check) — NO -e-draw.io -x -f png -s 2 -o diagram.png input.drawio--# Final PNG (step 7, after user approval) — WITH -e, double extension-draw.io -x -f png -e -s 2 -o diagram.drawio.png input.drawio--# macOS — full path (if not in PATH); preview / final variants-/Applications/draw.io.app/Contents/MacOS/draw.io -x -f png -s 2 -o diagram.png input.drawio-/Applications/draw.io.app/Contents/MacOS/draw.io -x -f png -e -s 2 -o diagram.drawio.png input.drawio--# Windows-"C:\Program Files\draw.io\draw.io.exe" -x -f png -e -s 2 -o diagram.drawio.png input.drawio--# Linux (headless — requires xvfb-run; on servers add HOME and --disable-gpu)-export HOME=${HOME:-/tmp}-xvfb-run -a --server-args="-screen 0 1280x1024x24" \- draw.io -x -f png -e -s 2 -o diagram.drawio.png input.drawio --disable-gpu-# Running as root (CI / Docker)? Append --no-sandbox AT THE END (placing it earlier makes drawio treat it as the input filename)--# SVG export (final — -e is safe; SVG is text)-draw.io -x -f svg -e -o diagram.svg input.drawio--# PDF export (final)-draw.io -x -f pdf -e -o diagram.pdf input.drawio--# Custom output directory (e.g. CI artifacts dir) — create if missing, then export there-mkdir -p ./artifacts && draw.io -x -f png -e -s 2 -o ./artifacts/diagram.drawio.png input.drawio-```--### Post-export PNG repair (required after `-e` PNG export)--draw.io CLI truncates the IEND chunk when emitting `-e` PNGs — the file ends with the 4-byte IEND length field but the `IEND` type + CRC (8 bytes) are missing. Result: vision APIs return 400 "Could not process image" and strict PNG decoders error out. SVG/PDF are unaffected.--Run this immediately after every `-e` PNG export:--```bash-python3 <this-skill-dir>/scripts/repair_png.py diagram.drawio.png-```--The script's `endswith(IEND)` guard makes it a no-op once draw.io fixes the bug upstream — safe to run unconditionally.--**Key flags:**-- `-x` — export mode (required)-- `-f` — format: `png`, `svg`, `pdf`, `jpg`-- `-e` — embed diagram XML in output (PNG, SVG, PDF) — exported file remains editable in draw.io. **Skip for the preview PNG used in step 5 self-check** — `-e` PNGs have a truncated IEND chunk that vision APIs reject (issue #8). For final PNG export, keep `-e` and run `scripts/repair_png.py` (see Post-export PNG repair). SVG/PDF unaffected.-- `-s` — scale: `1`, `2`, `3` (2 recommended for PNG)-- `-o` — output file path; accepts any directory (e.g. `./artifacts/diagram.drawio.png`) — `mkdir -p` the target dir first. Use `.drawio.png` double extension when embedding.-- `-b` — border width around diagram (default: 0, recommend 10)-- `-t` — transparent background (PNG only)-- `--page-index 0` — export specific page (default: all)--### Browser fallback (no CLI needed)--When the draw.io desktop CLI is unavailable, generate a client-side viewer URL:--```bash-python3 <this-skill-dir>/scripts/encode_drawio_url.py input.drawio-```--Prints a `https://viewer.diagrams.net/...` URL with the diagram XML deflate-compressed and base64-encoded into the URL fragment. The fragment (after `#`) is never sent to the server, so nothing is uploaded — the diagram opens client-side for viewing and editing. Useful when the user cannot install the desktop app.--### Fallback chain--When tools are unavailable, degrade gracefully:--| Scenario | Behavior |-|----------|----------|-| draw.io CLI missing, Python available | Use browser fallback (diagrams.net URL) |-| draw.io CLI missing, Python missing | Generate `.drawio` XML only; instruct user to open in draw.io desktop or diagrams.net manually |-| Vision unavailable for self-check | Skip self-check (step 5); proceed directly to showing user the exported PNG |-| Export fails (Chromium/display issues) | On Linux, retry with `xvfb-run -a`; if still failing, deliver `.drawio` XML and suggest manual export |-| Export fails on Linux server (headless) | Try in order: (1) `xvfb-run -a`, (2) append `--no-sandbox` at the very end if root, (3) add `--disable-gpu`, (4) `export HOME=/tmp`, (5) install apt deps (`libgtk-3-0 libnotify4 libnss3 libgbm1 libasound2t64` etc.), (6) fall back to [tomkludy/drawio-renderer](https://hub.docker.com/r/tomkludy/drawio-renderer) Docker (REST API for headless export) |--### Checking if draw.io is in PATH--```bash-# Try short command first-if command -v draw.io &>/dev/null; then- DRAWIO="draw.io"-elif [ -f "/Applications/draw.io.app/Contents/MacOS/draw.io" ]; then- DRAWIO="/Applications/draw.io.app/Contents/MacOS/draw.io"-else- echo "draw.io not found — install from https://github.com/jgraph/drawio-desktop/releases"-fi-```--## Common Mistakes--When something looks wrong (export fails, vision rejects a PNG, layout broken, edges misroute), see `references/troubleshooting.md` for a row-by-row mistake → fix table.--## Diagram Type Presets--When the user requests a specific diagram type, read `references/diagram-types.md` for the matching preset (shapes, edges, layout direction). Pick by user phrasing:--| User says | Section in `references/diagram-types.md` |-|---|---|-| "ER diagram", "schema diagram", "data model" | ERD |-| "UML class diagram", "class diagram" | UML Class |-| "sequence diagram", "interaction diagram", "lifeline" | Sequence |-| "architecture", "system diagram", "service diagram" | Architecture |-| "neural network", "model architecture", "ML diagram", "deep learning" | ML / Deep Learning Model |-| "flowchart", "decision tree", "process flow" | Flowchart |--The diagram-type preset sets **structural** style keywords. If a user style preset is also active (see `## Style Presets`), keep the structural keywords and layer color/font/edge/extras on top — read `references/style-presets.md` → "Interaction with diagram-type presets" for the merge rules.diff --git a/references/diagram-types.md b/references/diagram-types.mddeleted file mode 100644index c053b15..0000000--- a/references/diagram-types.md+++ /dev/null@@ -1,83 +0,0 @@-# Diagram Type Presets--When the user requests a specific diagram type, apply the matching preset below for shapes, styles, and layout conventions. These presets set **structural** style keywords (e.g. ERD's `shape=table;childLayout=tableLayout`); a user style preset (see `references/style-presets.md`) layers color/font/edge/extras on top.--Read this file when:-- The user names one of these diagram types (ERD, UML class, sequence, architecture, ML/DL model, flowchart)-- You're choosing shape vocabulary or layout direction for a new diagram--## ERD (Entity-Relationship Diagram)--| Element | Style | Notes |-|---------|-------|-------|-| Table | `shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;strokeColor=#6c8ebf;fillColor=#dae8fc;` | Each table is a container |-| Row (column) | `shape=tableRow;horizontal=0;startSize=0;swimlaneHead=0;swimlaneBody=0;fillColor=none;collapsible=0;dropTarget=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;fontSize=12;` | Child of table, `parent=tableId` |-| PK column | Bold text: `fontStyle=1` on the row | Mark with `PK` prefix or key icon |-| FK relationship | Dashed edge: `dashed=1;endArrow=ERmandOne;startArrow=ERmandOne;` | Use ER notation arrows |-| Layout | TB, tables spaced 300px apart | Group related tables vertically |--## UML Class Diagram--| Element | Style | Notes |-|---------|-------|-------|-| Class box | `swimlane;fontStyle=1;align=center;startSize=26;html=1;` | 3-section: title / attributes / methods |-| Separator | `line;strokeWidth=1;fillColor=none;align=left;verticalAlign=middle;spacingTop=-1;spacingLeft=3;spacingRight=10;rotatable=0;labelPosition=left;points=[];portConstraint=eastwest;` | Between sections |-| Inheritance | `endArrow=block;endFill=0;` | Hollow triangle arrow |-| Implementation | `endArrow=block;endFill=0;dashed=1;` | Dashed + hollow triangle |-| Composition | `endArrow=diamondThin;endFill=1;` | Filled diamond |-| Aggregation | `endArrow=diamondThin;endFill=0;` | Hollow diamond |-| Layout | TB, classes 250px apart | Interfaces above implementations |--## Sequence Diagram--| Element | Style | Notes |-|---------|-------|-------|-| Actor/Object | `shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;outlineConnect=0;portConstraint=eastwest;` | Lifeline with dashed vertical line |-| Sync message | `html=1;verticalAlign=bottom;endArrow=block;` | Solid line, filled arrowhead |-| Async message | `html=1;verticalAlign=bottom;endArrow=open;dashed=1;` | Dashed line, open arrowhead |-| Return message | `html=1;verticalAlign=bottom;endArrow=open;dashed=1;strokeColor=#999999;` | Grey dashed |-| Activation box | `shape=umlFrame;whiteSpace=wrap;` on the lifeline | Narrow rectangle on lifeline |-| Layout | LR, lifelines spaced 200px apart | Time flows top to bottom |--## Architecture Diagram--| Element | Style | Notes |-|---------|-------|-------|-| Layer/tier | `swimlane;startSize=30;` | Containers for grouping: Client / API / Service / Data |-| Service | `rounded=1;whiteSpace=wrap;html=1;` + tier color | Use color palette by tier |-| Database | `shape=cylinder3;whiteSpace=wrap;html=1;` | Green palette |-| Queue/Bus | `rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;` | Yellow — place centrally for hub pattern |-| Gateway/LB | `shape=mxgraph.aws4.resourceIcon;` or `rounded=1;` with orange | Orange palette |-| External | `rounded=1;dashed=1;fillColor=#f5f5f5;strokeColor=#666666;` | Dashed border for external systems |-| Layout | TB or LR by tier count; ≥4 tiers → TB | Hub nodes centered |--## ML / Deep Learning Model Diagram--For neural network architecture diagrams — ideal for papers targeting NeurIPS, ICML, ICLR.--| Element | Style | Notes |-|---------|-------|-------|-| Layer block | `rounded=1;whiteSpace=wrap;html=1;` + type color | Main building block |-| Input/Output | `fillColor=#d5e8d4;strokeColor=#82b366;` | Green |-| Conv / Pooling | `fillColor=#dae8fc;strokeColor=#6c8ebf;` | Blue |-| Attention / Transformer | `fillColor=#e1d5e7;strokeColor=#9673a6;` | Purple |-| RNN / LSTM / GRU | `fillColor=#fff2cc;strokeColor=#d6b656;` | Yellow |-| FC / Linear | `fillColor=#ffe6cc;strokeColor=#d79b00;` | Orange |-| Loss / Activation | `fillColor=#f8cecc;strokeColor=#b85450;` | Red/Pink |-| Skip connection | `dashed=1;endArrow=block;curved=1;` | Dashed curved arrow |-| Tensor shape label | Add shape annotation as secondary label: `value="Conv2D
(B, 64, 32, 32)"` | Use `
` for multi-line |-| Layout | TB (data flows top→bottom), layers 150px apart | Group encoder/decoder as swimlanes |--**Tensor shape convention:** annotate each layer with input/output tensor dimensions in `(B, C, H, W)` or `(B, T, D)` format. Place dimensions as the second line of the label using `
`.--## Flowchart (enhanced)--| Element | Style | Notes |-|---------|-------|-------|-| Start/End | `ellipse;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;` | Green oval |-| Process | `rounded=0;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;` | Blue rectangle |-| Decision | `rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;` | Yellow diamond |-| I/O | `shape=parallelogram;perimeter=parallelogramPerimeter;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;` | Orange parallelogram |-| Subprocess | `rounded=0;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;` + double border | Purple |-| Yes/No labels | `value="Yes"` / `value="No"` on decision edges | Always label decision branches |-| Layout | TB, 200px vertical gap | Decisions branch LR, merge back to center |diff --git a/references/style-extraction.md b/references/style-extraction.mddeleted file mode 100644index 1127b78..0000000--- a/references/style-extraction.md+++ /dev/null@@ -1,254 +0,0 @@-# Style Extraction — agent reference--Loaded on demand by `SKILL.md` when the user asks to learn a style ("learn my style from `<path>` as `<name>`") or when the agent needs to render a sample after extraction.--## Sample diagram (for approval render)--After extracting a candidate preset, render this seven-node sample using the candidate's palette/shapes/fonts/edges. Each role appears exactly once; six edges, one dashed, exercise `edges.arrow`, `edges.style`, and `edges.dashedFor`.--**Layout (TB):**-- Row 1 (y=40): `gateway` centered at x=340-- Row 2 (y=180): `security` (x=80), `service` (x=340), `queue` (x=600)-- Row 3 (y=340): `database` (x=80), `external` (x=340), `error` (x=600)--**Template — substitute `{{...}}` placeholders from the candidate preset.**--The vertex style for role `R` is built as:-`<shapes[R]>;whiteSpace=wrap;html=1;fillColor=<palette[roles[R]].fillColor>;strokeColor=<palette[roles[R]].strokeColor>;fontFamily=<font.fontFamily>;fontSize=<font.fontSize>`-- If `extras.sketch=true`, append `;sketch=1` to every vertex style AND every edge style.-- If `extras.globalStrokeWidth !== 1` (i.e., any value other than the drawio default of 1, including `0.5`), append `;strokeWidth=<n>` to every vertex style AND every edge style.--The edge style is built as:-`<edges.style>;<edges.arrow>`-- Per-edge routing keys (`exitX/entryX/...`) are added as literals below.-- Edge 15 exercises `edges.dashedFor`:- - If `edges.dashedFor` is **non-empty**, use its first entry as the edge's `value` (label) AND append `;dashed=1` to the edge style.- - If `edges.dashedFor` is empty (`[]`), use the label `cross-call` and do NOT append `;dashed=1` — the preset has no dashed convention, so the sample must not fake one.--**Placeholder expansion (applied when filling the XML):**-- `{{VSTYLE:<role>}}` expands to the vertex-style formula above with `R = <role>`. Write the result as a literal string; do not URL-encode.-- `{{ESTYLE}}` expands to the edge-style formula above.-- `{{EDGE15_LABEL}}` and `{{EDGE15_DASH}}` follow the Edge-15 rule above.--```xml-<?xml version="1.0" encoding="UTF-8"?>-<mxfile host="drawio" version="26.0.0">- <diagram name="Preset Sample">- <mxGraphModel>- <root>- <mxCell id="0" />- <mxCell id="1" parent="0" />-- <!-- Row 1: gateway -->- <mxCell id="2" value="Gateway" style="{{VSTYLE:gateway}}" vertex="1" parent="1">- <mxGeometry x="340" y="40" width="160" height="60" as="geometry" />- </mxCell>-- <!-- Row 2: security | service | queue -->- <mxCell id="3" value="Auth" style="{{VSTYLE:security}}" vertex="1" parent="1">- <mxGeometry x="80" y="180" width="160" height="60" as="geometry" />- </mxCell>- <mxCell id="4" value="Service" style="{{VSTYLE:service}}" vertex="1" parent="1">- <mxGeometry x="340" y="180" width="160" height="60" as="geometry" />- </mxCell>- <mxCell id="5" value="Queue" style="{{VSTYLE:queue}}" vertex="1" parent="1">- <mxGeometry x="600" y="180" width="160" height="60" as="geometry" />- </mxCell>-- <!-- Row 3: database | external | error -->- <mxCell id="6" value="Database" style="{{VSTYLE:database}}" vertex="1" parent="1">- <mxGeometry x="80" y="340" width="160" height="70" as="geometry" />- </mxCell>- <mxCell id="7" value="External API" style="{{VSTYLE:external}}" vertex="1" parent="1">- <mxGeometry x="340" y="340" width="160" height="60" as="geometry" />- </mxCell>- <mxCell id="8" value="Error Sink" style="{{VSTYLE:error}}" vertex="1" parent="1">- <mxGeometry x="600" y="340" width="160" height="60" as="geometry" />- </mxCell>-- <!-- Edges -->- <mxCell id="10" value="" style="{{ESTYLE}};exitX=0.25;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0" edge="1" parent="1" source="2" target="3">- <mxGeometry relative="1" as="geometry" />- </mxCell>- <mxCell id="11" value="" style="{{ESTYLE}};exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0" edge="1" parent="1" source="2" target="4">- <mxGeometry relative="1" as="geometry" />- </mxCell>- <mxCell id="12" value="" style="{{ESTYLE}};exitX=0.75;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0" edge="1" parent="1" source="2" target="5">- <mxGeometry relative="1" as="geometry" />- </mxCell>- <mxCell id="13" value="" style="{{ESTYLE}};exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0" edge="1" parent="1" source="4" target="7">- <mxGeometry relative="1" as="geometry" />- </mxCell>- <mxCell id="14" value="" style="{{ESTYLE}};exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0" edge="1" parent="1" source="4" target="6">- <mxGeometry relative="1" as="geometry" />- </mxCell>- <mxCell id="15" value="{{EDGE15_LABEL}}" style="{{ESTYLE}}{{EDGE15_DASH}};exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0" edge="1" parent="1" source="4" target="8">- <mxGeometry relative="1" as="geometry" />- </mxCell>-- </root>- </mxGraphModel>- </diagram>-</mxfile>-```--### Rendering the sample--1. Write the filled XML to `/tmp/drawio-preset-<name>.drawio`.-2. Run the same `draw.io -x -f png -e -s 2 -o <preset-name>-sample.png <tmp>.drawio` command the main workflow uses.-3. Save the PNG as `./preset-<name>-sample.png` (the user's working directory).-4. Show the user: preset summary table + PNG path + provenance/confidence line.--### Approval loop--- "save" / "looks good" → write candidate to `~/.drawio-skill/styles/<name>.json`; delete tempfile and sample PNG.-- "change <field> to <value>" → edit the in-memory candidate; re-render; re-ask.-- "cancel" → delete tempfile and sample PNG; no save.--### If sample render fails (draw.io CLI missing / export error)--Still show the summary table and the provenance line. Note: *"Could not render sample PNG (CLI unavailable). Save anyway on your OK."* Do not block.--## XML extraction path--Input: a `.drawio` file path. Output: candidate preset JSON. Deterministic, no LLM inference.--### Steps--1. **Parse the file.** Read the XML, collect every `<mxCell>` with a `style=` attribute, split into vertices (`vertex="1"`) and edges (`edge="1"`).-2. **Tokenize each `style=` string** on `;`. Each element is either `key=value` or a bare keyword (e.g., `rhombus`, `ellipse`, `rounded=1`).-3. **Extract palette.** For every vertex, take the `(fillColor, strokeColor)` pair (skip vertices with neither). Count frequency. Keep the top ≤7 pairs.-4. **Extract shape vocabulary + role mapping.** For each vertex determine a shape class by precedence:- `cylinder3 > ellipse > rhombus > swimlane > rounded=1 > rounded=0`.- Then infer the semantic role from the vertex's shape class and its `value` (label) attribute. **Evaluate the rules below in order; first match wins.**- - `cylinder3` → `database`- - `rhombus` → `decision`- - `swimlane` → `container`- - `dashed=1` present + **grey-family fill** (hex where the R, G, and B channels all fall within ±16 of each other, i.e., near-achromatic) → `external`- - label matches `/queue|bus|kafka|rabbit/i` → `queue`- - label matches `/gateway|api|lb|load/i` → `gateway`- - label matches `/auth|login|jwt|oauth/i` → `security`- - label matches `/error|fail|alert/i` → `error`- - everything else → `service`-- For each **role that has a canonical palette slot** — `service`, `database`, `queue`, `gateway`, `error`, `external`, `security` — the most frequent `(role, color-pair)` mapping wins. The pair goes into the role's canonical palette slot:- `service→primary, database→success, queue→warning, gateway→accent, error→danger, external→neutral, security→secondary`.- Set `roles[role]` to that slot name.-- **Decision and container shapes do not get a `roles[...]` entry** — they are recorded only in `shapes.decision` and `shapes.container`. Any color pairs observed on decision/container vertices still participate in the palette (they can fill leftover slots) but are not tied to a semantic role.-- Leftover color pairs (not claimed by any role-slot mapping) fill remaining empty palette slots in descending-frequency order.-- Record the shape class string used per role in `shapes[role]`. The six named shape keys are `service`, `database`, `queue`, `decision`, `external`, `container` — `gateway`, `error`, and `security` roles inherit `shapes.service` and do not get their own `shapes[...]` entry. Example: `shapes.database = "shape=cylinder3"`.--5. **Extract fonts.** Compute modal `fontFamily` and `fontSize` across vertices; emit them as `font.fontFamily` and `font.fontSize`. Also track `fontStyle` per vertex as a **working variable** (not an output field — the schema has no top-level `font.fontStyle`). If a distinguishable subset of vertices uses a larger `fontSize` combined with `fontStyle=1` (bold), treat that subset as titles: set `font.titleFontSize` to their modal size and `font.titleBold: true`. Otherwise omit both title fields.--6. **Extract edge defaults.** Take the modal edge style string, but strip these per-edge coordinate keys before counting: `entryX`, `entryY`, `exitX`, `exitY`, `entryDx`, `entryDy`, `exitDx`, `exitDy`. Record arrow style from `endArrow`/`endFill` separately in `edges.arrow`.- If any edges have `dashed=1`, collect their `value` (label) attributes. If ≥2 share a common token (e.g., all are labeled "async" or "optional"), add that token to `edges.dashedFor`.--7. **Extract extras.** `sketch=1` seen on any vertex or edge → `extras.sketch = true`. Modal `strokeWidth` across vertices → `extras.globalStrokeWidth` (default `1`).--8. **Set provenance.**- ```json- {- "source": { "type": "xml", "path": "<input absolute path>", "extracted_at": "YYYY-MM-DD" },- "confidence": "high"- }- ```--### XML edge cases--| Situation | Behavior |-|---|---|-| Source has <3 distinct color pairs | Leave unfilled slots as `null`. Downgrade `confidence` to `"medium"`. Summary warns the user. |-| Source has >7 color pairs | Keep the top 7 by frequency. Summary warns that some colors were dropped. |-| Non-standard `shape=` keywords (e.g., `shape=mxgraph.aws4.*`) | These do not match the Step 4 precedence ladder, so the vertex falls through to `rounded=0` for shape-class purposes. Iconography is lost; color, label, and edge style are still captured. Role inference still runs via the label-regex rules. Summary notes: *"Non-standard shape library detected — iconography not preserved in preset (color and label captured)."* |-| Non-English labels | The English-keyword regexes in step 4 will mostly miss; most vertices collapse to `service`. Palette/shapes/font/edges still captured correctly (they don't depend on label text). `confidence` stays `"high"`. Summary notes: *"Role labels not in English — `service`/`database`/`decision`/`container`/`external` inferred from shape class; other roles not mapped."* |-| File has no `<mxCell vertex="1">` at all | Stop. Refuse to save. Message: *"Nothing to learn from — source file has no shapes."* |--## Image extraction path--Input: path to a PNG/JPG (or any vision-readable image format). Output: candidate preset JSON. Inference-based; `confidence: "medium"` at best.--**Prerequisite:** the agent's vision capability must be available (same mechanism the main workflow's self-check uses). If vision is not available, stop and tell the user:-*"Image-based learning needs a vision-enabled model (Claude Sonnet or Opus). Re-run on such a model, or provide the `.drawio` source file instead."*--### Steps--1. **Read the image.** Use the agent's vision input — the same path the main workflow's step 5 uses to read exported PNGs during self-check.--2. **Extract palette by visual inspection.** Identify distinct fill-color regions on shape bodies.-- For each distinct fill:- - `fillColor` — quantize each RGB channel to the nearest multiple of 16. If the resulting HSL lightness is below 0.75, raise it to 0.85 (keep hue and saturation; set L=0.85; HSL→RGB round-trip). Emit as `#RRGGBB`. Drawio-standard pastels occupy L≈0.85–0.96; below 0.75 reads as "too dark for a fill color" and this step lifts it back into that range.- - `strokeColor` — read the matching border. If unreadable, derive from fill by darkening ~25% (match HSL, drop L by 0.25).-- Map each `(fillColor, strokeColor)` pair to a named slot using this decision order:-- 1. **Grey check first.** If the fill has R, G, and B channels all within ±16 of each other (same definition as the XML path's grey-family rule), OR HSL saturation < 0.20, classify as `neutral`. This check wins regardless of hue angle.- 2. **Hue band otherwise.** Use these explicit HSL hue ranges:- - 180°–260° → `primary` (blue)- - 80°–170° → `success` (green)- - 45°–65° → `warning` (yellow)- - 20°–44° → `accent` (orange)- - 0°–19° or 320°–360° → `danger` (red/pink)- - 260°–320° → `secondary` (purple)- 3. **No band matched** (gap regions at 65°–80° or 170°–180°) → spill to the nearest band by angular distance.-- **Collision rule.** If ≥2 distinct fills land in the same slot, sort them by total pixel area covered in the image (descending). The largest keeps the canonical slot. Remaining fills spill to the **nearest empty slot** measured by hue-band angular distance — first to adjacent bands on either side, then farther out. If every slot is already filled, drop the extras and warn in the summary.--3. **Extract shape vocabulary.** Classify every visible shape by silhouette:- - rounded rectangle → `rounded=1`- - sharp rectangle → `rounded=0`- - circle / oval → `ellipse`- - diamond → `rhombus`- - cylinder (rectangle with curved top/bottom) → `shape=cylinder3`- - titled container (header bar + nested children inside) → `swimlane;startSize=30`- - dashed-bordered rectangle → `rounded=1;dashed=1`-- Role assignment uses the **same label-text + shape rules as the XML path step 4**. Visible labels are read via vision.--4. **Extract fonts.** Best-effort. Distinguishable categories:- - clearly serif → `fontFamily: "Georgia"`- - clearly monospaced → `fontFamily: "Courier New"`- - otherwise → `fontFamily: "Helvetica"`-- Size by relative appearance:- - small → `fontSize: 11`- - medium → `fontSize: 12`- - large → `fontSize: 14`-- If titles/container headers are distinctly larger or bolder → set `titleFontSize` accordingly and `titleBold: true`.--5. **Extract edge defaults.**- - Right-angle orthogonal arrows → `edges.style = "edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1"`.- - Curved arrows → append `;curved=1` to `edges.style`.- - Filled triangle arrowheads → `edges.arrow = "endArrow=classic;endFill=1"`.- - Open V-shaped arrowheads → `edges.arrow = "endArrow=open;endFill=0"`.- - Any dashed arrows near labels like "optional", "async", "fallback", "secondary" → add those label tokens to `edges.dashedFor`.--6. **Extract extras.**- - Visibly hand-drawn / rough / sketch look (wavy strokes, uneven fills) → `extras.sketch = true`.- - Heavy strokes (clearly >1.5× normal) → `extras.globalStrokeWidth = 2`.- - Otherwise default: `extras = { "sketch": false, "globalStrokeWidth": 1 }`.--7. **Set provenance and confidence.**- ```json- {- "source": { "type": "image", "path": "<input absolute path>", "extracted_at": "YYYY-MM-DD" },- "confidence": "medium"- }- ```- Adjustments:- - <3 distinct shapes identifiable → `confidence: "low"`.- - Image path stays at `"medium"` by default. The only path to `"high"` is a strictly-verifiable signal: the source image was exported from drawio itself (recognizable drawio default chrome, grid, or a visible drawio watermark), **and** all seven palette slots are filled, **and** all seven roles are labeled. This preserves the semantic gap between inference-based (image) and parse-based (XML) provenance.--### Image edge cases--| Situation | Behavior |-|---|---|-| Vision unavailable | Stop as described above — do not fall back to guessing. |-| Image has <3 identifiable shapes | Continue; mark `confidence: "low"`; summary explicitly warns the user that the preset is a loose approximation. |-| Image has no visible labels | Role assignment collapses to shape-class only: cylinders → `database`, diamonds → `decision`, swimlanes → `container`, dashed-bordered rectangles with grey fill → `external`, everything else → `service`. Palette/font/edges still captured. Summary notes: *"No labels readable — semantic roles beyond shape-class not inferred."* |-| Two palette slots would land in the same hue family | Keep the more frequent one in its canonical slot; spill the other to the adjacent empty slot (rule in step 2). |-| Image has more than 7 distinct fills | Keep the 7 most area-covering fills per the Step 2 collision rule. Summary warns that some colors were dropped. |diff --git a/references/style-presets.md b/references/style-presets.mddeleted file mode 100644index 5721189..0000000--- a/references/style-presets.md+++ /dev/null@@ -1,110 +0,0 @@-# Style Presets — Learn, Apply, Manage--A **style preset** is a named JSON file capturing a user's visual preferences — palette, shape vocabulary, fonts, edge style. When a preset is active, it fully replaces the built-in conventions in SKILL.md's color/shape/edge tables.--Read this file when:-- The user asks to "learn", "save", "remember", or "extract" a style from a file-- The user wants to manage existing presets (list, set default, delete, rename)-- You've resolved an active preset in step 0.5 and need the application rules-- You need to validate a preset file before loading it--## Locations and lookup order--1. `~/.drawio-skill/styles/<name>.json` — user presets (survive `git pull`).-2. `<this-skill-dir>/styles/built-in/<name>.json` — built-ins shipped with the skill (`default`, `corporate`, `handdrawn`).--A user preset shadows a built-in of the same name.--Only user presets can have `"default": true`. When the user says *"make `<built-in-name>` my default"*, copy the built-in JSON to `~/.drawio-skill/styles/<name>.json` first, then set `default: true` on the copy — leave the shipped built-in untouched.--**Name normalisation:** always lowercase the user-provided name before writing or looking up files (the preset schema enforces lowercase; uppercase names will fail validation).--## Applying a preset--When SKILL.md's step 0.5 identified a preset, it fully replaces the built-in palette, shape keywords, edge defaults, and font for this diagram — do not mix values from the built-in color table.--**Color lookup.** For each role a shape plays (service / database / queue / gateway / error / external / security), resolve `preset.roles[role]` to a slot name, then `preset.palette[<slot>]` to the `(fillColor, strokeColor)` pair. If `roles[role]` is unset or the resolved slot is `null`, follow this fallback ladder:--1. Try the role's canonical slot (`service→primary`, `database→success`, `queue→warning`, `gateway→accent`, `error→danger`, `external→neutral`, `security→secondary`).-2. If that slot is also empty, pick the most-populated non-null slot in the preset.-3. Never reach into the built-in color table — the preset is authoritative.--**Decision and container shapes** are not in `preset.roles` — they have shape vocabulary (`preset.shapes.decision`, `preset.shapes.container`) but no role-to-slot mapping. Pick their colors as follows:-- **Decision** (rhombus) → use `preset.palette.warning` (the canonical yellow slot in the built-in conventions). If `warning` is empty, apply the slot-fallback ladder above starting from `warning`.-- **Container** (swimlane) → use the palette slot matching the tier/grouping the container represents (e.g. a "Services" tier container uses `primary`; a "Data" tier uses `success`). If no tier signal is available, default to `primary`.--**Shape keywords.** Use `preset.shapes[role]` as the **prefix** of the vertex style string (before `whiteSpace=wrap;html=1;...`). Example: for a database role, if `preset.shapes.database = "shape=cylinder3"`, the vertex style starts `shape=cylinder3;whiteSpace=wrap;html=1;fillColor=...`. The six named shape keys are `service`, `database`, `queue`, `decision`, `external`, `container`. Roles `gateway`, `error`, and `security` reuse `preset.shapes.service` unless the preset explicitly populates a key with their name.--**Edges.** Use `preset.edges.style` as the base edge style string. Append `preset.edges.arrow`. Per-edge routing keys (`exitX/exitY/entryX/entryY/...`) are still added by the usual routing rules in SKILL.md. If the flow between two shapes matches a token from `preset.edges.dashedFor` (either because the user's prompt used that word, or because one end of the edge plays a role whose typical relation is "optional"), append `;dashed=1` to the edge style.--**Fonts.** Append `fontFamily=<preset.font.fontFamily>;fontSize=<preset.font.fontSize>` to every vertex style. Container headers and swimlane titles additionally get `fontSize=<preset.font.titleFontSize>;fontStyle=1` when `preset.font.titleBold` is `true`.--**Extras.**-- `preset.extras.sketch === true` → append `sketch=1` to every vertex style and every edge style.-- `preset.extras.globalStrokeWidth !== 1` (any value other than the drawio default of 1, including `0.5`) → append `strokeWidth=<n>` to every vertex style and every edge style.--**Interaction with diagram-type presets** (ERD / UML / Sequence / ML / Flowchart). Diagram-type presets set structural style keywords that the user preset must preserve (e.g. ERD tables rely on `shape=table;startSize=30;container=1;childLayout=tableLayout;...`). The rule: keep the diagram-type preset's structural keywords, then layer the user preset's color / font / edge / extras on top. When a diagram-type preset hardcodes a color (`fillColor=#dae8fc`, etc.) that conflicts with the user preset, the user preset's color wins. Exception: `fillColor=none` is structural — do not replace it with a palette color.--## Learn flow--**Triggers:** "learn my style from `<path>` as `<name>`", "save this as `<name>` style", "remember this style as `<name>`".--**Dispatch by file extension:**-- `.drawio`, `.xml` → XML path-- `.png`, `.jpg`, `.jpeg`, `.svg` (rasterized flat image) → image path--**Steps:**--1. **Load the extraction reference.** Read `references/style-extraction.md` into context.-2. **Extract** following the XML path or image path procedure in the reference.-3. **Normalize and build candidate.** Convert the user-provided preset name to lowercase. Use this normalized name for ALL file paths in this flow. Build the candidate preset JSON and write it to `/tmp/drawio-preset-<name>.json` (where `<name>` is the already-normalized name). Do **not** save to `~/.drawio-skill/styles/<name>.json` yet.-4. **Render a sample** using the sample-diagram skeleton in `references/style-extraction.md`, parameterized by the candidate preset. Export PNG to `./preset-<name>-sample.png` using the same `draw.io -x -f png -e -s 2 -o ./preset-<name>-sample.png /tmp/drawio-preset-<name>.drawio` command the main workflow uses.-5. **Show the user:**- - Preset summary table (palette hex values, shapes per role, font, edge style, extras).- - The sample PNG path (and embed the image if the environment supports it).- - Provenance line: `source.type`, `source.path`, `extracted_at`, `confidence`.-6. **Wait for approval:**- - "save" / "looks good" → write candidate to `~/.drawio-skill/styles/<name>.json`. Create `~/.drawio-skill/styles/` if it doesn't exist. Delete tempfile and sample PNG.- - "change `<field>` to `<value>`" → edit the in-memory candidate, re-render, re-ask.- - "cancel" / "abort" / "no" → delete tempfile and sample PNG; nothing saved.--**Error behavior:**--| Failure | Behavior |-|---|---|-| Source path does not exist | Stop; report path not found. |-| XML parse fails | Stop; report the parse error; suggest opening the file in drawio desktop to repair. |-| Image vision unavailable | Stop; tell user to re-run on a vision-capable model or provide the `.drawio` file. |-| Extraction yields 0 vertices / shapes | Stop; refuse to save. |-| Extraction yields <3 distinct color pairs | Continue; mark `confidence: "low"` (image) or `"medium"` (XML); warn in summary. |-| Preset name collides with existing user preset | Ask: overwrite, or pick a new name. |-| Preset name collides with a built-in preset | Save to user dir (shadows the built-in); warn once. |-| Sample render fails | Still show summary; note "could not render sample — saving on your OK anyway". Do not block. |--## Management operations--All operations are natural language — no slash commands.--*Apply name normalisation (lowercase) to all `<name>`, `<a>`, `<b>` arguments before any file operation.*--| User says | Agent does |-|---|---|-| "list my styles", "what styles do I have", "show me my style presets" | Read `~/.drawio-skill/styles/` and `<this-skill-dir>/styles/built-in/`. Print a table: `name`, `location` (user/built-in), `source.type`, `confidence`, `default` flag. Built-ins shadowed by a user preset are marked so. |-| "show my `<name>` style", "what's in `<name>`" | Print the preset JSON (pretty-printed) + a one-line summary (source, confidence, is-default). |-| "make `<name>` the default", "set `<name>` as default" | If `<name>` is a user preset: set `default: true` on it; clear `default` on any other user preset that had it; save both files. If `<name>` is a built-in: copy `<this-skill-dir>/styles/built-in/<name>.json` → `~/.drawio-skill/styles/<name>.json` first, then set `default: true` on the copy. Never mutate the shipped built-in. |-| "remove default", "unset default" | Clear `default: true` from whichever user preset has it. |-| "delete `<name>`", "remove `<name>`" | Confirm first. Then `rm ~/.drawio-skill/styles/<name>.json`. Refuse to delete files under `<this-skill-dir>/styles/built-in/` — suggest shadowing with a user preset of the same name. |-| "rename `<a>` to `<b>`" | `mv ~/.drawio-skill/styles/<a>.json ~/.drawio-skill/styles/<b>.json`, then update the `name` field inside. Fails if `<a>` is a built-in (offer to copy-then-rename instead). |-| "learn my style from `<path>` as `<name>`" | Dispatch to the Learn flow above. |--## Preset file validation--When loading any preset (for generation or management), do a lightweight structural check:-- Required top-level fields present (`name`, `version`, `palette`, `roles`, `shapes`, `font`, `edges`).-- `version === 1`.-- Every populated palette slot has both `fillColor` and `strokeColor` as `#RRGGBB`.-- `confidence` ∈ {`"low"`, `"medium"`, `"high"`} if present.--On validation failure:-- **During generation:** warn the user, fall back to built-in conventions for this one diagram, do not mutate the file.-- **During learn:** refuse to save the candidate; report which field failed.diff --git a/references/troubleshooting.md b/references/troubleshooting.mddeleted file mode 100644index 0ff83f6..0000000--- a/references/troubleshooting.md+++ /dev/null@@ -1,25 +0,0 @@-# Troubleshooting — Common Mistakes--Read this when something looks wrong in the output (rendering, export, layout, edges) or when a CLI invocation fails. Most rows have a one-line fix.--| Mistake | Fix |-|---------|-----|-| Missing `id="0"` and `id="1"` root cells | Always include both at the top of `<root>` |-| Shapes not connected | `source` and `target` on edge must match existing shape `id` values |-| Self-closing edge `mxCell` (`<mxCell ... edge="1" />`) | Use the expanded form with `<mxGeometry relative="1" as="geometry" />` child — self-closing edges won't render |-| `--` inside XML comments | Illegal per XML spec — use single hyphens or rephrase |-| Special characters in `value` | Use XML entities: `&` `<` `>` `"` |-| Literal `\n` in label text | Use `
` for line breaks in `value` attributes |-| Overlapping shapes | Scale spacing with complexity (200–350px); leave routing corridors |-| Edges crossing through shapes | Add waypoints, distribute entry/exit points, or increase spacing |-| Arrowhead overlaps bend | Final edge segment before target must be ≥20px — increase spacing or add waypoints |-| Iteration loop never ends | After 5 rounds, suggest user open .drawio in draw.io desktop for fine-tuning |-| Export command not found on macOS | Try full path `/Applications/draw.io.app/Contents/MacOS/draw.io` |-| Linux: blank/error output headlessly | Prefix command with `xvfb-run -a` |-| Linux: `--no-sandbox` placed before input file (parsed as filename) | Move `--no-sandbox` to the very end of the command (drawio-desktop#249, #1056) |-| Linux: `Failed to get 'appData' path` / `Home directory not accessible` | `export HOME=/tmp` before invoking drawio (drawio-desktop#127) |-| Linux server: segfault / EGL / MESA `failed to load driver` errors | Add `--disable-gpu` (suppresses Chromium GL init when no GPU available) |-| PDF export fails | Ensure Chromium is available (draw.io bundles it on desktop) |-| Background color wrong in CLI export | Known CLI bug; add `--transparent` flag or set background via style |-| Vision returns 400 "Could not process image" on draft PNG | Re-export the preview without `-e` (issue #8). Root cause is a truncated IEND chunk in `-e` PNGs, not the `zTXt` chunk itself — but skipping `-e` for the preview is the simplest fix. |-| Final `-e` PNG won't open in image viewers / vision APIs | Run `python3 <this-skill-dir>/scripts/repair_png.py <path>`. draw.io CLI emits `-e` PNGs with an 8-byte truncation at IEND. SVG/PDF unaffected. |diff --git a/scripts/encode_drawio_url.py b/scripts/encode_drawio_url.pydeleted file mode 100755index c73e9a1..0000000--- a/scripts/encode_drawio_url.py+++ /dev/null@@ -1,33 +0,0 @@-#!/usr/bin/env python3-"""Encode a .drawio XML file into a diagrams.net viewer URL.--Used as the browser fallback when the draw.io desktop CLI is unavailable.-Produces a client-side URL — the diagram XML is encoded in the URL-fragment (after `#`), so nothing is uploaded to any server.--Usage: python3 encode_drawio_url.py <path/to/input.drawio>-"""-import base64-import sys-import urllib.parse-import zlib---def encode(xml: str) -> str:- # Raw deflate (no zlib header) — diagrams.net uses mxGraph's raw inflate- c = zlib.compressobj(9, zlib.DEFLATED, -zlib.MAX_WBITS)- compressed = c.compress(xml.encode("utf-8")) + c.flush()- # Standard base64 (atob rejects url-safe -/_); strip newlines- encoded = base64.b64encode(compressed).decode("utf-8").replace("\n", "")- return (- "https://viewer.diagrams.net/?tags=%7B%7D&lightbox=1&edit=_blank#R"- + urllib.parse.quote(encoded, safe="")- )---if __name__ == "__main__":- if len(sys.argv) != 2:- print("usage: encode_drawio_url.py <path>", file=sys.stderr)- sys.exit(2)- with open(sys.argv[1], "r", encoding="utf-8") as f:- print(encode(f.read()))diff --git a/scripts/repair_png.py b/scripts/repair_png.pydeleted file mode 100755index 7e95b7c..0000000--- a/scripts/repair_png.py+++ /dev/null@@ -1,37 +0,0 @@-#!/usr/bin/env python3-"""Repair truncated IEND chunk in draw.io -e PNG exports (issue #8).--draw.io's CLI emits -e PNGs with the 4-byte IEND length field but missing-the 8 bytes of "IEND" type + CRC. Strict PNG decoders and vision APIs-(Anthropic included) reject the file with 400 "Could not process image".-SVG/PDF are unaffected.--Usage: python3 repair_png.py <path/to/diagram.drawio.png>--Idempotent: the endswith(IEND) guard makes this a no-op once draw.io-fixes the bug upstream, so it's safe to run unconditionally after every--e PNG export.-"""-import sys--IEND = b"\x00\x00\x00\x00IEND\xaeB`\x82"---def repair(path: str) -> bool:- with open(path, "rb") as f:- data = f.read()- if data.endswith(IEND):- return False- if data.endswith(b"\x00\x00\x00\x00"):- data = data[:-4]- with open(path, "wb") as f:- f.write(data + IEND)- return True---if __name__ == "__main__":- if len(sys.argv) != 2:- print("usage: repair_png.py <path>", file=sys.stderr)- sys.exit(2)- if repair(sys.argv[1]):- print(f"repaired {sys.argv[1]}")diff --git a/SKILL.md b/skills/drawio-skill/SKILL.mdsimilarity index 100%rename from SKILL.mdrename to skills/drawio-skill/SKILL.mddiff --git a/plugins/drawio/skills/drawio-skill/references/diagram-types.md b/skills/drawio-skill/references/diagram-types.mdsimilarity index 100%rename from plugins/drawio/skills/drawio-skill/references/diagram-types.mdrename to skills/drawio-skill/references/diagram-types.mddiff --git a/plugins/drawio/skills/drawio-skill/references/style-extraction.md b/skills/drawio-skill/references/style-extraction.mdsimilarity index 100%rename from plugins/drawio/skills/drawio-skill/references/style-extraction.mdrename to skills/drawio-skill/references/style-extraction.mddiff --git a/plugins/drawio/skills/drawio-skill/references/style-presets.md b/skills/drawio-skill/references/style-presets.mdsimilarity index 100%rename from plugins/drawio/skills/drawio-skill/references/style-presets.mdrename to skills/drawio-skill/references/style-presets.mddiff --git a/plugins/drawio/skills/drawio-skill/references/troubleshooting.md b/skills/drawio-skill/references/troubleshooting.mdsimilarity index 100%rename from plugins/drawio/skills/drawio-skill/references/troubleshooting.mdrename to skills/drawio-skill/references/troubleshooting.mddiff --git a/plugins/drawio/skills/drawio-skill/scripts/encode_drawio_url.py b/skills/drawio-skill/scripts/encode_drawio_url.pysimilarity index 100%rename from plugins/drawio/skills/drawio-skill/scripts/encode_drawio_url.pyrename to skills/drawio-skill/scripts/encode_drawio_url.pydiff --git a/plugins/drawio/skills/drawio-skill/scripts/repair_png.py b/skills/drawio-skill/scripts/repair_png.pysimilarity index 100%rename from plugins/drawio/skills/drawio-skill/scripts/repair_png.pyrename to skills/drawio-skill/scripts/repair_png.pydiff --git a/plugins/drawio/skills/drawio-skill/styles/built-in/corporate.json b/skills/drawio-skill/styles/built-in/corporate.jsonsimilarity index 100%rename from plugins/drawio/skills/drawio-skill/styles/built-in/corporate.jsonrename to skills/drawio-skill/styles/built-in/corporate.jsondiff --git a/plugins/drawio/skills/drawio-skill/styles/built-in/default.json b/skills/drawio-skill/styles/built-in/default.jsonsimilarity index 100%rename from plugins/drawio/skills/drawio-skill/styles/built-in/default.jsonrename to skills/drawio-skill/styles/built-in/default.jsondiff --git a/plugins/drawio/skills/drawio-skill/styles/built-in/handdrawn.json b/skills/drawio-skill/styles/built-in/handdrawn.jsonsimilarity index 100%rename from plugins/drawio/skills/drawio-skill/styles/built-in/handdrawn.jsonrename to skills/drawio-skill/styles/built-in/handdrawn.jsondiff --git a/plugins/drawio/skills/drawio-skill/styles/schema.json b/skills/drawio-skill/styles/schema.jsonsimilarity index 100%rename from plugins/drawio/skills/drawio-skill/styles/schema.jsonrename to skills/drawio-skill/styles/schema.jsondiff --git a/styles/built-in/corporate.json b/styles/built-in/corporate.jsondeleted file mode 100644index 1b3f289..0000000--- a/styles/built-in/corporate.json+++ /dev/null@@ -1,49 +0,0 @@-{- "$schema": "../schema.json",- "name": "corporate",- "version": 1,- "default": false,- "source": { "type": "built-in" },- "confidence": "high",- "palette": {- "primary": { "fillColor": "#e3f2fd", "strokeColor": "#1565c0" },- "success": { "fillColor": "#e8f5e9", "strokeColor": "#2e7d32" },- "warning": { "fillColor": "#fff9c4", "strokeColor": "#f57c00" },- "accent": { "fillColor": "#fff3e0", "strokeColor": "#e65100" },- "danger": { "fillColor": "#ffebee", "strokeColor": "#c62828" },- "neutral": { "fillColor": "#eceff1", "strokeColor": "#455a64" },- "secondary": { "fillColor": "#f3e5f5", "strokeColor": "#6a1b9a" }- },- "roles": {- "service": "primary",- "database": "success",- "queue": "warning",- "gateway": "accent",- "error": "danger",- "external": "neutral",- "security": "secondary"- },- "shapes": {- "service": "rounded=0",- "database": "shape=cylinder3",- "queue": "rounded=0",- "decision": "rhombus",- "external": "rounded=0;dashed=1",- "container": "swimlane;startSize=30"- },- "font": {- "fontFamily": "Arial",- "fontSize": 11,- "titleFontSize": 13,- "titleBold": true- },- "edges": {- "style": "edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1",- "arrow": "endArrow=classic;endFill=1",- "dashedFor": ["optional", "async"]- },- "extras": {- "sketch": false,- "globalStrokeWidth": 1- }-}diff --git a/styles/built-in/default.json b/styles/built-in/default.jsondeleted file mode 100644index a202de1..0000000--- a/styles/built-in/default.json+++ /dev/null@@ -1,49 +0,0 @@-{- "$schema": "../schema.json",- "name": "default",- "version": 1,- "default": false,- "source": { "type": "built-in" },- "confidence": "high",- "palette": {- "primary": { "fillColor": "#dae8fc", "strokeColor": "#6c8ebf" },- "success": { "fillColor": "#d5e8d4", "strokeColor": "#82b366" },- "warning": { "fillColor": "#fff2cc", "strokeColor": "#d6b656" },- "accent": { "fillColor": "#ffe6cc", "strokeColor": "#d79b00" },- "danger": { "fillColor": "#f8cecc", "strokeColor": "#b85450" },- "neutral": { "fillColor": "#f5f5f5", "strokeColor": "#666666" },- "secondary": { "fillColor": "#e1d5e7", "strokeColor": "#9673a6" }- },- "roles": {- "service": "primary",- "database": "success",- "queue": "warning",- "gateway": "accent",- "error": "danger",- "external": "neutral",- "security": "secondary"- },- "shapes": {- "service": "rounded=1",- "database": "shape=cylinder3",- "queue": "rounded=1",- "decision": "rhombus",- "external": "rounded=1;dashed=1",- "container": "swimlane;startSize=30"- },- "font": {- "fontFamily": "Helvetica",- "fontSize": 12,- "titleFontSize": 14,- "titleBold": true- },- "edges": {- "style": "edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1",- "arrow": "endArrow=classic;endFill=1",- "dashedFor": []- },- "extras": {- "sketch": false,- "globalStrokeWidth": 1- }-}diff --git a/styles/built-in/handdrawn.json b/styles/built-in/handdrawn.jsondeleted file mode 100644index 1485a5a..0000000--- a/styles/built-in/handdrawn.json+++ /dev/null@@ -1,49 +0,0 @@-{- "$schema": "../schema.json",- "name": "handdrawn",- "version": 1,- "default": false,- "source": { "type": "built-in" },- "confidence": "high",- "palette": {- "primary": { "fillColor": "#ffe4b5", "strokeColor": "#b8651e" },- "success": { "fillColor": "#def0dc", "strokeColor": "#5c8a49" },- "warning": { "fillColor": "#fff4cc", "strokeColor": "#b8901a" },- "accent": { "fillColor": "#ffd9b3", "strokeColor": "#c25100" },- "danger": { "fillColor": "#ffcdbf", "strokeColor": "#a53d3d" },- "neutral": { "fillColor": "#f5e6d3", "strokeColor": "#8b7355" },- "secondary": { "fillColor": "#e6d7e8", "strokeColor": "#7b4397" }- },- "roles": {- "service": "primary",- "database": "success",- "queue": "warning",- "gateway": "accent",- "error": "danger",- "external": "neutral",- "security": "secondary"- },- "shapes": {- "service": "rounded=1",- "database": "shape=cylinder3",- "queue": "rounded=1",- "decision": "rhombus",- "external": "rounded=1;dashed=1",- "container": "swimlane;startSize=30"- },- "font": {- "fontFamily": "Helvetica",- "fontSize": 12,- "titleFontSize": 14,- "titleBold": true- },- "edges": {- "style": "edgeStyle=orthogonalEdgeStyle;curved=1;rounded=1;orthogonalLoop=1;jettySize=auto;html=1",- "arrow": "endArrow=classic;endFill=1",- "dashedFor": ["optional"]- },- "extras": {- "sketch": true,- "globalStrokeWidth": 2- }-}diff --git a/styles/schema.json b/styles/schema.jsondeleted file mode 100644index 6e7ac4a..0000000--- a/styles/schema.json+++ /dev/null@@ -1,112 +0,0 @@-{- "$schema": "http://json-schema.org/draft-07/schema#",- "$id": "https://github.com/Agents365-ai/drawio-skill/styles/schema.json",- "title": "drawio-skill preset",- "type": "object",- "required": ["name", "version", "palette", "roles", "shapes", "font", "edges"],- "additionalProperties": false,- "properties": {- "$schema": { "type": "string" },- "name": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]*$" },- "version": { "type": "integer", "const": 1 },- "default": { "type": "boolean" },- "confidence": { "type": "string", "enum": ["low", "medium", "high"] },- "source": {- "type": "object",- "additionalProperties": false,- "properties": {- "type": { "type": "string", "enum": ["xml", "image", "built-in", "hand-authored"] },- "path": { "type": "string" },- "extracted_at": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }- }- },- "palette": {- "type": "object",- "additionalProperties": false,- "required": ["primary", "success", "warning", "accent", "danger", "neutral", "secondary"],- "properties": {- "primary": { "$ref": "#/$defs/colorPair" },- "success": { "$ref": "#/$defs/colorPair" },- "warning": { "$ref": "#/$defs/colorPair" },- "accent": { "$ref": "#/$defs/colorPair" },- "danger": { "$ref": "#/$defs/colorPair" },- "neutral": { "$ref": "#/$defs/colorPair" },- "secondary": { "$ref": "#/$defs/colorPair" }- }- },- "roles": {- "type": "object",- "additionalProperties": false,- "properties": {- "service": { "$ref": "#/$defs/slotName" },- "database": { "$ref": "#/$defs/slotName" },- "queue": { "$ref": "#/$defs/slotName" },- "gateway": { "$ref": "#/$defs/slotName" },- "error": { "$ref": "#/$defs/slotName" },- "external": { "$ref": "#/$defs/slotName" },- "security": { "$ref": "#/$defs/slotName" }- }- },- "shapes": {- "type": "object",- "additionalProperties": { "type": "string" },- "properties": {- "service": { "type": "string" },- "database": { "type": "string" },- "queue": { "type": "string" },- "decision": { "type": "string" },- "external": { "type": "string" },- "container": { "type": "string" }- }- },- "font": {- "type": "object",- "additionalProperties": false,- "required": ["fontFamily", "fontSize"],- "properties": {- "fontFamily": { "type": "string" },- "fontSize": { "type": "integer", "minimum": 8, "maximum": 36 },- "titleFontSize": { "type": "integer", "minimum": 8, "maximum": 48 },- "titleBold": { "type": "boolean" }- }- },- "edges": {- "type": "object",- "additionalProperties": false,- "required": ["style", "arrow"],- "properties": {- "style": { "type": "string" },- "arrow": { "type": "string" },- "dashedFor": { "type": "array", "items": { "type": "string" } }- }- },- "extras": {- "type": "object",- "additionalProperties": false,- "properties": {- "sketch": { "type": "boolean" },- "globalStrokeWidth": { "type": "number", "minimum": 0.5, "maximum": 6 }- }- }- },- "$defs": {- "colorPair": {- "oneOf": [- { "type": "null" },- {- "type": "object",- "additionalProperties": false,- "required": ["fillColor", "strokeColor"],- "properties": {- "fillColor": { "type": "string", "pattern": "^#[0-9A-Fa-f]{6}$" },- "strokeColor": { "type": "string", "pattern": "^#[0-9A-Fa-f]{6}$" }- }- }- ]- },- "slotName": {- "type": "string",- "enum": ["primary", "success", "warning", "accent", "danger", "neutral", "secondary"]- }- }-}