Awesome Copilot Root Excalidraw Diagram Generator
Scope
- Use when: the task directly matches excalidraw diagram generator responsibilities within plugin awesome-copilot-root.
- Do not use when: a more specific framework or task-focused skill is clearly a better match.
Shared Plugin Context
See references/plugin-context.md.
Source
- Converted from
/tmp/codex-awesome-materialized-x3j3lxox/plugins/awesome-copilot-root/skills/excalidraw-diagram-generator/SKILL.md
Instructions
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
1---2name: awesome-copilot-root-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. Use when: the task directly matches excalidraw diagram generator responsibilities within plugin awesome-copilot-root. Do not use when: a more specific framework or task-focused skill is clearly a better match.4---56# Awesome Copilot Root Excalidraw Diagram Generator78## Scope910- Use when: the task directly matches excalidraw diagram generator responsibilities within plugin awesome-copilot-root.11- Do not use when: a more specific framework or task-focused skill is clearly a better match.1213## Shared Plugin Context1415See `references/plugin-context.md`.1617## Source1819- Converted from `/tmp/codex-awesome-materialized-x3j3lxox/plugins/awesome-copilot-root/skills/excalidraw-diagram-generator/SKILL.md`2021## Instructions2223# Excalidraw Diagram Generator2425A 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.2627## When to Use This Skill2829Use this skill when users request:3031- "Create a diagram showing..."32- "Make a flowchart for..."33- "Visualize the process of..."34- "Draw the system architecture of..."35- "Generate a mind map about..."36- "Create an Excalidraw file for..."37- "Show the relationship between..."38- "Diagram the workflow of..."3940**Supported diagram types:**41- 📊 **Flowcharts**: Sequential processes, workflows, decision trees42- 🔗 **Relationship Diagrams**: Entity relationships, system components, dependencies43- 🧠 **Mind Maps**: Concept hierarchies, brainstorming results, topic organization44- 🏗️ **Architecture Diagrams**: System design, module interactions, data flow45- 📈 **Data Flow Diagrams (DFD)**: Data flow visualization, data transformation processes46- 🏊 **Business Flow (Swimlane)**: Cross-functional workflows, actor-based process flows47- 📦 **Class Diagrams**: Object-oriented design, class structures and relationships48- 🔄 **Sequence Diagrams**: Object interactions over time, message flows49- 🗃️ **ER Diagrams**: Database entity relationships, data models5051## Prerequisites5253- Clear description of what should be visualized54- Identification of key entities, steps, or concepts55- Understanding of relationships or flow between elements5657## Step-by-Step Workflow5859### Step 1: Understand the Request6061Analyze the user's description to determine:621. **Diagram type** (flowchart, relationship, mind map, architecture)632. **Key elements** (entities, steps, concepts)643. **Relationships** (flow, connections, hierarchy)654. **Complexity** (number of elements)6667### Step 2: Choose the Appropriate Diagram Type6869| User Intent | Diagram Type | Example Keywords |70|-------------|--------------|------------------|71| Process flow, steps, procedures | **Flowchart** | "workflow", "process", "steps", "procedure" |72| Connections, dependencies, associations | **Relationship Diagram** | "relationship", "connections", "dependencies", "structure" |73| Concept hierarchy, brainstorming | **Mind Map** | "mind map", "concepts", "ideas", "breakdown" |74| System design, components | **Architecture Diagram** | "architecture", "system", "components", "modules" |75| Data flow, transformation processes | **Data Flow Diagram (DFD)** | "data flow", "data processing", "data transformation" |76| Cross-functional processes, actor responsibilities | **Business Flow (Swimlane)** | "business process", "swimlane", "actors", "responsibilities" |77| Object-oriented design, class structures | **Class Diagram** | "class", "inheritance", "OOP", "object model" |78| Interaction sequences, message flows | **Sequence Diagram** | "sequence", "interaction", "messages", "timeline" |79| Database design, entity relationships | **ER Diagram** | "database", "entity", "relationship", "data model" |8081### Step 3: Extract Structured Information8283**For Flowcharts:**84- List of sequential steps85- Decision points (if any)86- Start and end points8788**For Relationship Diagrams:**89- Entities/nodes (name + optional description)90- Relationships between entities (from → to, with label)9192**For Mind Maps:**93- Central topic94- Main branches (3-6 recommended)95- Sub-topics for each branch (optional)9697**For Data Flow Diagrams (DFD):**98- Data sources and destinations (external entities)99- Processes (data transformations)100- Data stores (databases, files)101- Data flows (arrows showing data movement from left-to-right or from top-left to bottom-right)102- **Important**: Do not represent process order, only data flow103104**For Business Flow (Swimlane):**105- Actors/roles (departments, systems, people) - displayed as header columns106- Process lanes (vertical lanes under each actor)107- Process boxes (activities within each lane)108- Flow arrows (connecting process boxes, including cross-lane handoffs)109110**For Class Diagrams:**111- Classes with names112- Attributes with visibility (+, -, #)113- Methods with visibility and parameters114- 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)115- Multiplicity notations (1, 0..1, 1..*, *)116117**For Sequence Diagrams:**118- Objects/actors (arranged horizontally at top)119- Lifelines (vertical lines from each object)120- Messages (horizontal arrows between lifelines)121- Synchronous messages (solid arrow), asynchronous messages (dashed arrow)122- Return values (dashed arrows)123- Activation boxes (rectangles on lifelines during execution)124- Time flows from top to bottom125126**For ER Diagrams:**127- Entities (rectangles with entity names)128- Attributes (listed inside entities)129- Primary keys (underlined or marked with PK)130- Foreign keys (marked with FK)131- Relationships (lines connecting entities)132- Cardinality: 1:1 (one-to-one), 1:N (one-to-many), N:M (many-to-many)133- Junction/associative entities for many-to-many relationships (dashed rectangles)134135### Step 4: Generate the Excalidraw JSON136137Create the `.excalidraw` file with appropriate elements:138139**Available element types:**140- `rectangle`: Boxes for entities, steps, concepts141- `ellipse`: Alternative shapes for emphasis142- `diamond`: Decision points143- `arrow`: Directional connections144- `text`: Labels and annotations145146**Key properties to set:**147- **Position**: `x`, `y` coordinates148- **Size**: `width`, `height`149- **Style**: `strokeColor`, `backgroundColor`, `fillStyle`150- **Font**: `fontFamily: 5` (Excalifont - **required for all text elements**)151- **Text**: Embedded text for labels152- **Connections**: `points` array for arrows153154**Important**: All text elements must use `fontFamily: 5` (Excalifont) for consistent visual appearance.155156### Step 5: Format the Output157158Structure the complete Excalidraw file:159160```json161{162 "type": "excalidraw",163 "version": 2,164 "source": "https://excalidraw.com",165 "elements": [166 // Array of diagram elements167 ],168 "appState": {169 "viewBackgroundColor": "#ffffff",170 "gridSize": 20171 },172 "files": {}173}174```175176### Step 6: Save and Provide Instructions1771781. Save as `<descriptive-name>.excalidraw`1792. Inform user how to open:180 - Visit https://excalidraw.com181 - Click "Open" or drag-and-drop the file182 - Or use Excalidraw VS Code extension183184## Best Practices185186### Element Count Guidelines187188| Diagram Type | Recommended Count | Maximum |189|--------------|-------------------|---------|190| Flowchart steps | 3-10 | 15 |191| Relationship entities | 3-8 | 12 |192| Mind map branches | 4-6 | 8 |193| Mind map sub-topics per branch | 2-4 | 6 |194195### Layout Tips1961971. **Start positions**: Center important elements, use consistent spacing1982. **Spacing**: 199 - Horizontal gap: 200-300px between elements200 - Vertical gap: 100-150px between rows2013. **Colors**: Use consistent color scheme202 - Primary elements: Light blue (`#a5d8ff`)203 - Secondary elements: Light green (`#b2f2bb`)204 - Important/Central: Yellow (`#ffd43b`)205 - Alerts/Warnings: Light red (`#ffc9c9`)2064. **Text sizing**: 16-24px for readability2075. **Font**: Always use `fontFamily: 5` (Excalifont) for all text elements2086. **Arrow style**: Use straight arrows for simple flows, curved for complex relationships209210### Complexity Management211212**If user request has too many elements:**213- Suggest breaking into multiple diagrams214- Focus on main elements first215- Offer to create detailed sub-diagrams216217**Example response:**218```219"Your request includes 15 components. For clarity, I recommend:2201. High-level architecture diagram (6 main components)2212. Detailed diagram for each subsystem222223Would you like me to start with the high-level view?"224```225226## Example Prompts and Responses227228### Example 1: Simple Flowchart229230**User:** "Create a flowchart for user registration"231232**Agent generates:**2331. Extract steps: "Enter email" → "Verify email" → "Set password" → "Complete"2342. Create flowchart with 4 rectangles + 3 arrows2353. Save as `user-registration-flow.excalidraw`236237### Example 2: Relationship Diagram238239**User:** "Diagram the relationship between User, Post, and Comment entities"240241**Agent generates:**2421. Entities: User, Post, Comment2432. Relationships: User → Post ("creates"), User → Comment ("writes"), Post → Comment ("contains")2443. Save as `user-content-relationships.excalidraw`245246### Example 3: Mind Map247248**User:** "Mind map about machine learning concepts"249250**Agent generates:**2511. Center: "Machine Learning"2522. Branches: Supervised Learning, Unsupervised Learning, Reinforcement Learning, Deep Learning2533. Sub-topics under each branch2544. Save as `machine-learning-mindmap.excalidraw`255256## Troubleshooting257258| Issue | Solution |259|-------|----------|260| Elements overlap | Increase spacing between coordinates |261| Text doesn't fit in boxes | Increase box width or reduce font size |262| Too many elements | Break into multiple diagrams |263| Unclear layout | Use grid layout (rows/columns) or radial layout (mind maps) |264| Colors inconsistent | Define color palette upfront based on element types |265266## Advanced Techniques267268### Grid Layout (for Relationship Diagrams)269```javascript270const columns = Math.ceil(Math.sqrt(entityCount));271const x = startX + (index % columns) * horizontalGap;272const y = startY + Math.floor(index / columns) * verticalGap;273```274275### Radial Layout (for Mind Maps)276```javascript277const angle = (2 * Math.PI * index) / branchCount;278const x = centerX + radius * Math.cos(angle);279const y = centerY + radius * Math.sin(angle);280```281282### Auto-generated IDs283Use timestamp + random string for unique IDs:284```javascript285const id = Date.now().toString(36) + Math.random().toString(36).substr(2);286```287288## Output Format289290Always provide:2911. ✅ Complete `.excalidraw` JSON file2922. 📊 Summary of what was created2933. 📝 Element count2944. 💡 Instructions for opening/editing295296**Example summary:**297```298Created: user-workflow.excalidraw299Type: Flowchart300Elements: 7 rectangles, 6 arrows, 1 title text301Total: 14 elements302303To view:3041. Visit https://excalidraw.com3052. Drag and drop user-workflow.excalidraw3063. Or use File → Open in Excalidraw VS Code extension307```308309## Validation Checklist310311Before delivering the diagram:312- [ ] All elements have unique IDs313- [ ] Coordinates prevent overlapping314- [ ] Text is readable (font size 16+)315- [ ] **All text elements use `fontFamily: 5` (Excalifont)**316- [ ] Arrows connect logically317- [ ] Colors follow consistent scheme318- [ ] File is valid JSON319- [ ] Element count is reasonable (<20 for clarity)320321## Icon Libraries (Optional Enhancement)322323For 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.324325### When User Requests Icons326327**If user asks for AWS/cloud architecture diagrams or mentions wanting to use specific icons:**3283291. **Check if library exists**: Look for `libraries/<library-name>/reference.md`3302. **If library exists**: Proceed to use icons (see AI Assistant Workflow below)3313. **If library does NOT exist**: Respond with setup instructions:332333 ```334 To use [AWS/GCP/Azure/etc.] architecture icons, please follow these steps:335 336 1. Visit https://libraries.excalidraw.com/337 2. Search for "[AWS Architecture Icons/etc.]" and download the .excalidrawlib file338 3. Create directory: skills/excalidraw-diagram-generator/libraries/[icon-set-name]/339 4. Place the downloaded file in that directory340 5. Run the splitter script:341 python skills/excalidraw-diagram-generator/scripts/split-excalidraw-library.py skills/excalidraw-diagram-generator/libraries/[icon-set-name]/342 343 This will split the library into individual icon files for efficient use.344 After setup is complete, I can create your diagram using the actual AWS/cloud icons.345 346 Alternatively, I can create the diagram now using simple shapes (rectangles, ellipses) 347 which you can later replace with icons manually in Excalidraw.348 ```349350### User Setup Instructions (Detailed)351352**Step 1: Create Library Directory**353```bash354mkdir -p skills/excalidraw-diagram-generator/libraries/aws-architecture-icons355```356357**Step 2: Download Library**358- Visit: https://libraries.excalidraw.com/359- Search for your desired icon set (e.g., "AWS Architecture Icons")360- Click download to get the `.excalidrawlib` file361- Example categories (availability varies; confirm on the site):362 - Cloud service icons363 - UI/Material icons364 - Flowchart symbols365366**Step 3: Place Library File**367- Rename the downloaded file to match the directory name (e.g., `aws-architecture-icons.excalidrawlib`)368- Move it to the directory created in Step 1369370**Step 4: Run Splitter Script**371```bash372python skills/excalidraw-diagram-generator/scripts/split-excalidraw-library.py skills/excalidraw-diagram-generator/libraries/aws-architecture-icons/373```374375**Step 5: Verify Setup**376After running the script, verify the following structure exists:377```378skills/excalidraw-diagram-generator/libraries/aws-architecture-icons/379 aws-architecture-icons.excalidrawlib (original)380 reference.md (generated - icon lookup table)381 icons/ (generated - individual icon files)382 API-Gateway.json383 CloudFront.json384 EC2.json385 Lambda.json386 RDS.json387 S3.json388 ...389```390391### AI Assistant Workflow392393**When icon libraries are available in `libraries/`:**394395**RECOMMENDED APPROACH: Use Python Scripts (Efficient & Reliable)**396397The repository includes Python scripts that handle icon integration automatically:3983991. **Create base diagram structure**:400 - Create `.excalidraw` file with basic layout (title, boxes, regions)401 - This establishes the canvas and overall structure4024032. **Add icons using Python script**:404 ```bash405 python skills/excalidraw-diagram-generator/scripts/add-icon-to-diagram.py \406 <diagram-path> <icon-name> <x> <y> [--label "Text"] [--library-path PATH]407 ```408 - Edit via `.excalidraw.edit` is enabled by default to avoid overwrite issues; pass `--no-use-edit-suffix` to disable.409 410 **Examples**:411 ```bash412 # Add EC2 icon at position (400, 300) with label413 python scripts/add-icon-to-diagram.py diagram.excalidraw EC2 400 300 --label "Web Server"414 415 # Add VPC icon at position (200, 150)416 python scripts/add-icon-to-diagram.py diagram.excalidraw VPC 200 150417 418 # Add icon from different library419 python scripts/add-icon-to-diagram.py diagram.excalidraw Compute-Engine 500 200 \420 --library-path libraries/gcp-icons --label "API Server"421 ```4224233. **Add connecting arrows**:424 ```bash425 python skills/excalidraw-diagram-generator/scripts/add-arrow.py \426 <diagram-path> <from-x> <from-y> <to-x> <to-y> [--label "Text"] [--style solid|dashed|dotted] [--color HEX]427 ```428 - Edit via `.excalidraw.edit` is enabled by default to avoid overwrite issues; pass `--no-use-edit-suffix` to disable.429 430 **Examples**:431 ```bash432 # Simple arrow from (300, 250) to (500, 300)433 python scripts/add-arrow.py diagram.excalidraw 300 250 500 300434 435 # Arrow with label436 python scripts/add-arrow.py diagram.excalidraw 300 250 500 300 --label "HTTPS"437 438 # Dashed arrow with custom color439 python scripts/add-arrow.py diagram.excalidraw 400 350 600 400 --style dashed --color "#7950f2"440 ```4414424. **Workflow summary**:443 ```bash444 # Step 1: Create base diagram with title and structure445 # (Create .excalidraw file with initial elements)446 447 # Step 2: Add icons with labels448 python scripts/add-icon-to-diagram.py my-diagram.excalidraw "Internet-gateway" 200 150 --label "Internet Gateway"449 python scripts/add-icon-to-diagram.py my-diagram.excalidraw VPC 250 250450 python scripts/add-icon-to-diagram.py my-diagram.excalidraw ELB 350 300 --label "Load Balancer"451 python scripts/add-icon-to-diagram.py my-diagram.excalidraw EC2 450 350 --label "EC2 Instance"452 python scripts/add-icon-to-diagram.py my-diagram.excalidraw RDS 550 400 --label "Database"453 454 # Step 3: Add connecting arrows455 python scripts/add-arrow.py my-diagram.excalidraw 250 200 300 250 # Internet → VPC456 python scripts/add-arrow.py my-diagram.excalidraw 300 300 400 300 # VPC → ELB457 python scripts/add-arrow.py my-diagram.excalidraw 400 330 500 350 # ELB → EC2458 python scripts/add-arrow.py my-diagram.excalidraw 500 380 600 400 # EC2 → RDS459 ```460461**Benefits of Python Script Approach**:462- ✅ **No token consumption**: Icon JSON data (200-1000 lines each) never enters AI context463- ✅ **Accurate transformations**: Coordinate calculations handled deterministically464- ✅ **ID management**: Automatic UUID generation prevents conflicts465- ✅ **Reliable**: No risk of coordinate miscalculation or ID collision466- ✅ **Fast**: Direct file manipulation, no parsing overhead467- ✅ **Reusable**: Works with any Excalidraw library you provide468469**ALTERNATIVE: Manual Icon Integration (Not Recommended)**470471Only use this if Python scripts are unavailable:4724731. **Check for libraries**: 474 ```475 List directory: skills/excalidraw-diagram-generator/libraries/476 Look for subdirectories containing reference.md files477 ```4784792. **Read reference.md**:480 ```481 Open: libraries/<library-name>/reference.md482 This is lightweight (typically <300 lines) and lists all available icons483 ```4844853. **Find relevant icons**:486 ```487 Search the reference.md table for icon names matching diagram needs488 Example: For AWS diagram with EC2, S3, Lambda → Find "EC2", "S3", "Lambda" in table489 ```4904914. **Load specific icon data** (WARNING: Large files):492 ```493 Read ONLY the needed icon files:494 - libraries/aws-architecture-icons/icons/EC2.json (200-300 lines)495 - libraries/aws-architecture-icons/icons/S3.json (200-300 lines)496 - libraries/aws-architecture-icons/icons/Lambda.json (200-300 lines)497 Note: Each icon file is 200-1000 lines - this consumes significant tokens498 ```4995005. **Extract and transform elements**:501 ```502 Each icon JSON contains an "elements" array503 Calculate bounding box (min_x, min_y, max_x, max_y)504 Apply offset to all x/y coordinates505 Generate new unique IDs for all elements506 Update groupIds references507 Copy transformed elements into your diagram508 ```5095106. **Position icons and add connections**:511 ```512 Adjust x/y coordinates to position icons correctly in the diagram513 Update IDs to ensure uniqueness across diagram514 Add connecting arrows and labels as needed515 ```516517**Manual Integration Challenges**:518- ⚠️ High token consumption (200-1000 lines per icon × number of icons)519- ⚠️ Complex coordinate transformation calculations520- ⚠️ Risk of ID collision if not handled carefully521- ⚠️ Time-consuming for diagrams with many icons522523### Example: Creating AWS Diagram with Icons524525**Request**: "Create an AWS architecture diagram with Internet Gateway, VPC, ELB, EC2, and RDS"526527**Recommended Workflow (using Python scripts)**:528**Request**: "Create an AWS architecture diagram with Internet Gateway, VPC, ELB, EC2, and RDS"529530**Recommended Workflow (using Python scripts)**:531532```bash533# Step 1: Create base diagram file with title534# Create my-aws-diagram.excalidraw with basic structure (title, etc.)535536# Step 2: Check icon availability537# Read: libraries/aws-architecture-icons/reference.md538# Confirm icons exist: Internet-gateway, VPC, ELB, EC2, RDS539540# Step 3: Add icons with Python script541python scripts/add-icon-to-diagram.py my-aws-diagram.excalidraw "Internet-gateway" 150 100 --label "Internet Gateway"542python scripts/add-icon-to-diagram.py my-aws-diagram.excalidraw VPC 200 200543python scripts/add-icon-to-diagram.py my-aws-diagram.excalidraw ELB 350 250 --label "Load Balancer"544python scripts/add-icon-to-diagram.py my-aws-diagram.excalidraw EC2 500 300 --label "Web Server"545python scripts/add-icon-to-diagram.py my-aws-diagram.excalidraw RDS 650 350 --label "Database"546547# Step 4: Add connecting arrows548python scripts/add-arrow.py my-aws-diagram.excalidraw 200 150 250 200 # Internet → VPC549python scripts/add-arrow.py my-aws-diagram.excalidraw 265 230 350 250 # VPC → ELB550python scripts/add-arrow.py my-aws-diagram.excalidraw 415 280 500 300 # ELB → EC2551python scripts/add-arrow.py my-aws-diagram.excalidraw 565 330 650 350 --label "SQL" --style dashed552553# Result: Complete diagram with professional AWS icons, labels, and connections554```555556**Benefits**:557- No manual coordinate calculation558- No token consumption for icon data559- Deterministic, reliable results560- Easy to iterate and adjust positions561562**Alternative Workflow (manual, if scripts unavailable)**:5631. Check: `libraries/aws-architecture-icons/reference.md` exists → Yes5642. Read reference.md → Find entries for Internet-gateway, VPC, ELB, EC2, RDS5653. Load:566 - `icons/Internet-gateway.json` (298 lines)567 - `icons/VPC.json` (550 lines)568 - `icons/ELB.json` (363 lines)569 - `icons/EC2.json` (231 lines) 570 - `icons/RDS.json` (similar size)571 **Total: ~2000+ lines of JSON to process**5724. Extract elements from each JSON5735. Calculate bounding boxes and offsets for each icon5746. Transform all coordinates (x, y) for positioning5757. Generate unique IDs for all elements5768. Add arrows showing data flow5779. Add text labels57810. Generate final `.excalidraw` file579580**Challenges with manual approach**:581- High token consumption (~2000-5000 lines)582- Complex coordinate math583- Risk of ID conflicts584585### Supported Icon Libraries (Examples — verify availability)586587- This workflow works with any valid `.excalidrawlib` file you provide.588- Examples of library categories you may find on https://libraries.excalidraw.com/:589 - Cloud service icons590 - Kubernetes / infrastructure icons591 - UI / Material icons592 - Flowchart / diagram symbols593 - Network diagram icons594- Availability and naming can change; verify exact library names on the site before use.595596### Fallback: No Icons Available597598**If no icon libraries are set up:**599- Create diagrams using basic shapes (rectangles, ellipses, arrows)600- Use color coding and text labels to distinguish components601- Inform user they can add icons later or set up libraries for future diagrams602- The diagram will still be functional and clear, just less visually polished603604## References605606See bundled references for:607- `references/excalidraw-schema.md` - Complete Excalidraw JSON schema608- `references/element-types.md` - Detailed element type specifications609- `templates/flowchart-template.json` - Basic flowchart starter610- `templates/relationship-template.json` - Relationship diagram starter611- `templates/mindmap-template.json` - Mind map starter612- `scripts/split-excalidraw-library.py` - Tool to split `.excalidrawlib` files613- `scripts/README.md` - Documentation for library tools614- `scripts/.gitignore` - Prevents local Python artifacts from being committed615616## Limitations617618- Complex curves are simplified to straight/basic curved lines619- Hand-drawn roughness is set to default (1)620- No embedded images support in auto-generation621- Maximum recommended elements: 20 per diagram622- No automatic collision detection (use spacing guidelines)623624## Future Enhancements625626Potential improvements:627- Auto-layout optimization algorithms628- Import from Mermaid/PlantUML syntax629- Template library expansion630- Interactive editing after generation