Excalidraw Diagram Generator
A skill for generating Excalidraw-format diagrams from natural language descriptions. This skill helps create visual representations of processes, systems, relationships, and ideas without manual drawing.
When to Use This Skill
Use this skill when users request:
- "Create a diagram showing..."
- "Make a flowchart for..."
- "Visualize the process of..."
- "Draw the system architecture of..."
- "Generate a mind map about..."
- "Create an Excalidraw file for..."
- "Show the relationship between..."
- "Diagram the workflow of..."
Supported diagram types:
- 📊 Flowcharts: Sequential processes, workflows, decision trees
- 🔗 Relationship Diagrams: Entity relationships, system components, dependencies
- 🧠 Mind Maps: Concept hierarchies, brainstorming results, topic organization
- 🏗️ Architecture Diagrams: System design, module interactions, data flow
- 📈 Data Flow Diagrams (DFD): Data flow visualization, data transformation processes
- 🏊 Business Flow (Swimlane): Cross-functional workflows, actor-based process flows
- 📦 Class Diagrams: Object-oriented design, class structures and relationships
- 🔄 Sequence Diagrams: Object interactions over time, message flows
- 🗃️ ER Diagrams: Database entity relationships, data models
Prerequisites
- Clear description of what should be visualized
- Identification of key entities, steps, or concepts
- Understanding of relationships or flow between elements
Step-by-Step Workflow
Step 1: Understand the Request
Analyze the user's description to determine:
- Diagram type (flowchart, relationship, mind map, architecture)
- Key elements (entities, steps, concepts)
- Relationships (flow, connections, hierarchy)
- Complexity (number of elements)
Step 2: Choose the Appropriate Diagram Type
| User Intent |
Diagram Type |
Example Keywords |
| Process flow, steps, procedures |
Flowchart |
"workflow", "process", "steps", "procedure" |
| Connections, dependencies, associations |
Relationship Diagram |
"relationship", "connections", "dependencies", "structure" |
| Concept hierarchy, brainstorming |
Mind Map |
"mind map", "concepts", "ideas", "breakdown" |
| System design, components |
Architecture Diagram |
"architecture", "system", "components", "modules" |
| Data flow, transformation processes |
Data Flow Diagram (DFD) |
"data flow", "data processing", "data transformation" |
| Cross-functional processes, actor responsibilities |
Business Flow (Swimlane) |
"business process", "swimlane", "actors", "responsibilities" |
| Object-oriented design, class structures |
Class Diagram |
"class", "inheritance", "OOP", "object model" |
| Interaction sequences, message flows |
Sequence Diagram |
"sequence", "interaction", "messages", "timeline" |
| Database design, entity relationships |
ER Diagram |
"database", "entity", "relationship", "data model" |
Step 3: Extract Structured Information
For Flowcharts:
- List of sequential steps
- Decision points (if any)
- Start and end points
For Relationship Diagrams:
- Entities/nodes (name + optional description)
- Relationships between entities (from → to, with label)
For Mind Maps:
- Central topic
- Main branches (3-6 recommended)
- Sub-topics for each branch (optional)
For Data Flow Diagrams (DFD):
- Data sources and destinations (external entities)
- Processes (data transformations)
- Data stores (databases, files)
- Data flows (arrows showing data movement from left-to-right or from top-left to bottom-right)
- Important: Do not represent process order, only data flow
For Business Flow (Swimlane):
- Actors/roles (departments, systems, people) - displayed as header columns
- Process lanes (vertical lanes under each actor)
- Process boxes (activities within each lane)
- Flow arrows (connecting process boxes, including cross-lane handoffs)
For Class Diagrams:
- Classes with names
- Attributes with visibility (+, -, #)
- Methods with visibility and parameters
- Relationships: inheritance (solid line + white triangle), implementation (dashed line + white triangle), association (solid line), dependency (dashed line), aggregation (solid line + white diamond), composition (solid line + filled diamond)
- Multiplicity notations (1, 0..1, 1..*, *)
For Sequence Diagrams:
- Objects/actors (arranged horizontally at top)
- Lifelines (vertical lines from each object)
- Messages (horizontal arrows between lifelines)
- Synchronous messages (solid arrow), asynchronous messages (dashed arrow)
- Return values (dashed arrows)
- Activation boxes (rectangles on lifelines during execution)
- Time flows from top to bottom
For ER Diagrams:
- Entities (rectangles with entity names)
- Attributes (listed inside entities)
- Primary keys (underlined or marked with PK)
- Foreign keys (marked with FK)
- Relationships (lines connecting entities)
- Cardinality: 1:1 (one-to-one), 1:N (one-to-many), N:M (many-to-many)
- Junction/associative entities for many-to-many relationships (dashed rectangles)
Step 4: Generate the Excalidraw JSON
Create the .excalidraw file with appropriate elements:
Available element types:
rectangle: Boxes for entities, steps, concepts
ellipse: Alternative shapes for emphasis
diamond: Decision points
arrow: Directional connections
text: Labels and annotations
Key properties to set:
- Position:
x, y coordinates
- Size:
width, height
- Style:
strokeColor, backgroundColor, fillStyle
- Font:
fontFamily: 5 (Excalifont - required for all text elements)
- Text: Embedded text for labels
- Connections:
points array for arrows
Important: All text elements must use fontFamily: 5 (Excalifont) for consistent visual appearance.
Step 5: Format the Output
Structure the complete Excalidraw file:
{
"type": "excalidraw",
"version": 2,
"source": "https://excalidraw.com",
"elements": [
// Array of diagram elements
],
"appState": {
"viewBackgroundColor": "#ffffff",
"gridSize": 20
},
"files": {}
}
Step 6: Save and Provide Instructions
- Save as
<descriptive-name>.excalidraw
- Inform user how to open:
Best Practices
Element Count Guidelines
| Diagram Type |
Recommended Count |
Maximum |
| Flowchart steps |
3-10 |
15 |
| Relationship entities |
3-8 |
12 |
| Mind map branches |
4-6 |
8 |
| Mind map sub-topics per branch |
2-4 |
6 |
Layout Tips
- Start positions: Center important elements, use consistent spacing
- Spacing:
- Horizontal gap: 200-300px between elements
- Vertical gap: 100-150px between rows
- Colors: Use consistent color scheme
- Primary elements: Light blue (
#a5d8ff)
- Secondary elements: Light green (
#b2f2bb)
- Important/Central: Yellow (
#ffd43b)
- Alerts/Warnings: Light red (
#ffc9c9)
- Text sizing: 16-24px for readability
- Font: Always use
fontFamily: 5 (Excalifont) for all text elements
- Arrow style: Use straight arrows for simple flows, curved for complex relationships
Complexity Management
If user request has too many elements:
- Suggest breaking into multiple diagrams
- Focus on main elements first
- Offer to create detailed sub-diagrams
Example response:
"Your request includes 15 components. For clarity, I recommend:
1. High-level architecture diagram (6 main components)
2. Detailed diagram for each subsystem
Would you like me to start with the high-level view?"
Example Prompts and Responses
Example 1: Simple Flowchart
User: "Create a flowchart for user registration"
Agent generates:
- Extract steps: "Enter email" → "Verify email" → "Set password" → "Complete"
- Create flowchart with 4 rectangles + 3 arrows
- Save as
user-registration-flow.excalidraw
Example 2: Relationship Diagram
User: "Diagram the relationship between User, Post, and Comment entities"
Agent generates:
- Entities: User, Post, Comment
- Relationships: User → Post ("creates"), User → Comment ("writes"), Post → Comment ("contains")
- Save as
user-content-relationships.excalidraw
Example 3: Mind Map
User: "Mind map about machine learning concepts"
Agent generates:
- Center: "Machine Learning"
- Branches: Supervised Learning, Unsupervised Learning, Reinforcement Learning, Deep Learning
- Sub-topics under each branch
- Save as
machine-learning-mindmap.excalidraw
Troubleshooting
| Issue |
Solution |
| Elements overlap |
Increase spacing between coordinates |
| Text doesn't fit in boxes |
Increase box width or reduce font size |
| Too many elements |
Break into multiple diagrams |
| Unclear layout |
Use grid layout (rows/columns) or radial layout (mind maps) |
| Colors inconsistent |
Define color palette upfront based on element types |
Advanced Techniques
Grid Layout (for Relationship Diagrams)
const columns = Math.ceil(Math.sqrt(entityCount));
const x = startX + (index % columns) * horizontalGap;
const y = startY + Math.floor(index / columns) * verticalGap;
Radial Layout (for Mind Maps)
const angle = (2 * Math.PI * index) / branchCount;
const x = centerX + radius * Math.cos(angle);
const y = centerY + radius * Math.sin(angle);
Auto-generated IDs
Use timestamp + random string for unique IDs:
const id = Date.now().toString(36) + Math.random().toString(36).substr(2);
Output Format
Always provide:
- ✅ Complete
.excalidraw JSON file
- 📊 Summary of what was created
- 📝 Element count
- 💡 Instructions for opening/editing
Example summary:
Created: user-workflow.excalidraw
Type: Flowchart
Elements: 7 rectangles, 6 arrows, 1 title text
Total: 14 elements
To view:
1. Visit https://excalidraw.com
2. Drag and drop user-workflow.excalidraw
3. Or use File → Open in Excalidraw VS Code extension
Validation Checklist
Before delivering the diagram:
Icon Libraries (Optional Enhancement)
For specialized diagrams (e.g., AWS/GCP/Azure architecture diagrams), you can use pre-made icon libraries from Excalidraw. This provides professional, standardized icons instead of basic shapes.
When User Requests Icons
If user asks for AWS/cloud architecture diagrams or mentions wanting to use specific icons:
Check if library exists: Look for libraries/<library-name>/reference.md
If library exists: Proceed to use icons (see AI Assistant Workflow below)
If library does NOT exist: Respond with setup instructions:
To use [AWS/GCP/Azure/etc.] architecture icons, please follow these steps:
1. Visit https://libraries.excalidraw.com/
2. Search for "[AWS Architecture Icons/etc.]" and download the .excalidrawlib file
3. Create directory: skills/excalidraw-diagram-generator/libraries/[icon-set-name]/
4. Place the downloaded file in that directory
5. Run the splitter script:
python skills/excalidraw-diagram-generator/scripts/split-excalidraw-library.py skills/excalidraw-diagram-generator/libraries/[icon-set-name]/
This will split the library into individual icon files for efficient use.
After setup is complete, I can create your diagram using the actual AWS/cloud icons.
Alternatively, I can create the diagram now using simple shapes (rectangles, ellipses)
which you can later replace with icons manually in Excalidraw.
User Setup Instructions (Detailed)
Step 1: Create Library Directory
mkdir -p skills/excalidraw-diagram-generator/libraries/aws-architecture-icons
Step 2: Download Library
- Visit: https://libraries.excalidraw.com/
- Search for your desired icon set (e.g., "AWS Architecture Icons")
- Click download to get the
.excalidrawlib file
- Example categories (availability varies; confirm on the site):
- Cloud service icons
- UI/Material icons
- Flowchart symbols
Step 3: Place Library File
- Rename the downloaded file to match the directory name (e.g.,
aws-architecture-icons.excalidrawlib)
- Move it to the directory created in Step 1
Step 4: Run Splitter Script
python skills/excalidraw-diagram-generator/scripts/split-excalidraw-library.py skills/excalidraw-diagram-generator/libraries/aws-architecture-icons/
Step 5: Verify Setup
After running the script, verify the following structure exists:
skills/excalidraw-diagram-generator/libraries/aws-architecture-icons/
aws-architecture-icons.excalidrawlib (original)
reference.md (generated - icon lookup table)
icons/ (generated - individual icon files)
API-Gateway.json
CloudFront.json
EC2.json
Lambda.json
RDS.json
S3.json
...
AI Assistant Workflow
When icon libraries are available in libraries/:
RECOMMENDED APPROACH: Use Python Scripts (Efficient & Reliable)
The repository includes Python scripts that handle icon integration automatically:
Create base diagram structure:
- Create
.excalidraw file with basic layout (title, boxes, regions)
- This establishes the canvas and overall structure
Add icons using Python script:
python skills/excalidraw-diagram-generator/scripts/add-icon-to-diagram.py \
<diagram-path> <icon-name> <x> <y> [--label "Text"] [--library-path PATH]
- Edit via
.excalidraw.edit is enabled by default to avoid overwrite issues; pass --no-use-edit-suffix to disable.
Examples:
# Add EC2 icon at position (400, 300) with label
python scripts/add-icon-to-diagram.py diagram.excalidraw EC2 400 300 --label "Web Server"
# Add VPC icon at position (200, 150)
python scripts/add-icon-to-diagram.py diagram.excalidraw VPC 200 150
# Add icon from different library
python scripts/add-icon-to-diagram.py diagram.excalidraw Compute-Engine 500 200 \
--library-path libraries/gcp-icons --label "API Server"
Add connecting arrows:
python skills/excalidraw-diagram-generator/scripts/add-arrow.py \
<diagram-path> <from-x> <from-y> <to-x> <to-y> [--label "Text"] [--style solid|dashed|dotted] [--color HEX]
- Edit via
.excalidraw.edit is enabled by default to avoid overwrite issues; pass --no-use-edit-suffix to disable.
Examples:
# Simple arrow from (300, 250) to (500, 300)
python scripts/add-arrow.py diagram.excalidraw 300 250 500 300
# Arrow with label
python scripts/add-arrow.py diagram.excalidraw 300 250 500 300 --label "HTTPS"
# Dashed arrow with custom color
python scripts/add-arrow.py diagram.excalidraw 400 350 600 400 --style dashed --color "#7950f2"
Workflow summary:
# Step 1: Create base diagram with title and structure
# (Create .excalidraw file with initial elements)
# Step 2: Add icons with labels
python scripts/add-icon-to-diagram.py my-diagram.excalidraw "Internet-gateway" 200 150 --label "Internet Gateway"
python scripts/add-icon-to-diagram.py my-diagram.excalidraw VPC 250 250
python scripts/add-icon-to-diagram.py my-diagram.excalidraw ELB 350 300 --label "Load Balancer"
python scripts/add-icon-to-diagram.py my-diagram.excalidraw EC2 450 350 --label "EC2 Instance"
python scripts/add-icon-to-diagram.py my-diagram.excalidraw RDS 550 400 --label "Database"
# Step 3: Add connecting arrows
python scripts/add-arrow.py my-diagram.excalidraw 250 200 300 250 # Internet → VPC
python scripts/add-arrow.py my-diagram.excalidraw 300 300 400 300 # VPC → ELB
python scripts/add-arrow.py my-diagram.excalidraw 400 330 500 350 # ELB → EC2
python scripts/add-arrow.py my-diagram.excalidraw 500 380 600 400 # EC2 → RDS
Benefits of Python Script Approach:
- ✅ No token consumption: Icon JSON data (200-1000 lines each) never enters AI context
- ✅ Accurate transformations: Coordinate calculations handled deterministically
- ✅ ID management: Automatic UUID generation prevents conflicts
- ✅ Reliable: No risk of coordinate miscalculation or ID collision
- ✅ Fast: Direct file manipulation, no parsing overhead
- ✅ Reusable: Works with any Excalidraw library you provide
ALTERNATIVE: Manual Icon Integration (Not Recommended)
Only use this if Python scripts are unavailable:
Check for libraries:
List directory: skills/excalidraw-diagram-generator/libraries/
Look for subdirectories containing reference.md files
Read reference.md:
Open: libraries/<library-name>/reference.md
This is lightweight (typically <300 lines) and lists all available icons
Find relevant icons:
Search the reference.md table for icon names matching diagram needs
Example: For AWS diagram with EC2, S3, Lambda → Find "EC2", "S3", "Lambda" in table
Load specific icon data (WARNING: Large files):
Read ONLY the needed icon files:
- libraries/aws-architecture-icons/icons/EC2.json (200-300 lines)
- libraries/aws-architecture-icons/icons/S3.json (200-300 lines)
- libraries/aws-architecture-icons/icons/Lambda.json (200-300 lines)
Note: Each icon file is 200-1000 lines - this consumes significant tokens
Extract and transform elements:
Each icon JSON contains an "elements" array
Calculate bounding box (min_x, min_y, max_x, max_y)
Apply offset to all x/y coordinates
Generate new unique IDs for all elements
Update groupIds references
Copy transformed elements into your diagram
Position icons and add connections:
Adjust x/y coordinates to position icons correctly in the diagram
Update IDs to ensure uniqueness across diagram
Add connecting arrows and labels as needed
Manual Integration Challenges:
- ⚠️ High token consumption (200-1000 lines per icon × number of icons)
- ⚠️ Complex coordinate transformation calculations
- ⚠️ Risk of ID collision if not handled carefully
- ⚠️ Time-consuming for diagrams with many icons
Example: Creating AWS Diagram with Icons
Request: "Create an AWS architecture diagram with Internet Gateway, VPC, ELB, EC2, and RDS"
Recommended Workflow (using Python scripts):
Request: "Create an AWS architecture diagram with Internet Gateway, VPC, ELB, EC2, and RDS"
Recommended Workflow (using Python scripts):
# Step 1: Create base diagram file with title
# Create my-aws-diagram.excalidraw with basic structure (title, etc.)
# Step 2: Check icon availability
# Read: libraries/aws-architecture-icons/reference.md
# Confirm icons exist: Internet-gateway, VPC, ELB, EC2, RDS
# Step 3: Add icons with Python script
python scripts/add-icon-to-diagram.py my-aws-diagram.excalidraw "Internet-gateway" 150 100 --label "Internet Gateway"
python scripts/add-icon-to-diagram.py my-aws-diagram.excalidraw VPC 200 200
python scripts/add-icon-to-diagram.py my-aws-diagram.excalidraw ELB 350 250 --label "Load Balancer"
python scripts/add-icon-to-diagram.py my-aws-diagram.excalidraw EC2 500 300 --label "Web Server"
python scripts/add-icon-to-diagram.py my-aws-diagram.excalidraw RDS 650 350 --label "Database"
# Step 4: Add connecting arrows
python scripts/add-arrow.py my-aws-diagram.excalidraw 200 150 250 200 # Internet → VPC
python scripts/add-arrow.py my-aws-diagram.excalidraw 265 230 350 250 # VPC → ELB
python scripts/add-arrow.py my-aws-diagram.excalidraw 415 280 500 300 # ELB → EC2
python scripts/add-arrow.py my-aws-diagram.excalidraw 565 330 650 350 --label "SQL" --style dashed
# Result: Complete diagram with professional AWS icons, labels, and connections
Benefits:
- No manual coordinate calculation
- No token consumption for icon data
- Deterministic, reliable results
- Easy to iterate and adjust positions
Alternative Workflow (manual, if scripts unavailable):
- Check:
libraries/aws-architecture-icons/reference.md exists → Yes
- Read reference.md → Find entries for Internet-gateway, VPC, ELB, EC2, RDS
- Load:
icons/Internet-gateway.json (298 lines)
icons/VPC.json (550 lines)
icons/ELB.json (363 lines)
icons/EC2.json (231 lines)
icons/RDS.json (similar size)
Total: ~2000+ lines of JSON to process
- Extract elements from each JSON
- Calculate bounding boxes and offsets for each icon
- Transform all coordinates (x, y) for positioning
- Generate unique IDs for all elements
- Add arrows showing data flow
- Add text labels
- Generate final
.excalidraw file
Challenges with manual approach:
- High token consumption (~2000-5000 lines)
- Complex coordinate math
- Risk of ID conflicts
Supported Icon Libraries (Examples — verify availability)
- This workflow works with any valid
.excalidrawlib file you provide.
- Examples of library categories you may find on https://libraries.excalidraw.com/:
- Cloud service icons
- Kubernetes / infrastructure icons
- UI / Material icons
- Flowchart / diagram symbols
- Network diagram icons
- Availability and naming can change; verify exact library names on the site before use.
Fallback: No Icons Available
If no icon libraries are set up:
- Create diagrams using basic shapes (rectangles, ellipses, arrows)
- Use color coding and text labels to distinguish components
- Inform user they can add icons later or set up libraries for future diagrams
- The diagram will still be functional and clear, just less visually polished
References
See bundled references for:
references/excalidraw-schema.md - Complete Excalidraw JSON schema
references/element-types.md - Detailed element type specifications
templates/flowchart-template.json - Basic flowchart starter
templates/relationship-template.json - Relationship diagram starter
templates/mindmap-template.json - Mind map starter
scripts/split-excalidraw-library.py - Tool to split .excalidrawlib files
scripts/README.md - Documentation for library tools
scripts/.gitignore - Prevents local Python artifacts from being committed
Limitations
- Complex curves are simplified to straight/basic curved lines
- Hand-drawn roughness is set to default (1)
- No embedded images support in auto-generation
- Maximum recommended elements: 20 per diagram
- No automatic collision detection (use spacing guidelines)
Future Enhancements
Potential improvements:
- Auto-layout optimization algorithms
- Import from Mermaid/PlantUML syntax
- Template library expansion
- Interactive editing after generation
Source: github/awesome-copilot → skills/excalidraw-diagram-generator/SKILL.md
1---2name: excalidraw-diagram-generator3description: Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.4---5# Excalidraw Diagram Generator67A skill for generating Excalidraw-format diagrams from natural language descriptions. This skill helps create visual representations of processes, systems, relationships, and ideas without manual drawing.89## When to Use This Skill1011Use this skill when users request:1213- "Create a diagram showing..."14- "Make a flowchart for..."15- "Visualize the process of..."16- "Draw the system architecture of..."17- "Generate a mind map about..."18- "Create an Excalidraw file for..."19- "Show the relationship between..."20- "Diagram the workflow of..."2122**Supported diagram types:**23- 📊 **Flowcharts**: Sequential processes, workflows, decision trees24- 🔗 **Relationship Diagrams**: Entity relationships, system components, dependencies25- 🧠 **Mind Maps**: Concept hierarchies, brainstorming results, topic organization26- 🏗️ **Architecture Diagrams**: System design, module interactions, data flow27- 📈 **Data Flow Diagrams (DFD)**: Data flow visualization, data transformation processes28- 🏊 **Business Flow (Swimlane)**: Cross-functional workflows, actor-based process flows29- 📦 **Class Diagrams**: Object-oriented design, class structures and relationships30- 🔄 **Sequence Diagrams**: Object interactions over time, message flows31- 🗃️ **ER Diagrams**: Database entity relationships, data models3233## Prerequisites3435- Clear description of what should be visualized36- Identification of key entities, steps, or concepts37- Understanding of relationships or flow between elements3839## Step-by-Step Workflow4041### Step 1: Understand the Request4243Analyze the user's description to determine:441. **Diagram type** (flowchart, relationship, mind map, architecture)452. **Key elements** (entities, steps, concepts)463. **Relationships** (flow, connections, hierarchy)474. **Complexity** (number of elements)4849### Step 2: Choose the Appropriate Diagram Type5051| User Intent | Diagram Type | Example Keywords |52|-------------|--------------|------------------|53| Process flow, steps, procedures | **Flowchart** | "workflow", "process", "steps", "procedure" |54| Connections, dependencies, associations | **Relationship Diagram** | "relationship", "connections", "dependencies", "structure" |55| Concept hierarchy, brainstorming | **Mind Map** | "mind map", "concepts", "ideas", "breakdown" |56| System design, components | **Architecture Diagram** | "architecture", "system", "components", "modules" |57| Data flow, transformation processes | **Data Flow Diagram (DFD)** | "data flow", "data processing", "data transformation" |58| Cross-functional processes, actor responsibilities | **Business Flow (Swimlane)** | "business process", "swimlane", "actors", "responsibilities" |59| Object-oriented design, class structures | **Class Diagram** | "class", "inheritance", "OOP", "object model" |60| Interaction sequences, message flows | **Sequence Diagram** | "sequence", "interaction", "messages", "timeline" |61| Database design, entity relationships | **ER Diagram** | "database", "entity", "relationship", "data model" |6263### Step 3: Extract Structured Information6465**For Flowcharts:**66- List of sequential steps67- Decision points (if any)68- Start and end points6970**For Relationship Diagrams:**71- Entities/nodes (name + optional description)72- Relationships between entities (from → to, with label)7374**For Mind Maps:**75- Central topic76- Main branches (3-6 recommended)77- Sub-topics for each branch (optional)7879**For Data Flow Diagrams (DFD):**80- Data sources and destinations (external entities)81- Processes (data transformations)82- Data stores (databases, files)83- Data flows (arrows showing data movement from left-to-right or from top-left to bottom-right)84- **Important**: Do not represent process order, only data flow8586**For Business Flow (Swimlane):**87- Actors/roles (departments, systems, people) - displayed as header columns88- Process lanes (vertical lanes under each actor)89- Process boxes (activities within each lane)90- Flow arrows (connecting process boxes, including cross-lane handoffs)9192**For Class Diagrams:**93- Classes with names94- Attributes with visibility (+, -, #)95- Methods with visibility and parameters96- Relationships: inheritance (solid line + white triangle), implementation (dashed line + white triangle), association (solid line), dependency (dashed line), aggregation (solid line + white diamond), composition (solid line + filled diamond)97- Multiplicity notations (1, 0..1, 1..*, *)9899**For Sequence Diagrams:**100- Objects/actors (arranged horizontally at top)101- Lifelines (vertical lines from each object)102- Messages (horizontal arrows between lifelines)103- Synchronous messages (solid arrow), asynchronous messages (dashed arrow)104- Return values (dashed arrows)105- Activation boxes (rectangles on lifelines during execution)106- Time flows from top to bottom107108**For ER Diagrams:**109- Entities (rectangles with entity names)110- Attributes (listed inside entities)111- Primary keys (underlined or marked with PK)112- Foreign keys (marked with FK)113- Relationships (lines connecting entities)114- Cardinality: 1:1 (one-to-one), 1:N (one-to-many), N:M (many-to-many)115- Junction/associative entities for many-to-many relationships (dashed rectangles)116117### Step 4: Generate the Excalidraw JSON118119Create the `.excalidraw` file with appropriate elements:120121**Available element types:**122- `rectangle`: Boxes for entities, steps, concepts123- `ellipse`: Alternative shapes for emphasis124- `diamond`: Decision points125- `arrow`: Directional connections126- `text`: Labels and annotations127128**Key properties to set:**129- **Position**: `x`, `y` coordinates130- **Size**: `width`, `height`131- **Style**: `strokeColor`, `backgroundColor`, `fillStyle`132- **Font**: `fontFamily: 5` (Excalifont - **required for all text elements**)133- **Text**: Embedded text for labels134- **Connections**: `points` array for arrows135136**Important**: All text elements must use `fontFamily: 5` (Excalifont) for consistent visual appearance.137138### Step 5: Format the Output139140Structure the complete Excalidraw file:141142```json143{144 "type": "excalidraw",145 "version": 2,146 "source": "https://excalidraw.com",147 "elements": [148 // Array of diagram elements149 ],150 "appState": {151 "viewBackgroundColor": "#ffffff",152 "gridSize": 20153 },154 "files": {}155}156```157158### Step 6: Save and Provide Instructions1591601. Save as `<descriptive-name>.excalidraw`1612. Inform user how to open:162 - Visit https://excalidraw.com163 - Click "Open" or drag-and-drop the file164 - Or use Excalidraw VS Code extension165166## Best Practices167168### Element Count Guidelines169170| Diagram Type | Recommended Count | Maximum |171|--------------|-------------------|---------|172| Flowchart steps | 3-10 | 15 |173| Relationship entities | 3-8 | 12 |174| Mind map branches | 4-6 | 8 |175| Mind map sub-topics per branch | 2-4 | 6 |176177### Layout Tips1781791. **Start positions**: Center important elements, use consistent spacing1802. **Spacing**: 181 - Horizontal gap: 200-300px between elements182 - Vertical gap: 100-150px between rows1833. **Colors**: Use consistent color scheme184 - Primary elements: Light blue (`#a5d8ff`)185 - Secondary elements: Light green (`#b2f2bb`)186 - Important/Central: Yellow (`#ffd43b`)187 - Alerts/Warnings: Light red (`#ffc9c9`)1884. **Text sizing**: 16-24px for readability1895. **Font**: Always use `fontFamily: 5` (Excalifont) for all text elements1906. **Arrow style**: Use straight arrows for simple flows, curved for complex relationships191192### Complexity Management193194**If user request has too many elements:**195- Suggest breaking into multiple diagrams196- Focus on main elements first197- Offer to create detailed sub-diagrams198199**Example response:**200```201"Your request includes 15 components. For clarity, I recommend:2021. High-level architecture diagram (6 main components)2032. Detailed diagram for each subsystem204205Would you like me to start with the high-level view?"206```207208## Example Prompts and Responses209210### Example 1: Simple Flowchart211212**User:** "Create a flowchart for user registration"213214**Agent generates:**2151. Extract steps: "Enter email" → "Verify email" → "Set password" → "Complete"2162. Create flowchart with 4 rectangles + 3 arrows2173. Save as `user-registration-flow.excalidraw`218219### Example 2: Relationship Diagram220221**User:** "Diagram the relationship between User, Post, and Comment entities"222223**Agent generates:**2241. Entities: User, Post, Comment2252. Relationships: User → Post ("creates"), User → Comment ("writes"), Post → Comment ("contains")2263. Save as `user-content-relationships.excalidraw`227228### Example 3: Mind Map229230**User:** "Mind map about machine learning concepts"231232**Agent generates:**2331. Center: "Machine Learning"2342. Branches: Supervised Learning, Unsupervised Learning, Reinforcement Learning, Deep Learning2353. Sub-topics under each branch2364. Save as `machine-learning-mindmap.excalidraw`237238## Troubleshooting239240| Issue | Solution |241|-------|----------|242| Elements overlap | Increase spacing between coordinates |243| Text doesn't fit in boxes | Increase box width or reduce font size |244| Too many elements | Break into multiple diagrams |245| Unclear layout | Use grid layout (rows/columns) or radial layout (mind maps) |246| Colors inconsistent | Define color palette upfront based on element types |247248## Advanced Techniques249250### Grid Layout (for Relationship Diagrams)251```javascript252const columns = Math.ceil(Math.sqrt(entityCount));253const x = startX + (index % columns) * horizontalGap;254const y = startY + Math.floor(index / columns) * verticalGap;255```256257### Radial Layout (for Mind Maps)258```javascript259const angle = (2 * Math.PI * index) / branchCount;260const x = centerX + radius * Math.cos(angle);261const y = centerY + radius * Math.sin(angle);262```263264### Auto-generated IDs265Use timestamp + random string for unique IDs:266```javascript267const id = Date.now().toString(36) + Math.random().toString(36).substr(2);268```269270## Output Format271272Always provide:2731. ✅ Complete `.excalidraw` JSON file2742. 📊 Summary of what was created2753. 📝 Element count2764. 💡 Instructions for opening/editing277278**Example summary:**279```280Created: user-workflow.excalidraw281Type: Flowchart282Elements: 7 rectangles, 6 arrows, 1 title text283Total: 14 elements284285To view:2861. Visit https://excalidraw.com2872. Drag and drop user-workflow.excalidraw2883. Or use File → Open in Excalidraw VS Code extension289```290291## Validation Checklist292293Before delivering the diagram:294- [ ] All elements have unique IDs295- [ ] Coordinates prevent overlapping296- [ ] Text is readable (font size 16+)297- [ ] **All text elements use `fontFamily: 5` (Excalifont)**298- [ ] Arrows connect logically299- [ ] Colors follow consistent scheme300- [ ] File is valid JSON301- [ ] Element count is reasonable (<20 for clarity)302303## Icon Libraries (Optional Enhancement)304305For specialized diagrams (e.g., AWS/GCP/Azure architecture diagrams), you can use pre-made icon libraries from Excalidraw. This provides professional, standardized icons instead of basic shapes.306307### When User Requests Icons308309**If user asks for AWS/cloud architecture diagrams or mentions wanting to use specific icons:**3103111. **Check if library exists**: Look for `libraries/<library-name>/reference.md`3122. **If library exists**: Proceed to use icons (see AI Assistant Workflow below)3133. **If library does NOT exist**: Respond with setup instructions:314315 ```316 To use [AWS/GCP/Azure/etc.] architecture icons, please follow these steps:317 318 1. Visit https://libraries.excalidraw.com/319 2. Search for "[AWS Architecture Icons/etc.]" and download the .excalidrawlib file320 3. Create directory: skills/excalidraw-diagram-generator/libraries/[icon-set-name]/321 4. Place the downloaded file in that directory322 5. Run the splitter script:323 python skills/excalidraw-diagram-generator/scripts/split-excalidraw-library.py skills/excalidraw-diagram-generator/libraries/[icon-set-name]/324 325 This will split the library into individual icon files for efficient use.326 After setup is complete, I can create your diagram using the actual AWS/cloud icons.327 328 Alternatively, I can create the diagram now using simple shapes (rectangles, ellipses) 329 which you can later replace with icons manually in Excalidraw.330 ```331332### User Setup Instructions (Detailed)333334**Step 1: Create Library Directory**335```bash336mkdir -p skills/excalidraw-diagram-generator/libraries/aws-architecture-icons337```338339**Step 2: Download Library**340- Visit: https://libraries.excalidraw.com/341- Search for your desired icon set (e.g., "AWS Architecture Icons")342- Click download to get the `.excalidrawlib` file343- Example categories (availability varies; confirm on the site):344 - Cloud service icons345 - UI/Material icons346 - Flowchart symbols347348**Step 3: Place Library File**349- Rename the downloaded file to match the directory name (e.g., `aws-architecture-icons.excalidrawlib`)350- Move it to the directory created in Step 1351352**Step 4: Run Splitter Script**353```bash354python skills/excalidraw-diagram-generator/scripts/split-excalidraw-library.py skills/excalidraw-diagram-generator/libraries/aws-architecture-icons/355```356357**Step 5: Verify Setup**358After running the script, verify the following structure exists:359```360skills/excalidraw-diagram-generator/libraries/aws-architecture-icons/361 aws-architecture-icons.excalidrawlib (original)362 reference.md (generated - icon lookup table)363 icons/ (generated - individual icon files)364 API-Gateway.json365 CloudFront.json366 EC2.json367 Lambda.json368 RDS.json369 S3.json370 ...371```372373### AI Assistant Workflow374375**When icon libraries are available in `libraries/`:**376377**RECOMMENDED APPROACH: Use Python Scripts (Efficient & Reliable)**378379The repository includes Python scripts that handle icon integration automatically:3803811. **Create base diagram structure**:382 - Create `.excalidraw` file with basic layout (title, boxes, regions)383 - This establishes the canvas and overall structure3843852. **Add icons using Python script**:386 ```bash387 python skills/excalidraw-diagram-generator/scripts/add-icon-to-diagram.py \388 <diagram-path> <icon-name> <x> <y> [--label "Text"] [--library-path PATH]389 ```390 - Edit via `.excalidraw.edit` is enabled by default to avoid overwrite issues; pass `--no-use-edit-suffix` to disable.391 392 **Examples**:393 ```bash394 # Add EC2 icon at position (400, 300) with label395 python scripts/add-icon-to-diagram.py diagram.excalidraw EC2 400 300 --label "Web Server"396 397 # Add VPC icon at position (200, 150)398 python scripts/add-icon-to-diagram.py diagram.excalidraw VPC 200 150399 400 # Add icon from different library401 python scripts/add-icon-to-diagram.py diagram.excalidraw Compute-Engine 500 200 \402 --library-path libraries/gcp-icons --label "API Server"403 ```4044053. **Add connecting arrows**:406 ```bash407 python skills/excalidraw-diagram-generator/scripts/add-arrow.py \408 <diagram-path> <from-x> <from-y> <to-x> <to-y> [--label "Text"] [--style solid|dashed|dotted] [--color HEX]409 ```410 - Edit via `.excalidraw.edit` is enabled by default to avoid overwrite issues; pass `--no-use-edit-suffix` to disable.411 412 **Examples**:413 ```bash414 # Simple arrow from (300, 250) to (500, 300)415 python scripts/add-arrow.py diagram.excalidraw 300 250 500 300416 417 # Arrow with label418 python scripts/add-arrow.py diagram.excalidraw 300 250 500 300 --label "HTTPS"419 420 # Dashed arrow with custom color421 python scripts/add-arrow.py diagram.excalidraw 400 350 600 400 --style dashed --color "#7950f2"422 ```4234244. **Workflow summary**:425 ```bash426 # Step 1: Create base diagram with title and structure427 # (Create .excalidraw file with initial elements)428 429 # Step 2: Add icons with labels430 python scripts/add-icon-to-diagram.py my-diagram.excalidraw "Internet-gateway" 200 150 --label "Internet Gateway"431 python scripts/add-icon-to-diagram.py my-diagram.excalidraw VPC 250 250432 python scripts/add-icon-to-diagram.py my-diagram.excalidraw ELB 350 300 --label "Load Balancer"433 python scripts/add-icon-to-diagram.py my-diagram.excalidraw EC2 450 350 --label "EC2 Instance"434 python scripts/add-icon-to-diagram.py my-diagram.excalidraw RDS 550 400 --label "Database"435 436 # Step 3: Add connecting arrows437 python scripts/add-arrow.py my-diagram.excalidraw 250 200 300 250 # Internet → VPC438 python scripts/add-arrow.py my-diagram.excalidraw 300 300 400 300 # VPC → ELB439 python scripts/add-arrow.py my-diagram.excalidraw 400 330 500 350 # ELB → EC2440 python scripts/add-arrow.py my-diagram.excalidraw 500 380 600 400 # EC2 → RDS441 ```442443**Benefits of Python Script Approach**:444- ✅ **No token consumption**: Icon JSON data (200-1000 lines each) never enters AI context445- ✅ **Accurate transformations**: Coordinate calculations handled deterministically446- ✅ **ID management**: Automatic UUID generation prevents conflicts447- ✅ **Reliable**: No risk of coordinate miscalculation or ID collision448- ✅ **Fast**: Direct file manipulation, no parsing overhead449- ✅ **Reusable**: Works with any Excalidraw library you provide450451**ALTERNATIVE: Manual Icon Integration (Not Recommended)**452453Only use this if Python scripts are unavailable:4544551. **Check for libraries**: 456 ```457 List directory: skills/excalidraw-diagram-generator/libraries/458 Look for subdirectories containing reference.md files459 ```4604612. **Read reference.md**:462 ```463 Open: libraries/<library-name>/reference.md464 This is lightweight (typically <300 lines) and lists all available icons465 ```4664673. **Find relevant icons**:468 ```469 Search the reference.md table for icon names matching diagram needs470 Example: For AWS diagram with EC2, S3, Lambda → Find "EC2", "S3", "Lambda" in table471 ```4724734. **Load specific icon data** (WARNING: Large files):474 ```475 Read ONLY the needed icon files:476 - libraries/aws-architecture-icons/icons/EC2.json (200-300 lines)477 - libraries/aws-architecture-icons/icons/S3.json (200-300 lines)478 - libraries/aws-architecture-icons/icons/Lambda.json (200-300 lines)479 Note: Each icon file is 200-1000 lines - this consumes significant tokens480 ```4814825. **Extract and transform elements**:483 ```484 Each icon JSON contains an "elements" array485 Calculate bounding box (min_x, min_y, max_x, max_y)486 Apply offset to all x/y coordinates487 Generate new unique IDs for all elements488 Update groupIds references489 Copy transformed elements into your diagram490 ```4914926. **Position icons and add connections**:493 ```494 Adjust x/y coordinates to position icons correctly in the diagram495 Update IDs to ensure uniqueness across diagram496 Add connecting arrows and labels as needed497 ```498499**Manual Integration Challenges**:500- ⚠️ High token consumption (200-1000 lines per icon × number of icons)501- ⚠️ Complex coordinate transformation calculations502- ⚠️ Risk of ID collision if not handled carefully503- ⚠️ Time-consuming for diagrams with many icons504505### Example: Creating AWS Diagram with Icons506507**Request**: "Create an AWS architecture diagram with Internet Gateway, VPC, ELB, EC2, and RDS"508509**Recommended Workflow (using Python scripts)**:510**Request**: "Create an AWS architecture diagram with Internet Gateway, VPC, ELB, EC2, and RDS"511512**Recommended Workflow (using Python scripts)**:513514```bash515# Step 1: Create base diagram file with title516# Create my-aws-diagram.excalidraw with basic structure (title, etc.)517518# Step 2: Check icon availability519# Read: libraries/aws-architecture-icons/reference.md520# Confirm icons exist: Internet-gateway, VPC, ELB, EC2, RDS521522# Step 3: Add icons with Python script523python scripts/add-icon-to-diagram.py my-aws-diagram.excalidraw "Internet-gateway" 150 100 --label "Internet Gateway"524python scripts/add-icon-to-diagram.py my-aws-diagram.excalidraw VPC 200 200525python scripts/add-icon-to-diagram.py my-aws-diagram.excalidraw ELB 350 250 --label "Load Balancer"526python scripts/add-icon-to-diagram.py my-aws-diagram.excalidraw EC2 500 300 --label "Web Server"527python scripts/add-icon-to-diagram.py my-aws-diagram.excalidraw RDS 650 350 --label "Database"528529# Step 4: Add connecting arrows530python scripts/add-arrow.py my-aws-diagram.excalidraw 200 150 250 200 # Internet → VPC531python scripts/add-arrow.py my-aws-diagram.excalidraw 265 230 350 250 # VPC → ELB532python scripts/add-arrow.py my-aws-diagram.excalidraw 415 280 500 300 # ELB → EC2533python scripts/add-arrow.py my-aws-diagram.excalidraw 565 330 650 350 --label "SQL" --style dashed534535# Result: Complete diagram with professional AWS icons, labels, and connections536```537538**Benefits**:539- No manual coordinate calculation540- No token consumption for icon data541- Deterministic, reliable results542- Easy to iterate and adjust positions543544**Alternative Workflow (manual, if scripts unavailable)**:5451. Check: `libraries/aws-architecture-icons/reference.md` exists → Yes5462. Read reference.md → Find entries for Internet-gateway, VPC, ELB, EC2, RDS5473. Load:548 - `icons/Internet-gateway.json` (298 lines)549 - `icons/VPC.json` (550 lines)550 - `icons/ELB.json` (363 lines)551 - `icons/EC2.json` (231 lines) 552 - `icons/RDS.json` (similar size)553 **Total: ~2000+ lines of JSON to process**5544. Extract elements from each JSON5555. Calculate bounding boxes and offsets for each icon5566. Transform all coordinates (x, y) for positioning5577. Generate unique IDs for all elements5588. Add arrows showing data flow5599. Add text labels56010. Generate final `.excalidraw` file561562**Challenges with manual approach**:563- High token consumption (~2000-5000 lines)564- Complex coordinate math565- Risk of ID conflicts566567### Supported Icon Libraries (Examples — verify availability)568569- This workflow works with any valid `.excalidrawlib` file you provide.570- Examples of library categories you may find on https://libraries.excalidraw.com/:571 - Cloud service icons572 - Kubernetes / infrastructure icons573 - UI / Material icons574 - Flowchart / diagram symbols575 - Network diagram icons576- Availability and naming can change; verify exact library names on the site before use.577578### Fallback: No Icons Available579580**If no icon libraries are set up:**581- Create diagrams using basic shapes (rectangles, ellipses, arrows)582- Use color coding and text labels to distinguish components583- Inform user they can add icons later or set up libraries for future diagrams584- The diagram will still be functional and clear, just less visually polished585586## References587588See bundled references for:589- `references/excalidraw-schema.md` - Complete Excalidraw JSON schema590- `references/element-types.md` - Detailed element type specifications591- `templates/flowchart-template.json` - Basic flowchart starter592- `templates/relationship-template.json` - Relationship diagram starter593- `templates/mindmap-template.json` - Mind map starter594- `scripts/split-excalidraw-library.py` - Tool to split `.excalidrawlib` files595- `scripts/README.md` - Documentation for library tools596- `scripts/.gitignore` - Prevents local Python artifacts from being committed597598## Limitations599600- Complex curves are simplified to straight/basic curved lines601- Hand-drawn roughness is set to default (1)602- No embedded images support in auto-generation603- Maximum recommended elements: 20 per diagram604- No automatic collision detection (use spacing guidelines)605606## Future Enhancements607608Potential improvements:609- Auto-layout optimization algorithms610- Import from Mermaid/PlantUML syntax611- Template library expansion612- Interactive editing after generation613614---615616**Source:** [`github/awesome-copilot`](https://github.com/github/awesome-copilot) → `skills/excalidraw-diagram-generator/SKILL.md`