/bpmn-plugin:bpmn-to-drawio <bpmn-file-path>from bpmn-plugin
Converts BPMN 2.0 XML files to Draw.io (.drawio) format using the bpmn2drawio Python tool. Handles dependency installation and Graphviz-based layout.
Ships in bpmn-plugin. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This skill converts BPMN 2.0 XML files into Draw.io native format (.drawio) using the bpmn2drawio Python tool. The tool provides:
Follow these steps in order. The workflow automatically handles dependency installation.
The tool is bundled in the plugin's tools/bpmn2drawio/ directory. Use ${CLAUDE_PLUGIN_ROOT} for the plugin path (auto-set for marketplace-installed plugins):
# Use CLAUDE_PLUGIN_ROOT (auto-set for marketplace-installed plugins)
PLUGIN_DIR="${CLAUDE_PLUGIN_ROOT:-/path/to/plugins/bpmn-plugin}"
TOOL_SRC="$PLUGIN_DIR/tools/bpmn2drawio/src"
Check for required Python packages and install any that are missing:
# Check which packages are missing
python -c "import lxml" 2>/dev/null || echo "lxml: MISSING"
python -c "import networkx" 2>/dev/null || echo "networkx: MISSING"
python -c "import yaml" 2>/dev/null || echo "pyyaml: MISSING"
python -c "import pygraphviz" 2>/dev/null || echo "pygraphviz: MISSING (requires Graphviz)"
If any packages are missing (except pygraphviz), ask the user:
"The following Python packages are missing: [list]. Install them now with
pip install [packages]?"
If user approves:
pip install lxml networkx pyyaml
Note: pygraphviz is handled separately in Step 3 because it requires Graphviz.
The tool's default --layout auto resolves to preserve — using the file's own BPMN DI coordinates — only when every element in the file already has a position, and falls back to Graphviz-based layout otherwise. Graphviz is therefore not required for files with complete DI coordinates, but you can't know in advance which files those are, so check availability up front:
# Check for Graphviz
dot -V 2>/dev/null && echo "Graphviz: OK" || echo "Graphviz: MISSING"
If Graphviz is missing, display this standardized error:
Error: Required dependency 'graphviz' not found
/bpmn-to-drawio requires Graphviz when a BPMN file's DI coordinates are
missing or incomplete (the default --layout auto falls back to Graphviz
in that case).
Installation instructions:
Windows: choco install graphviz
macOS: brew install graphviz
Linux: sudo apt install graphviz libgraphviz-dev
After installing Graphviz, also install the Python bindings:
pip install pygraphviz
After installing, run the command again.
Note: If your BPMN file already has COMPLETE layout coordinates (every
element positioned), --layout auto will use them and Graphviz is not
needed. Do not force --layout=preserve as a workaround unless you have
verified the file's DI is complete — on a partially-positioned file it
strands the unpositioned elements at (0,0) instead of laying them out.
If user wants to install Graphviz, guide them through:
# Detect OS and install
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get update && sudo apt-get install -y graphviz libgraphviz-dev
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install graphviz
elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]] || [[ -n "$WINDIR" ]]; then
choco install graphviz -y
fi
After Graphviz is installed, install pygraphviz:
pip install pygraphviz
Check for structural complexity — used later to populate the conversion summary:
<bpmn:participant> - Multiple pools<bpmn:lane> - Swimlanes presentThe tool's --layout auto (the default; see Step 5) inspects the parsed model and resolves the layout mode itself. Do not grep the file for DI coordinates here to pre-select a --layout flag — that duplicates a decision the tool already makes correctly.
Default (--layout auto) — let the tool decide:
PYTHONPATH="$TOOL_SRC" python -m bpmn2drawio input.bpmn output.drawio
This is the recommended invocation for nearly all conversions. auto is the default when --layout is omitted; the tool inspects the parsed model and resolves preserve or graphviz itself — no pre-check of the file's DI content required.
Explicit override — only after verifying the file's DI is complete:
PYTHONPATH="$TOOL_SRC" python -m bpmn2drawio input.bpmn output.drawio --layout=preserve
Forcing preserve on a file whose DI is missing or incomplete strands the unpositioned elements at (0,0). Prefer the default auto unless you have specifically verified every element already has a position.
Explicit override — force Graphviz even if DI coordinates exist:
PYTHONPATH="$TOOL_SRC" python -m bpmn2drawio input.bpmn output.drawio --layout=graphviz
With theme:
PYTHONPATH="$TOOL_SRC" python -m bpmn2drawio input.bpmn output.drawio --theme=blueprint
Verbose output for debugging:
PYTHONPATH="$TOOL_SRC" python -m bpmn2drawio input.bpmn output.drawio --verbose
Verify the conversion succeeded:
# Check file was created and has content
ls -la output.drawio
head -30 output.drawio
Full command syntax, arguments, --theme/--layout/--direction/etc. options, and direction values — see ../references/bpmn2drawio-reference.md#cli-reference.
Built-in theme options (default, blueprint, monochrome, high_contrast) and custom YAML brand configuration (event/task/gateway/swimlane colors, lane-color pattern matching) — see ../references/bpmn2drawio-reference.md#themes.
Dependencies are checked and installed automatically during the conversion workflow (Steps 2-3).
lxml - XML parsingnetworkx - Graph algorithmspyyaml - YAML configuration parsingpygraphviz - Graphviz Python bindings (requires Graphviz)--layout auto resolves to preserve automatically in that casePython packages:
pip install lxml networkx pyyaml pygraphviz
Graphviz:
sudo apt-get install graphviz libgraphviz-devbrew install graphvizchoco install graphvizFor programmatic use within scripts (Converter, parse_bpmn, validate_model) — see ../references/bpmn2drawio-reference.md#python-api.
Full tables of supported Events, Activities, Gateways, Flows, and Containers (pools/lanes) — see ../references/bpmn2drawio-reference.md#supported-bpmn-elements.
| Issue | Cause | Solution |
|---|---|---|
ModuleNotFoundError: bpmn2drawio | PYTHONPATH not set | Set PYTHONPATH="$TOOL_SRC" before running |
ModuleNotFoundError: lxml | Missing dependency | Run pip install lxml |
ModuleNotFoundError: pygraphviz | Graphviz not installed | Install Graphviz first, then pip install pygraphviz |
| Empty output file | Invalid BPMN input | Check BPMN file validity |
| Elements overlapping / stranded at (0,0) | --layout=preserve forced on a file with incomplete DI | Don't force --layout=preserve — use the default --layout auto, which already falls back to Graphviz for incomplete DI |
| Wrong flow direction | Default is LR | Use --direction=TB for vertical |
If the tool reports validation warnings:
# Run with verbose to see details
bpmn2drawio input.bpmn output.drawio --verbose
Common validation issues:
The tool attempts recovery for most issues but warnings indicate potential problems.
If output doesn't render correctly in Draw.io:
<mxCell> elements with valid geometryparent="1"After successful conversion, report:
## Draw.io Conversion Summary
**Source File:** input.bpmn
**Output File:** output.drawio
**Theme:** default
**Layout:** graphviz
**Direction:** LR
### Elements Converted:
- Pools: X
- Lanes: X
- Tasks: X
- Gateways: X
- Events: X
- Sequence Flows: X
- Message Flows: X
### Validation:
✓ All elements converted successfully
✓ No orphan elements detected
✓ All flows connected
### Next Steps:
- Open output.drawio in Draw.io Desktop or diagrams.net
- Verify visual layout matches expectations
- Adjust element positions if needed
If the bpmn2drawio tool is unavailable and cannot be installed, fall back to manual conversion using the reference documents:
../references/BPMN-to-DrawIO-Conversion-Standard.md../templates/element-styles.yaml../templates/drawio-skeleton.xmlCritical Rules for Manual Conversion:
parent="1" with absolute mxPoint coordinates| BPMN Size | Elements | Expected Duration | Notes |
|---|---|---|---|
| Small | 5-15 | Under 10 seconds | Simple processes, single pool |
| Medium | 15-50 | 10-30 seconds | Multiple lanes, moderate gateways |
| Large | 50-100 | 30-90 seconds | Multiple pools, complex routing |
| Very large | 100+ | 1-3 minutes | Graphviz layout dominates at scale |
Duration is dominated by Graphviz layout computation for files whose DI coordinates are missing or incomplete. When a file's DI coordinates are complete, the default --layout auto resolves to preserve automatically and conversion finishes in under 5 seconds regardless of size — no flag needed. Do not force --layout=preserve on a file with incomplete DI as a speed optimization: unpositioned elements are stranded at (0,0) instead of being laid out. Dependency installation (first run only) may add 30-60 seconds.
../tools/bpmn2drawio/ (source code included in this plugin)../references/BPMN-to-DrawIO-Conversion-Standard.md../templates/element-styles.yaml../templates/drawio-skeleton.xml../examples/What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub davistroy/claude-marketplace --plugin bpmn-plugin2 skills in this plugin