Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Generate Excalidraw .excalidraw JSON diagram files from natural language descriptions of processes and systems.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/README.md
1# Excalidraw Library Tools23This directory contains scripts for working with Excalidraw libraries.45## split-excalidraw-library.py67Splits an Excalidraw library file (`*.excalidrawlib`) into individual icon JSON files for efficient token usage by AI assistants.89### Prerequisites1011- Python 3.6 or higher12- No additional dependencies required (uses only standard library)1314### Usage1516```bash17python split-excalidraw-library.py <path-to-library-directory>18```1920### Step-by-Step Workflow21221. **Create library directory**:23```bash24mkdir -p skills/excalidraw-diagram-generator/libraries/aws-architecture-icons25```26272. **Download and place library file**:28- Visit: https://libraries.excalidraw.com/29- Search for "AWS Architecture Icons" and download the `.excalidrawlib` file30- Rename it to match the directory name: `aws-architecture-icons.excalidrawlib`31- Place it in the directory created in step 132333. **Run the script**:34```bash35python skills/excalidraw-diagram-generator/scripts/split-excalidraw-library.py skills/excalidraw-diagram-generator/libraries/aws-architecture-icons/36```3738### Output Structure3940The script creates the following structure in the library directory:4142```43skills/excalidraw-diagram-generator/libraries/aws-architecture-icons/44aws-architecture-icons.excalidrawlib # Original file (kept)45reference.md # Generated: Quick reference table46icons/ # Generated: Individual icon files47API-Gateway.json48CloudFront.json49EC2.json50S3.json51...52```5354### What the Script Does55561. **Reads** the `.excalidrawlib` file572. **Extracts** each icon from the `libraryItems` array583. **Sanitizes** icon names to create valid filenames (spaces → hyphens, removes special characters)594. **Saves** each icon as a separate JSON file in the `icons/` directory605. **Generates** a `reference.md` file with a table mapping icon names to filenames6162### Benefits6364- **Token Efficiency**: AI can first read the lightweight `reference.md` to find relevant icons, then load only the specific icon files needed65- **Organization**: Icons are organized in a clear directory structure66- **Extensibility**: Users can add multiple library sets side-by-side6768### Recommended Workflow69701. Download desired Excalidraw libraries from https://libraries.excalidraw.com/712. Run this script on each library file723. Move the generated folders to `../libraries/`734. The AI assistant will use `reference.md` files to locate and use icons efficiently7475### Library Sources (Examples — verify availability)7677- Examples found on https://libraries.excalidraw.com/ may include cloud/service icon sets.78- Availability changes over time; verify the exact library names on the site before use.79- This script works with any valid `.excalidrawlib` file you provide.8081### Troubleshooting8283**Error: File not found**84- Check that the file path is correct85- Make sure the file has a `.excalidrawlib` extension8687**Error: Invalid library file format**88- Ensure the file is a valid Excalidraw library file89- Check that it contains a `libraryItems` array9091### License Considerations9293When using third-party icon libraries:94- **AWS Architecture Icons**: Subject to AWS Content License95- **GCP Icons**: Subject to Google's terms96- **Other libraries**: Check each library's license9798This script is for personal/organizational use. Redistribution of split icon files should comply with the original library's license terms.99100## add-icon-to-diagram.py101102Adds a specific icon from a split Excalidraw library into an existing `.excalidraw` diagram. The script handles coordinate translation and ID collision avoidance, and can optionally add a label under the icon.103104### Prerequisites105106- Python 3.6 or higher107- A diagram file (`.excalidraw`)108- A split icon library directory (created by `split-excalidraw-library.py`)109110### Usage111112```bash113python add-icon-to-diagram.py <diagram-path> <icon-name> <x> <y> [OPTIONS]114```115116**Options**117- `--library-path PATH` : Path to the icon library directory (default: `aws-architecture-icons`)118- `--label TEXT` : Add a text label below the icon119-- `--use-edit-suffix` : Edit via `.excalidraw.edit` to avoid editor overwrite issues (enabled by default; pass `--no-use-edit-suffix` to disable)120121### Examples122123```bash124# Add EC2 icon at position (400, 300)125python add-icon-to-diagram.py diagram.excalidraw EC2 400 300126127# Add VPC icon with label128python add-icon-to-diagram.py diagram.excalidraw VPC 200 150 --label "VPC"129130# Safe edit mode is enabled by default (avoids editor overwrite issues)131# Use `--no-use-edit-suffix` to disable132python add-icon-to-diagram.py diagram.excalidraw EC2 500 300133134# Add icon from another library135python add-icon-to-diagram.py diagram.excalidraw Compute-Engine 500 200 \136--library-path libraries/gcp-icons --label "API Server"137```138139### What the Script Does1401411. **Loads** the icon JSON from the library’s `icons/` directory1422. **Calculates** the icon’s bounding box1433. **Offsets** all coordinates to the target position1444. **Generates** unique IDs for all elements and groups1455. **Appends** the transformed elements to the diagram1466. **(Optional)** Adds a label beneath the icon147148---149150## add-arrow.py151152Adds a straight arrow between two points in an existing `.excalidraw` diagram. Supports optional labels and line styles.153154### Prerequisites155156- Python 3.6 or higher157- A diagram file (`.excalidraw`)158159### Usage160161```bash162python add-arrow.py <diagram-path> <from-x> <from-y> <to-x> <to-y> [OPTIONS]163```164165**Options**166- `--style {solid|dashed|dotted}` : Line style (default: `solid`)167- `--color HEX` : Arrow color (default: `#1e1e1e`)168- `--label TEXT` : Add a text label on the arrow169-- `--use-edit-suffix` : Edit via `.excalidraw.edit` to avoid editor overwrite issues (enabled by default; pass `--no-use-edit-suffix` to disable)170171### Examples172173```bash174# Simple arrow175python add-arrow.py diagram.excalidraw 300 200 500 300176177# Arrow with label178python add-arrow.py diagram.excalidraw 300 200 500 300 --label "HTTPS"179180# Dashed arrow with custom color181python add-arrow.py diagram.excalidraw 400 350 600 400 --style dashed --color "#7950f2"182183# Safe edit mode is enabled by default (avoids editor overwrite issues)184# Use `--no-use-edit-suffix` to disable185python add-arrow.py diagram.excalidraw 300 200 500 300186```187188### What the Script Does1891901. **Creates** an arrow element from the given coordinates1912. **(Optional)** Adds a label near the arrow midpoint1923. **Appends** elements to the diagram1934. **Saves** the updated file194