/diagrams:diagramsfrom diagrams
Generate interactive visual flow diagrams as HTML files with Mermaid.js. Use when the user asks to: (1) draw, visualize, or diagram a code flow, (2) show how something works or will work, (3) compare current vs proposed architecture, (4) explain a design, plan, or system visually, (5) create sequence diagrams, flowcharts, or any architectural diagram. Triggers on phrases like 'draw a diagram', 'visualize the flow', 'show me how it works', 'diagram the plan', '/diagrams'.
Ships in diagrams. 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.
None: SKILL.md is the whole skill.
Generate interactive Mermaid.js diagrams rendered as standalone HTML files that open in the browser.
Determine the intent — the user may want one or more of:
| Intent | Approach |
|---|---|
| Explain how it works | Single set of diagrams showing the current flow |
| Propose something new | Diagrams showing the planned design |
| Compare current vs proposed | Side-by-side sections: "Current" then "Proposed" with matching structure |
| Debug a problem | Current (broken) flow, then fixed flow highlighting the change |
| Plan an implementation | High-level architecture + detailed component interactions |
Before generating any diagram, read the relevant code to understand:
Select the most appropriate Mermaid diagram types. Combine multiple in a single HTML file:
| Type | Use When |
|---|---|
sequenceDiagram | Interactions between components over time (API calls, job chains, event flows) |
flowchart TD/LR | Decision logic, branching paths, conditional flows, process steps |
stateDiagram-v2 | State machines, status transitions, lifecycle stages |
classDiagram | Class relationships, interfaces, dependencies, module structure |
erDiagram | Database relationships, data models |
C4Context / C4Container | High-level system architecture, service boundaries |
Create a self-contained HTML file with:
File location: Always save to a temporary location:
{project_root}/{ticket-or-topic}-diagrams.html for project-specific diagrams/tmp/{topic}-diagrams.html for general diagramsopen {path-to-html-file}
After opening, remind the user that the file is temporary and should not be committed.
Use this structure for generated diagram files:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{Title}</title>
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<style>
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; max-width: 1200px; margin: 0 auto; padding: 20px; background: #f8f9fa; }
h1 { color: #333; border-bottom: 2px solid #dee2e6; padding-bottom: 10px; }
h2 { color: #495057; margin-top: 40px; }
h3 { color: #868e96; }
.diagram { background: white; border-radius: 8px; padding: 20px; margin: 20px 0; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.callout { padding: 15px; margin: 20px 0; border-radius: 4px; }
.callout-warning { background: #fff3cd; border-left: 4px solid #ffc107; }
.callout-danger { background: #f8d7da; border-left: 4px solid #dc3545; }
.callout-success { background: #d4edda; border-left: 4px solid #28a745; }
.callout-info { background: #d1ecf1; border-left: 4px solid #17a2b8; }
.callout-neutral { background: #e9ecef; border-left: 4px solid #6c757d; }
code { background: #e9ecef; padding: 2px 6px; border-radius: 3px; font-size: 0.9em; }
table { border-collapse: collapse; width: 100%; margin: 10px 0; }
th, td { border: 1px solid #dee2e6; padding: 8px 12px; text-align: left; }
th { background: #e9ecef; }
</style>
</head>
<body>
<h1>{Title}</h1>
<!-- Use callout boxes for context — pick the ones that fit -->
<div class="callout callout-info"><strong>Context:</strong> ...</div>
<div class="callout callout-neutral"><strong>Goal:</strong> ...</div>
<div class="callout callout-success"><strong>Approach:</strong> ...</div>
<div class="callout callout-warning"><strong>Trade-off:</strong> ...</div>
<div class="callout callout-danger"><strong>Risk:</strong> ...</div>
<!-- Wrap each diagram in a .diagram div -->
<div class="diagram">
<pre class="mermaid">
sequenceDiagram
participant A as Component A
participant B as Component B
A->>B: action
B-->>A: response
</pre>
</div>
<script>mermaid.initialize({theme: 'default', securityLevel: 'loose'});</script>
</body>
</html>
Use callouts that match the intent, not just bugs:
| Class | Use For |
|---|---|
callout-info | Context, background, "how it works today" |
callout-neutral | Goals, requirements, scope |
callout-success | Proposed solution, benefits, what improves |
callout-warning | Trade-offs, caveats, things to watch |
callout-danger | Risks, breaking changes, known issues |
Note over X: text in sequence diagrams for inline annotations<br/> for line breaks inside notes and labelsstyle NodeId fill:#color,color:#fff in flowcharts to highlight important nodes#51cf66) for new/added, blue (#339af0) for existing/unchanged, orange (#ff922b) for modified, red (#ff6b6b) for removed/problematicAfter generating and opening the file, display:
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub serban-marius/pip-boy --plugin diagrams