---
name: visual-explainer
description: Generate beautiful, self-contained HTML pages that visually explain systems, code changes, plans, and data. Use when the user asks for a diagram, architecture overview, diff review, plan review, project recap, comparison table, or any visual explanation of technical concepts. Also use proactively when you are about to render a complex ASCII table (4+ rows or 3+ columns) — present it as a styled HTML page instead.
license: MIT
compatibility: Requires a browser to view generated HTML files. Optional surf-cli for AI image generation.
metadata:
author: nicobailon
version: "0.5.2"
---
# Visual Explainer
Generate self-contained HTML files for technical diagrams, visualizations, and data tables. Always open the result in the browser. Never fall back to ASCII art when this skill is loaded.
**Visuals are required.** When this skill is loaded, the output must contain at least one primary visual artifact that carries real information, not just decorative styling around prose. Valid primary visuals include:
- an architecture, flow, sequence, state, ER, or dependency diagram
- a timeline, roadmap, or execution path visual
- a dashboard or KPI band with charts, bars, or status visual encoding
- a semantic HTML table for comparisons, audits, or inventories
- a walkthrough strip, stepper, or before/after comparison layout
If the page is a report, review, recap, audit, or plan analysis, include **at least two visual forms**:
- one structural visual: diagram, flow, architecture map, timeline, or dependency view
- one evidence visual: table, KPI dashboard, comparison panel, heatmap-style status grid, or other compact evidence display
Pure prose sections, even if well-designed, do not satisfy this requirement.
**Proactive table rendering.** When you're about to present tabular data as an ASCII box-drawing table in the terminal (comparisons, audits, feature matrices, status reports, any structured rows/columns), generate an HTML page instead. The threshold: if the table has 4+ rows or 3+ columns, it belongs in the browser. Don't wait for the user to ask — render it as HTML automatically and tell them the file path. You can still include a brief text summary in the chat, but the table itself should be the HTML page.
## Workflow
### 1. Think (5 seconds, not 5 minutes)
Before writing HTML, commit to a direction. Don't default to "dark theme with blue accents" every time.
**Who is looking?** A developer understanding a system? A PM seeing the big picture? A team reviewing a proposal? This shapes information density and visual complexity.
**What type of diagram?** Architecture, flowchart, execution flow, code flow, sequence, data flow, schema/ER, state machine, mind map, data table, walkthrough, timeline, or dashboard. Each has distinct layout needs and rendering approaches (see Diagram Types below).
**What aesthetic?** Pick one and commit:
- Monochrome terminal (green/amber on black, monospace everything)
- Editorial (serif headlines, generous whitespace, muted palette)
- Blueprint (technical drawing feel, grid lines, precise)
- Neon dashboard (saturated accents on deep dark, glowing edges)
- Paper/ink (warm cream background, hand-drawn feel, sketchy borders)
- Hand-drawn / sketch (Mermaid `handDrawn` mode, wiggly lines, informal whiteboard feel)
- IDE-inspired (borrow a real color scheme: Dracula, Nord, Catppuccin, Solarized, Gruvbox, One Dark)
- Data-dense (small type, tight spacing, maximum information)
- Gradient mesh (bold gradients, glassmorphism, modern SaaS feel)
Vary the choice each time. If the last diagram was dark and technical, make the next one light and editorial. The swap test: if you replaced your styling with a generic dark theme and nobody would notice the difference, you haven't designed anything.
### 2. Structure
**Read the reference template** before generating. Don't memorize it — read it each time to absorb the patterns.
- For flowcharts, sequence diagrams, ER, state machines, mind maps: read `./templates/mermaid-flowchart.html`
- For data tables, comparisons, audits, feature matrices: read `./templates/data-table.html`
- For interactive step-through walkthroughs, tutorials, concept explanations: read `./templates/walkthrough.html`
- For dashboards, KPI summaries, metrics overviews: read `./templates/dashboard.html`
- For timelines, roadmaps, milestone tracking: read `./templates/timeline.html`
- For text-heavy architecture diagrams, or hybrid pattern (Mermaid overview + detail cards): read `./templates/architecture.html`
- For non-editorial aesthetics, also read `./references/aesthetic-palettes.md` for ready-made palettes.
**For CSS/layout patterns and SVG connectors**, read `./references/css-patterns.md`.
**For pages with 4+ sections** (reviews, recaps, dashboards), also read the "Section Navigation" section in `./references/css-patterns.md` for sticky sidebar TOC on desktop and horizontal scrollable bar on mobile.
**Choosing a rendering approach:**
| Diagram type | Approach | Why |
|---|---|---|
| Execution flow / code flow | **Excalidraw pipeline (required)** | These are flowcharts in practice; Excalidraw output is clearer and less cluttered |
| Flowcharts (`flowchart`/`graph`) | **Excalidraw pipeline** | Cleaner hand-drawn output: Mermaid text -> `@excalidraw/mermaid-to-excalidraw` -> Excalidraw SVG export |
| Other Mermaid diagrams (sequence, ER, state, mind map, data flow) | **Mermaid** | Broader syntax support where Excalidraw conversion is limited |
| Architecture (text-heavy) | CSS Grid cards + flow arrows | Rich card content (descriptions, code, tool lists) needs CSS control. See `templates/architecture.html` |
| Architecture (hybrid, 15+ elements) | Mermaid overview + CSS Grid detail cards | Simplified 5-8 node Mermaid for the big picture, then detail cards below. See hybrid pattern in `templates/architecture.html` |
| Data table | HTML `
` element — not CSS Grid pretending to be a table. Tables get accessibility, copy-paste behavior, and column alignment for free. The reference template at `./templates/data-table.html` demonstrates all patterns.
**Use proactively.** Any time you'd render an ASCII box-drawing table in the terminal, generate an HTML table instead. This includes: requirement audits, feature comparisons, status reports, configuration matrices, test result summaries, dependency lists, permission tables, API endpoint inventories.
### Walkthrough / Tutorial
Interactive step-through for progressive disclosure of concepts, processes, or tutorials. Each step has a visual element and explanatory text. Navigation via prev/next buttons, clickable dots, and keyboard arrows. The reference template at `./templates/walkthrough.html` demonstrates the pattern — vanilla JS, no framework dependencies.
### Timeline / Roadmap Views
Vertical or horizontal timeline with a central line (CSS pseudo-element). Phase markers as circles on the line. Content cards branching left/right. Date labels on the line. Color progression from past (muted) to future (vivid).
### Dashboard / Metrics Overview
Card grid layout. Hero numbers large and prominent. Sparklines via inline SVG ``. Progress bars via CSS `linear-gradient`. KPI cards with trend indicators.
## File Structure
Every diagram is a single self-contained `.html` file. No external assets except CDN links (fonts, optional libraries). Structure:
```html
Descriptive Title
```
## Quality Checks
Before delivering, verify:
- **Visual minimum met** (see requirements above).
- **First screen test**: Without scrolling, can the reader already see a meaningful visual model of the subject?
- **Single-file preference respected**: If you generated more than one file, there was a real reason, and the main file links to each supporting file.
- **Both themes**: Toggle your OS between light and dark mode. Both should look intentional, not broken.
- **Information completeness**: Does the diagram actually convey what the user asked for? Pretty but incomplete is a failure.
- **No overflow**: Resize the browser to different widths. No content should clip or escape its container. Every grid and flex child needs `min-width: 0`. Side-by-side panels need `overflow-wrap: break-word`. See the Overflow Protection section in `./references/css-patterns.md`.
- **File opens cleanly**: No console errors, no broken font loads, no layout shifts.
- **Squint test**: Blur your eyes or zoom the browser to 25%. The visual hierarchy should still be obvious — hero sections dominate, reference material recedes, section boundaries are clear. If everything blurs into the same weight, the depth tiers aren't working.
- **Print-friendly**: Cmd+P should produce a clean PDF. See `css-patterns.md` for print styles.
## Constraints
Hard rules — not guidelines. Violating these creates broken or unusable output.
- **Max 15 Mermaid nodes per diagram** (soft target 10-12). Beyond this, use `subgraph` to group, split into multiple diagrams, or use the hybrid pattern (simplified Mermaid overview + CSS Grid detail cards). For systems with 15+ elements, the hybrid pattern in `templates/architecture.html` is preferred.
- **Prefer `flowchart TD` for 5+ nodes.** Top-down vertical flow reads naturally and scales on narrow viewports. Use `flowchart LR` only for simple 3-4 node linear flows.
- **Section navigation required for pages with 4+ sections.** Read the Section Navigation section in `css-patterns.md` and include the TOC. Long pages without navigation are hostile to readers.
- **Pagination or virtual scroll for tables with 50+ rows.** Either paginate (show 25 at a time with prev/next) or truncate with a "Show all" toggle. Large DOM tables are slow and unusable.
- **Never exceed 1000 lines of HTML.** If approaching this, split into multiple pages or collapse secondary sections with ``.
- **Never use `innerHTML` with user-provided content.** Use `textContent` or DOM APIs. This prevents XSS in interactive elements.
- **Maximum 5 KPI cards in a row.** More than 5 gets cramped. Use a second row or collapse less important metrics.
- **Test Mermaid syntax separately.** If the diagram is complex (10+ nodes), validate the Mermaid syntax in isolation before embedding. A broken diagram = a broken page.
- **Report pages must not be prose-dominant.** If more than half of the main sections are plain narrative cards with no visual encoding, redesign the page.
- **Do not split output across multiple files unless needed.** If you do, one main HTML file must link to all companion files and serve as the clear entry point.