Draw.io diagram generation and analysis skill: mandatory layout and style rules, XML reference, negative-space companion diagrams, and the drawio-tools TypeScript CLI with 12 analysis/validation actions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
60 lines
2.5 KiB
Markdown
60 lines
2.5 KiB
Markdown
# drawio-main — Capabilities
|
|
|
|
This file lists all capabilities an agent can use from this skill.
|
|
|
|
---
|
|
|
|
## Capability 1 — Diagram generation
|
|
|
|
Create `.drawio` files (and optionally export to PNG/SVG/PDF) from a description or requirements.
|
|
|
|
See [SKILL.md](./SKILL.md) for the generation workflow, XML format, page sizes, element shapes, and well-formedness rules.
|
|
See [SKILL-RULES-LAYOUT.md](./SKILL-RULES-LAYOUT.md) for mandatory connector and layout rules.
|
|
|
|
---
|
|
|
|
## Capability 2 — Diagram analysis (drawio-tools CLI)
|
|
|
|
A **TypeScript / Node.js** CLI tool for programmatic analysis of `.drawio` files.
|
|
Entry point: `node dist/cli/commands.js` (run from `.skills/drawio-main/`).
|
|
|
|
### Usage
|
|
|
|
```bash
|
|
node dist/cli/commands.js --file <path-to-file.drawio> --action <action> [--page <index>]
|
|
# short flags: -f, -a, -p, -h
|
|
```
|
|
|
|
`--page` selects the diagram tab (0-based, default 0). Ignored by `summary` (processes all pages).
|
|
Always prints YAML to stdout. Exit code `0` on success, `1` on error.
|
|
|
|
### Actions
|
|
|
|
#### Inventory
|
|
|
|
| Action | Scope | Description |
|
|
|---|---|---|
|
|
| `summary` | All pages | Full inventory of shapes + edges for every page/tab |
|
|
| `page-summary` | Single page (`--page`) | Full inventory of shapes + edges for one page |
|
|
| `page-hierarchy` | Page 0 | Recursive containment tree with totalLevels (nesting depth count) |
|
|
| `page-hierarchy-full` | Page 0 | Same as page-hierarchy + full geometry (x, y, width, height) per shape at each nesting level |
|
|
| `page-connectors-summary` | Page 0 | Per-connector details: type, label, waypoints, source/target names |
|
|
|
|
#### Validation
|
|
|
|
| Action | Scope | Description |
|
|
|---|---|---|
|
|
| `validate` | All pages | **Mandatory final gate** — XML well-formedness + maxGraph compile + sanity check (vertices/edges > 0). Run before finishing any diagram work |
|
|
| `page-connectors-validation` | Page 0 | Connector-shape overlaps + connector crossings |
|
|
| `page-labels-validation` | Page 0 | Empty labels, duplicate labels, labels > 80 chars |
|
|
| `page-shape-bbox-validation` | Page 0 | Non-containment bounding box overlaps between shapes |
|
|
| `page-orphans` | Page 0 | Isolated shapes (no edges) + dangling connectors (missing endpoints) |
|
|
|
|
#### Layout
|
|
|
|
| Action | Scope | Description |
|
|
|---|---|---|
|
|
| `page-recommendations` | Page 0 | Smallest standard page size (A4→A3→A2→A1→custom) that fits content with 80 px margin |
|
|
|
|
> For install/build instructions, source structure, and how to add new actions, see [SKILL-MAINTENANCE.md](./SKILL-MAINTENANCE.md).
|