Excalidraw Skill
Programmatic canvas toolkit for creating, editing, and exporting Excalidraw diagrams via AI agents
Excalidraw Skill is a design toolkit for creating, editing, and exporting hand-drawn style diagrams programmatically, covering canvas manipulation, shape creation, and diagram export capabilities
What Is This?
Overview
Excalidraw Skill provides programmatic access to Excalidraw, the popular open-source whiteboarding tool known for its sketchy, hand-drawn aesthetic. This toolkit enables AI agents and applications to generate, modify, and export diagrams without manual interaction. It bridges the gap between code-based diagram generation and Excalidraw's intuitive visual interface, making it ideal for automated documentation, architecture visualization, and dynamic diagram creation.
The skill integrates with Excalidraw's native format and API, allowing developers to build diagrams through code while maintaining the tool's distinctive visual style. Whether you need to create flowcharts, wireframes, system architecture diagrams, or collaborative sketches, this toolkit handles the technical details of canvas management and element positioning. It supports a wide range of diagram types, including mind maps, organizational charts, and annotated illustrations, making it versatile for many technical and creative workflows.
Who Should Use This
Use this skill if you're building AI agents that generate visual diagrams, need to automate diagram creation for documentation, or want to programmatically create Excalidraw files without manual drawing. It's perfect for developers, technical writers, and automation engineers. Educators and trainers can also benefit by generating instructional diagrams or interactive visual aids automatically, while product teams can use it to maintain up-to-date architecture diagrams as systems evolve.
Why Use It?
Problems It Solves
Manual diagram creation is time-consuming and difficult to automate. Excalidraw Skill eliminates the need for manual drawing by enabling code-driven diagram generation. It preserves Excalidraw's beloved hand-drawn style while adding programmatic control, making it easy to generate consistent, reproducible diagrams at scale. This is especially valuable for teams that need to keep documentation synchronized with code changes or generate diagrams based on live data.
Core Highlights
The toolkit provides direct canvas manipulation through code without requiring UI interaction. You can create shapes, add text, establish connections, and organize elements programmatically with full control over positioning and styling. Export functionality supports multiple formats including PNG, SVG, and native Excalidraw JSON for future editing. The hand-drawn aesthetic is automatically applied, giving generated diagrams a friendly, approachable appearance that feels intentional rather than robotic. The API also supports layering, grouping, and z-order management, allowing for complex diagram structures and clear visual hierarchies.
How to Use It?
Basic Usage
import excalidraw
canvas = excalidraw.create_canvas(width=800, height=600)
rect = canvas.add_rectangle(x=100, y=100, width=200, height=150)
text = canvas.add_text(x=150, y=150, content="System Component")
canvas.export_png("diagram.png")You can specify canvas size, background color, and element styles such as stroke color, fill, and font. Each shape or text element can be referenced by variable for further manipulation, such as moving, resizing, or connecting with arrows.
Real-World Examples
Create a flowchart for a decision tree by adding connected shapes and arrows:
canvas = excalidraw.create_canvas()
start = canvas.add_circle(x=400, y=50, radius=30)
decision = canvas.add_diamond(x=400, y=150, width=100, height=80)
canvas.add_arrow(start, decision)
canvas.add_text(x=410, y=160, content="Check condition")You can further expand this by adding more branches, labels, and conditional paths.
Generate a system architecture diagram with labeled components:
canvas = excalidraw.create_canvas(width=1000, height=700)
api = canvas.add_rectangle(x=50, y=50, width=150, height=100)
database = canvas.add_rectangle(x=300, y=50, width=150, height=100)
canvas.add_text(x=80, y=100, content="API Server")
canvas.add_text(x=330, y=100, content="Database")
canvas.add_arrow(api, database)
canvas.export_svg("architecture.svg")You can group related components, add icons, or use color coding for clarity.
Advanced Tips
Use the JSON export format to preserve your diagrams for later programmatic modification or to integrate with version control systems. Leverage element grouping and layering to organize complex diagrams and maintain clean visual hierarchy in generated outputs. For dynamic diagrams, update element positions or styles based on data changes, and re-export as needed.
When to Use It?
Use Cases
Generate documentation diagrams automatically from code specifications or configuration files. Create interactive tutorials where diagrams update based on user input or data changes. Build AI agents that visualize system designs, workflows, or data relationships in real-time. Automate the creation of presentation materials with consistent, styled diagrams across multiple slides or documents. Use it in CI/CD pipelines to ensure architecture diagrams are always current.
Related Topics
This skill complements diagram-as-code tools like Mermaid and PlantUML, and integrates well with documentation generators and AI agent frameworks that need visual output capabilities. It can also be used alongside markdown documentation or static site generators for seamless visual integration.
Important Notes
While Excalidraw Skill streamlines programmatic diagram creation, it requires careful setup and usage to ensure compatibility and optimal results. Users should be aware of environment prerequisites, recommended practices for diagram management, and inherent limitations related to Excalidraw's format and rendering capabilities. Understanding these aspects will help avoid common pitfalls and maximize productivity.
Requirements
- Python 3.7 or later is required for the excalidraw package and its dependencies
- Access to the Excalidraw Skill library, typically via pip or a compatible package manager
- Sufficient file system permissions for reading and writing diagram export files (PNG, SVG, JSON)
- For integration with other tools, ensure API keys or authentication tokens if using cloud-based workflows
Usage Recommendations
- Define canvas dimensions and element positions explicitly to avoid overlapping or misaligned shapes
- Use grouping and layering features to organize complex diagrams and maintain clarity
- Export diagrams in Excalidraw JSON format for future edits or version control integration
- Regularly validate exported diagrams visually to catch rendering issues early
- Document element IDs or references in code to simplify future modifications or automated updates
Limitations
- Does not support real-time collaborative editing or live multi-user sessions
- Limited to features available in Excalidraw's public API and format; advanced drawing effects or plugins may not be accessible
- Some complex shapes, connectors, or custom icons may require manual adjustment after export
- Rendering fidelity may vary between exported PNG/SVG and the Excalidraw web interface
More Skills You Might Like
Explore similar skills to enhance your workflow
Story Done
argument-hint: "[story-file-path] [--review full|lean|solo]"
Interview Script
Create a structured customer interview script with JTBD probing questions, warm-up, core exploration, and wrap-up sections. Follows The Mom Test
Board Meeting
Multi-agent board meeting protocol for strategic decisions. Runs a structured 6-phase deliberation: context loading, independent C-suite contributions
Swift Patterns
Review, refactor, or build SwiftUI features with correct state management, modern API usage, optimal view composition, navigation patterns,
React State Management
Comprehensive guide to modern React state management patterns, from local component state to global stores and server state synchronization
Python Packaging
Comprehensive guide to creating, structuring, and distributing Python packages using modern packaging tools, pyproject.toml, and publishing to PyPI