/slidev:excalidraw-generationfrom slidev
Generates hand-drawn style Excalidraw diagrams from conceptual descriptions, architecture, and spatial relationships. Renders to SVG via a script.
Ships in slidev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Core Philosophy: Semantic redesign, not mechanical conversion. Think like both a presentation designer (clarity, accessibility, simplicity) and an artist (creative visual expression, spatial design, aesthetic beauty).
ALWAYS use render-excalidraw.sh for SVG conversion - NO EXCEPTIONS
After creating Excalidraw JSON:
diagrams/<slug>.excalidraw${CLAUDE_PLUGIN_ROOT}/scripts/render-excalidraw.shThe script handles all rendering automatically with excalidraw-brute-export-cli.
Auto-trigger when:
Diagram type suitability:
Apply hard limits from ${CLAUDE_PLUGIN_ROOT}/references/design-constraints.md. Key for Excalidraw: max 9 elements (7+/-2), colorblind-safe palette only (Blue #3b82f6 + Orange #f97316), min 4.5:1 contrast, under 50 words per diagram, one idea per diagram, roughness 1.
Process (ALWAYS follow this order):
Analyze user's description or slide content
Extract core concepts (entities, relationships, flows)
Identify semantic type:
Design layout (choose from layout algorithms below)
Generate JSON (use element factories below)
Example:
Input: "Kubernetes device plugin architecture"
Semantic analysis:
- Type: Architecture + Flow
- Key concepts: Control Plane (container), Worker Node (container),
GPU (component), Device Plugin (component), Kubelet (component)
- Relationships: Discovery flow, Registration flow, Capacity updates
- Spatial meaning: Control Plane ABOVE Worker Node (hierarchy)
Design choice: Vertical layout with 2 frames, 5 shapes, 3 arrows, 3 annotations
Cognitive load: 2 frames + 5 shapes = 7 units ✓
Reference: Load factory functions from ${CLAUDE_PLUGIN_ROOT}/references/excalidraw-factories.js before generating diagrams. The file contains: createRectangle, createText, createBoundText, createArrow, createFrame, createEllipse, createCallout, THEME_COLORS, and LAYOUT constants.
Reference: Layout functions (layoutHorizontalFlow, layoutVerticalFlow, layoutRadial) are in ${CLAUDE_PLUGIN_ROOT}/references/excalidraw-factories.js.
Reference: createBindingPoint and connectShapesHorizontal are in ${CLAUDE_PLUGIN_ROOT}/references/excalidraw-factories.js.
Reference: THEME_COLORS palette is defined in ${CLAUDE_PLUGIN_ROOT}/references/excalidraw-factories.js. See ${CLAUDE_PLUGIN_ROOT}/references/design-constraints.md for the full colorblind-safe palette specification and contrast ratios.
Reference: validateExcalidrawJSON and countCognitiveElements are in ${CLAUDE_PLUGIN_ROOT}/references/excalidraw-factories.js.
Reference: assembleExcalidrawJSON is in ${CLAUDE_PLUGIN_ROOT}/references/excalidraw-factories.js.
Follow this workflow when generating diagrams:
Ask the user (if not clear from context):
Show the user your design approach:
## Diagram Analysis
Semantic type: [Architecture/Flow/Mind Map/etc.]
Best platform: Excalidraw
Design approach:
- Layout: [Horizontal/Vertical/Radial]
- Elements: [List main shapes and their purpose]
- Frames: [If using containers]
- Arrows: [Key flows to show]
- Annotations: [Callouts for context]
- Hand-drawn aesthetic: roughness 1
- Colors: Colorblind-safe blue/orange
Element count: [N] shapes + [M] arrows + [P] annotations = [Total]
Grouped into [X] logical units → within cognitive limit ✓ / ⚠️ OVER LIMIT
Show a text-based preview:
┌─────────────────────────────────┐
│ Container Name │
│ ┌──────────┐ ┌──────────┐ │
│ │ Shape A │───→│ Shape B │ │
│ └──────────┘ └──────────┘ │
└─────────────────────────────────┘
↑ "Annotation explaining flow"
Ask: "Proceed with JSON generation?"
File structure:
diagrams/
└── <slide-title-slug>.excalidraw # JSON source (editable)
public/images/<slide-title-slug>/
└── diagram-excalidraw.svg # Rendered SVG (for slide)
IMPORTANT: Always save source files to ./diagrams/ directory.
CRITICAL - Rendering Process:
Save JSON: Use Write tool to save JSON to diagrams/<slug>.excalidraw
Render to SVG: ALWAYS use render-excalidraw.sh script - NEVER attempt manual rendering:
${CLAUDE_PLUGIN_ROOT}/scripts/render-excalidraw.sh \
diagrams/<slug>.excalidraw \
public/images/<slug>/diagram-excalidraw.svg
Script handles: The script automatically:
DO NOT attempt to render Excalidraw any other way. ALWAYS use the script.
✅ Excalidraw Diagram Generated!
Source: diagrams/<slug>.excalidraw
Rendered: public/images/<slug>/diagram-excalidraw.svg
Edit online: https://excalidraw.com (drag diagrams/<slug>.excalidraw file)
After editing, re-render with:
${CLAUDE_PLUGIN_ROOT}/scripts/render-excalidraw.sh \
diagrams/<slug>.excalidraw \
public/images/<slug>/diagram-excalidraw.svg
Refinement options:
- Adjust layout (horizontal ↔ vertical)
- Add more annotations
- Change colors/emphasis
- Simplify (remove elements)
- Add more detail
What would you like to adjust?
Input: "Show Kubernetes device plugin architecture"
Step 1: Semantic Analysis
Type: Architecture + Flow
Concepts:
- Control Plane (container) - top
- Worker Node (container) - bottom
- Inside Worker Node: GPU, Device Plugin, Kubelet
- Flow: Discovery → Registration → Capacity Updates
Layout: Vertical (hierarchy)
Element count: 2 frames + 5 shapes + 3 arrows + 2 annotations = 12 base
BUT: Grouped into 2 logical units (control plane, worker node) = 7 cognitive units ✓
Step 2: JSON Generation
const elements = [];
// Create frames
const controlPlaneFrame = createFrame(50, 50, 700, 200, "Control Plane");
const workerNodeFrame = createFrame(50, 300, 700, 300, "Worker Node");
elements.push(controlPlaneFrame, workerNodeFrame);
// Control plane components
const [scheduler, schedulerText] = createRectangle(100, 100, 180, 80, "Scheduler", {
frameId: controlPlaneFrame.id,
strokeColor: THEME_COLORS.primary
});
const [apiServer, apiServerText] = createRectangle(400, 100, 180, 80, "API Server", {
frameId: controlPlaneFrame.id,
strokeColor: THEME_COLORS.primary
});
elements.push(scheduler, schedulerText, apiServer, apiServerText);
// Worker node components
const [gpu, gpuText] = createRectangle(100, 350, 180, 80, "GPU 0\nGPU 1", {
frameId: workerNodeFrame.id,
strokeColor: THEME_COLORS.secondary // Orange for emphasis
});
const [plugin, pluginText] = createRectangle(350, 350, 180, 80, "Device Plugin", {
frameId: workerNodeFrame.id,
strokeColor: THEME_COLORS.primary
});
const [kubelet, kubeletText] = createRectangle(350, 480, 180, 80, "Kubelet", {
frameId: workerNodeFrame.id,
strokeColor: THEME_COLORS.primary
});
elements.push(gpu, gpuText, plugin, pluginText, kubelet, kubeletText);
// Arrows with bindings
const arrow1 = connectShapesHorizontal(gpu, plugin); // Discovery
const arrow2 = createArrow(
plugin.x + plugin.width / 2, plugin.y + plugin.height,
kubelet.x + kubelet.width / 2, kubelet.y,
{
startBinding: createBindingPoint(plugin.id, plugin.x, plugin.y, plugin.width, plugin.height, "bottom"),
endBinding: createBindingPoint(kubelet.id, kubelet.x, kubelet.y, kubelet.width, kubelet.height, "top")
}
);
const arrow3 = createArrow(
kubelet.x + kubelet.width / 2, kubelet.y,
apiServer.x + apiServer.width / 2, apiServer.y + apiServer.height,
{
startBinding: createBindingPoint(kubelet.id, kubelet.x, kubelet.y, kubelet.width, kubelet.height, "top"),
endBinding: createBindingPoint(apiServer.id, apiServer.x, apiServer.y, apiServer.width, apiServer.height, "bottom")
}
);
elements.push(arrow1, arrow2, arrow3);
// Annotations
const [annotation1Text, annotation1Arrow] = createCallout(
plugin.x + plugin.width, plugin.y + plugin.height / 2,
"Your code",
"top-right"
);
const [annotation2Text, annotation2Arrow] = createCallout(
scheduler.x + scheduler.width / 2, scheduler.y,
"Now aware!",
"top-left"
);
elements.push(annotation1Text, annotation1Arrow, annotation2Text, annotation2Arrow);
// Assemble and validate
const json = assembleExcalidrawJSON(elements);
const validation = validateExcalidrawJSON(json);
const cognitiveCheck = countCognitiveElements(json);
if (!validation.valid) {
console.error("Validation errors:", validation.errors);
// Fix or abort
}
if (!cognitiveCheck.withinLimit) {
console.warn(`Cognitive overload: ${cognitiveCheck.total} elements`);
// Suggest splitting
}
// Save to file (source goes in diagrams/)
const filePath = "diagrams/device-plugin-architecture.excalidraw";
writeFile(filePath, JSON.stringify(json, null, 2));
// Horizontal left-to-right flow
const nodes = ["Start", "Process", "Transform", "Output", "End"];
const positions = layoutHorizontalFlow(nodes);
const elements = [];
// Create shapes
const shapes = positions.map(pos => {
const [rect, text] = createRectangle(pos.x, pos.y, pos.width, pos.height, pos.text);
elements.push(rect, text);
return rect;
});
// Connect with arrows
for (let i = 0; i < shapes.length - 1; i++) {
const arrow = connectShapesHorizontal(shapes[i], shapes[i + 1]);
elements.push(arrow);
}
// Add annotation at critical step
const [calloutText, calloutArrow] = createCallout(
shapes[2].x + shapes[2].width / 2,
shapes[2].y + shapes[2].height,
"Key transformation!",
"bottom-right"
);
elements.push(calloutText, calloutArrow);
// Radial layout from center
const centerConcept = "GPU Scheduling";
const branches = ["Device Plugin", "MIG", "Time-Slicing", "MPS", "Virtual GPUs"];
const positions = layoutRadial(centerConcept, branches);
const elements = [];
// Center ellipse
const [centerEllipse, centerText] = createEllipse(
positions[0].x, positions[0].y,
positions[0].width, positions[0].height,
centerConcept,
{ strokeColor: THEME_COLORS.secondary, strokeWidth: 3 }
);
elements.push(centerEllipse, centerText);
// Branch ellipses with arrows
for (let i = 1; i < positions.length; i++) {
const [ellipse, text] = createEllipse(
positions[i].x, positions[i].y,
positions[i].width, positions[i].height,
positions[i].text
);
elements.push(ellipse, text);
// Arrow from center to branch
const arrow = createArrow(
centerEllipse.x + centerEllipse.width / 2,
centerEllipse.y + centerEllipse.height / 2,
ellipse.x + ellipse.width / 2,
ellipse.y + ellipse.height / 2
);
elements.push(arrow);
}
Before saving any diagram, verify:
If JSON generation fails:
If cognitive load exceeded:
If validation fails:
When diagram command analyzes a slide and determines Excalidraw is best fit:
Invoke Skill tool: skill: "slidev:excalidraw-generation"
The skill will take over generation process.
Monitor for these triggers in slide content:
When detected, suggest: "I recommend creating an Excalidraw diagram for this - it excels at spatial layouts and informal designs. Proceed?"
After successfully generating a diagram:
Remember: You are both a presentation designer (enforcing evidence-based constraints) AND an artist (creating beautiful, spatial, hand-drawn diagrams). Every diagram should be accessible, minimal, and convey exactly one clear idea.
What SKILL.md sets; muted values are Claude Code's defaults
8 skills in this plugin
/diagram-designDiagram Design Philosophy**Don't convert diagrams between formats. Redesign them.**/latex-handoutsLaTeX HandoutsThis skill should be used when the user asks to "create LaTeX handout", "compile handout", "generate presentation handout", "create PDF document from slides", or needs guidance on LaTeX document structure, formatting, embedding images, or creating comprehensive presentation materials./presentation-designPresentation DesignThis skill should be used when the user asks to "design a presentation", "structure presentation content", "improve presentation flow", "create presentation outline", "make slides more engaging", or needs guidance on storytelling, visual hierarchy, audience engagement, or presentation best practices./slide-managementSlide Management**MANDATORY USE - ALWAYS INVOKE THIS SKILL** when the user mentions ANY of these actions: "delete slide", "remove slide", "add slide", "insert slide", "create new slide", "new slide between", "get rid of slide", "fix gaps", "renumber slides", OR when they confirm/answer questions about slide deletion/addition (e.g., "yes delete slide 6", "add a slide after 5"). **CRITICAL - NEVER manually edit slides.md or rename slide files yourself** - this skill uses the manage-slides.py script which handles automatic renumbering, gap detection/fixing, git-aware operations, and slide number vs position conversion. **AUTO-TRIGGER IMMEDIATELY** when user wants to modify slide count, order, or numbering. This skill is the ONLY correct way to add/delete slides./slide-qualitySlide Quality AssessmentThis skill should be used when the user asks to "analyze slide quality", "review slide", "check slide design", "optimize slide", "improve slide content", "assess slide clarity", or needs evidence-based quality evaluation using the 12-point checklist for presentation slides./slidev-masterySlidev MasteryThis skill should be used when the user asks to "create slides with Slidev", "use Slidev syntax", "add Slidev components", "configure Slidev theme", "export Slidev presentation", or mentions Slidev-specific features like layouts, animations, Monaco editor, or code highlighting. Provides comprehensive Slidev expertise for markdown-based presentations.npx claudepluginhub rhuss/cc-slidev --plugin slidevOther plugins' skills for the same job