desktop-integration
draw.io desktop app integration for Claude Code — OS detection, editor paths, CLI export, file watching, and iterative AI+human workflows
What this skill does
# draw.io Desktop Integration
## Overview
This skill covers the integration between Claude Code (running on desktop) and
the draw.io desktop application (Electron-based). It enables a seamless workflow
where the AI generates/edits diagram XML and the user visually refines it in the
desktop editor.
## Platform Detection
### OS Detection Logic
```bash
detect_platform() {
local os="$(uname -s 2>/dev/null || echo unknown)"
case "$os" in
Darwin) echo "macos" ;;
Linux)
# Check if running in WSL
if grep -qi microsoft /proc/version 2>/dev/null; then
echo "wsl"
else
echo "linux"
fi
;;
MINGW*|MSYS*|CYGWIN*) echo "windows" ;;
*)
# Fallback: check for Windows env vars
if [[ -n "${USERPROFILE:-}" ]]; then
echo "windows"
else
echo "unknown"
fi
;;
esac
}
```
### draw.io Executable Locations
| Platform | Common Paths |
|----------|-------------|
| **macOS** | `/Applications/draw.io.app/Contents/MacOS/draw.io` |
| | `~/Applications/draw.io.app/Contents/MacOS/draw.io` |
| **Linux** | `/usr/bin/drawio` (apt/deb) |
| | `/snap/bin/drawio` (snap) |
| | `/opt/drawio/drawio` (manual) |
| | `~/.local/bin/drawio` (user install) |
| | Flatpak: `flatpak run com.jgraph.drawio.desktop` |
| **Windows** | `%LOCALAPPDATA%\Programs\draw.io\draw.io.exe` |
| | `%PROGRAMFILES%\draw.io\draw.io.exe` |
| **WSL** | `/mnt/c/Program Files/draw.io/draw.io.exe` |
| | `/mnt/c/Users/<user>/AppData/Local/Programs/draw.io/draw.io.exe` |
### Detection Priority
1. Check `DRAWIO_EDITOR_PATH` environment variable (user override)
2. Check `PATH` with `command -v drawio`
3. Check platform-specific common paths
4. Check for MCP Tool Server (`@drawio/mcp`) as alternative opener
5. Fall back to browser (`https://app.diagrams.net`)
## draw.io Desktop CLI Reference
The draw.io desktop app supports command-line operations:
### Export Commands
```bash
# Export to SVG
drawio --export --format svg input.drawio -o output.svg
# Export to PNG with 2x scale (retina)
drawio --export --format png --scale 2 input.drawio -o output.png
# Export to PDF
drawio --export --format pdf input.drawio -o output.pdf
# Export with embedded diagram XML (re-editable)
drawio --export --format svg --embed-diagram input.drawio -o output.drawio.svg
# Export specific page (0-indexed)
drawio --export --format svg --page-index 2 input.drawio -o page3.svg
# Export with transparent background
drawio --export --format png --transparent input.drawio -o output.png
# Export with border padding
drawio --export --format png --border 10 input.drawio -o output.png
# Export cropped to content
drawio --export --format svg --crop input.drawio -o output.svg
# Export all pages
drawio --export --format png --all-pages input.drawio -o output.png
```
### Headless Export (Linux CI/CD)
When no display is available (SSH, Docker, CI), use `xvfb-run`:
```bash
# Install xvfb
sudo apt-get install -y xvfb
# Export with virtual framebuffer
xvfb-run -a drawio --export --format svg input.drawio -o output.svg
# Batch export all diagrams
for f in docs/*.drawio; do
xvfb-run -a drawio --export --format svg --embed-diagram "$f" \
-o "${f%.drawio}.drawio.svg"
done
```
### Version Check
```bash
drawio --version
# Example output: 24.7.17
```
## Desktop Workflows
### Workflow 1: AI Creates → User Refines
```
Claude Code draw.io Desktop
───────────── ───────────────
1. drawio:create --output arch.drawio
↓ writes XML file
2. drawio:open --file arch.drawio
↓ launches desktop app ──────→ 3. User sees diagram
4. User drags/resizes/adds
5. User saves (Ctrl+S)
↓ detects file change
6. Read the updated XML
7. drawio:enrich --level 2 arch.drawio
↓ writes enriched XML ───────→ 8. Desktop auto-reloads
```
### Workflow 2: User Designs → AI Exports
```
draw.io Desktop Claude Code
─────────────── ─────────────
1. User creates diagram visually
2. User saves as project.drawio
3. drawio:analyze project.drawio
→ quality report
4. drawio:export --format svg
--embed-diagram
5. drawio:embed --platform github
```
### Workflow 3: Side-by-Side Editing
```
Claude Code (terminal) draw.io Desktop (window)
────────────────────── ────────────────────────
1. drawio:edit --add-vertex Auto-reload shows new shape
"Auth Service"
2. drawio:edit --connect-to Auto-reload shows connection
"auth-svc" "api-gw"
3. drawio:style --preset dark Auto-reload shows dark theme
```
### Workflow 4: WSL Integration
When running Claude Code in WSL but want to use Windows draw.io:
```bash
# Convert WSL path to Windows path
WINPATH=$(wslpath -w "$PWD/docs/architecture.drawio")
# Open in Windows draw.io
"/mnt/c/Program Files/draw.io/draw.io.exe" "$WINPATH" &
# Or use Windows file association
cmd.exe /C "start \"\" \"$WINPATH\"" 2>/dev/null
```
## Installation Guides
### macOS
```bash
# Homebrew (recommended)
brew install --cask drawio
# Verify
/Applications/draw.io.app/Contents/MacOS/draw.io --version
```
### Ubuntu/Debian
```bash
# Snap (auto-updates)
sudo snap install drawio
# Or .deb package
DRAWIO_VERSION="24.7.17"
wget "https://github.com/jgraph/drawio-desktop/releases/download/v${DRAWIO_VERSION}/drawio-amd64-${DRAWIO_VERSION}.deb"
sudo dpkg -i "drawio-amd64-${DRAWIO_VERSION}.deb"
sudo apt-get install -f # fix dependencies if needed
# Verify
drawio --version
```
### Fedora/RHEL
```bash
# Snap
sudo dnf install snapd
sudo snap install drawio
# Or Flatpak
flatpak install flathub com.jgraph.drawio.desktop
```
### Windows
```powershell
# Winget (recommended)
winget install JGraph.Draw
# Chocolatey
choco install drawio
# Verify
& "$env:LOCALAPPDATA\Programs\draw.io\draw.io.exe" --version
```
### Arch Linux
```bash
# AUR
yay -S drawio-desktop-bin
```
## MCP + Desktop Combined Setup
For the richest desktop experience, combine the MCP Tool Server with desktop app:
### Claude Code (.mcp.json)
```json
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["@drawio/mcp"],
"env": {
"DRAWIO_EDITOR_PATH": "/usr/bin/drawio"
}
}
}
}
```
The MCP Tool Server's `open_diagram` tool will use the configured editor path.
### Claude Desktop (claude_desktop_config.json)
```json
{
"mcpServers": {
"drawio-app": {
"url": "https://mcp.draw.io/mcp"
},
"drawio-tool": {
"command": "npx",
"args": ["@drawio/mcp"]
}
}
}
```
## File Watching
### Native File Watching with fswatch (macOS)
```bash
fswatch -o docs/architecture.drawio | while read _; do
echo "[$(date '+%H:%M:%S')] Diagram changed — re-analyzing..."
# Trigger re-analysis or export
done
```
### inotifywait (Linux)
```bash
inotifywait -m -e modify docs/architecture.drawio | while read _; do
echo "[$(date '+%H:%M:%S')] Diagram changed"
done
```
### PowerShell (Windows)
```powershell
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = "docs"
$watcher.Filter = "*.drawio"
$watcher.EnableRaisingEvents = $true
Register-ObjectEvent $watcher Changed -Action {
Write-Host "Diagram changed at $(Get-Date -Format 'HH:mm:ss')"
}
```
## Auto-Reload Behavior
The draw.io desktop app monitors open files for external changes:
- **Default**: Prompts the user when an external change is detected
- **Setting**: `Extras → Edit Configuration` → add `"autoSave": true` for auto-reload
- **draw.io config file** (`.drawio.json` in user home):
```json
{
"autoSave": true,
"autoSaRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.