Home
cd ../playbooks
Developer ToolsIntermediate

Visual Explainer HTML Pages

Generate self-contained HTML explanations instead of walls of chat text or terminal ASCII — a design-judgment pass before any HTML is written (palette, type, layout concept, audited against genericness), Mermaid diagram invariants that force labeled mechanism over decoration, and a hard list of generic-default patterns to avoid (gradient heroes, violet accents, centered-everything layouts).

5 minutes
By nicobailonSource
#html#mermaid#diagrams#documentation#web-design#technical-writing

A 4-row comparison table or a system diagram dumped as chat text or bare ASCII forces the reader to reconstruct the visual structure in their head — and the fix isn't more words, it's recognizing when content is inherently visual and rendering it as a real, self-contained HTML page instead, with the same design discipline you'd apply to a real deliverable.

Who it's for: developers who want architecture diagrams, diff reviews, or project recaps rendered as real pages instead of chat walls, teams that want explanatory HTML output to avoid generic AI-generated design clichés (gradient heroes, violet accents, centered layouts), anyone building a Mermaid-heavy explanation who wants labeled, mechanism-showing diagrams instead of decorative boxes-and-arrows, engineers who need a light/dark-mode-correct token system for one-off explanatory pages

Example

"Explain this system architecture visually" → A content-appropriate representation chosen first (a Mermaid diagram for a data-flow-heavy architecture, CSS grid cards for a text-heavy module breakdown), a written design plan (named hex values, type roles, one-sentence layout concept) audited against generic AI-page tells before any HTML is written, and a self-contained page with labeled diagram arrows, a real light/dark token system, and zero gradient-hero or violet-accent clichés

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

# Visual Explainer (Self-Contained HTML)

Generate self-contained HTML pages that explain systems, code changes, plans, data, and technical concepts visually. Use for diagram requests, architecture overviews, diff/plan reviews, project recaps, comparison tables, slide decks, and any explanation that's inherently visual rather than a wall of prose.

## When to Prefer a Page Over Chat

Prefer an HTML page over terminal ASCII or a long chat message when the output is inherently visual. If a table would have 4+ rows or 3+ columns, render it as HTML and give only a short chat summary. The final page must be a complete, self-contained HTML document — embedded CSS, a self-contained favicon, and any needed JS, no external dependencies that could go missing later.

## Design Judgment (Before Writing Any HTML)

- **Calibrate treatment to the content.** Diff reviews, memos, audits, and recaps get polished-utilitarian: real hierarchy, considered spacing, no flashy hero. Showcases and narrative decks get editorial. A well-composed page is never wrong; an over-designed one sometimes is.
- **Precedence order:** the user's explicit words, then the project's existing design system (theme/token files, component styles) if one exists, then your own judgment last.
- **Plan first, in writing:** 4–6 named hex values, type roles, and a one-sentence layout concept. Audit once — "would I produce this same plan for any similar page?" — and revise whatever's generic. (Generic: slate `#0f172a`, indigo accent, Inter, hero-plus-three-cards. Revised for a CLI recap: near-black green, phosphor text, amber accent, JetBrains Mono — a terminal direction where the layout follows the release timeline instead.)
- **Structure must encode something true.** Numbered markers (01/02/03) only when order actually matters; eyebrow labels only when they actually classify; dividers only at real seams in the content.

## Choosing the Representation

| Content | Default representation |
|---|---|
| Flowchart, pipeline, state machine, decision tree | Mermaid |
| Sequence, ER/schema, class diagram, C4, topology-focused architecture | Mermaid |
| Text-heavy architecture, module internals, implementation plans | CSS grid cards, optionally with a Mermaid overview |
| 15+ element architecture | Hybrid: small Mermaid overview + CSS detail cards |
| Comparison/audit/status matrix | Semantic HTML `<table>` |
| Timeline/roadmap | CSS timeline |
| Dashboard/metrics | CSS grid + charts/KPIs |
| Slide deck | `100dvh` slides |

## Mermaid Invariants

**What to draw, before how:**
- Depict the mechanism, not its name — the path a request takes through a cache says more than a box labeled "cache."
- Label every arrow (`writes`, `invalidates`, `polls every 30s`); an unlabeled arrow only says "related somehow."
- To compare options, draw the difference — the edge each adds or removes. Match complexity to what the decision actually turns on.
- One figure, one claim; the caption states it.

**How to render:**
- Use `theme: 'base'` with custom `themeVariables` matching the page's palette.
- For complex diagrams, use ELK layout when available.
- Never use bare `<pre class="mermaid">` — wrap it with zoom controls (in/out/reset/expand), `Ctrl`/`Cmd`+scroll zoom, drag panning, and click-to-expand.
- Prefer `flowchart TD` for complex diagrams. Use `LR` only for simple 3–4 node linear flows.
- Use `<br/>` in quoted flowchart labels, not escaped `\n`.
- Never define a page-level `.node` class — Mermaid uses it internally. Use namespaced page classes instead.
- For 15+ elements, don't cram everything into one Mermaid diagram — use the hybrid overview + cards pattern.

## Layout and Style Invariants

- Use semantic HTML where it helps accessibility and copy/paste: `<table>`, headings, lists, `<details>`, captions.
- Use CSS custom properties for the palette: `--bg`, `--surface`, `--border`, `--text`, `--text-dim`, plus 3–5 accents.
- Pages meant to persist ship both color schemes: tokens on `:root`, a `prefers-color-scheme` media query redefines tokens only, components styled through the tokens — never invert values ad hoc for dark mode. Single-theme is fine when deliberate (one-shot pages, quick summaries).
- Commit to one palette (with light/dark variants) and one font pair per page.
- Anchor the aesthetic to the content's domain: CLI/infra → terminal or IDE-inspired; metrics/audits → data-dense; plans/architecture → blueprint; recaps → editorial; prose → paper/ink. A default warm-cream-serif-terracotta look is itself a cliché if applied to everything.
- **Avoid generic defaults** when choosing freely (a project's own design system overrides this): no body font that's only Inter/Roboto/Arial/Helvetica/system-ui; no violet/fuchsia Tailwind-default accent as the main palette; no cyan+magenta+purple neon dashboard; no gradient-mesh blobs; no purple-to-blue gradient heroes, emoji section markers, centered-everything layouts, uniform large border-radius, or default accent bars on every rounded card.
- Set type deliberately: running text near 65ch measure, a committed type scale, `text-wrap: balance` on headings, letter-spacing on uppercase labels.
- For non-slide, scrollable pages, use a rem-based type scale with one root knob (`html { font-size: 16px }`, choosing a value in the 16–18px range) so a single line rescales the whole page. Minimum effective sizes: body/reading text ≥ 14px, secondary text/labels ≥ 11px, code/mono ≥ 12px. Never hard-code reading text below 14px in raw px. Mermaid SVG labels stay in px, since Mermaid sizes them through its own configuration. Slide decks are a deliberate exception — preserve viewport-responsive `clamp()` typography for those.
- Bias neutrals toward the accent hue; pure mid-grey reads as unconsidered. Space siblings with flex/grid `gap`, not collapsing margins; use `tabular-nums` where digits align in columns.

## Quick Mode

An opt-in fast path for simple, schema-expressible content — a compact JSON spec rendered into a complete HTML document by a script, instead of hand-composed HTML. Not suitable for custom visual composition, slides, Mermaid-heavy diagrams, or content the schema can't express — if the content doesn't fit cleanly, fall back to the normal full-HTML workflow.

## Delivery Rules

- Write files to a dedicated diagrams directory with a descriptive filename, not a generic `output.html`.
- Generate a Markdown companion only when the user explicitly asks for it or wants a source brief — keep HTML as the final visual output, never the reverse.
- Open the generated page automatically when running in a normal interactive context.
- Add missing `<html lang>` and viewport metadata if they're not already present.

Get new playbooks like this one

One email a week with new Claude Code workflows. Free, like everything here.

No spam. Unsubscribe anytime.

README.md

What This Does

A design-first workflow for generating self-contained HTML pages to explain systems, code changes, plans, and data — triggered specifically when content is inherently visual (a comparison table with four-plus rows, an architecture with real structure, a multi-step process) rather than defaulting to chat prose or terminal ASCII for everything. Before any HTML gets written, it forces an explicit design pass: pick 4–6 named hex values, type roles, and a one-sentence layout concept, then audit that plan against the question "would I produce this same plan for any similar page?" — catching and revising the generic parts (slate-and-indigo, Inter, a hero-plus-three-cards layout) in favor of something that actually fits the content's domain (a CLI recap gets a terminal-inspired amber-on-near-black treatment instead).

For diagrams specifically, it enforces Mermaid invariants that separate a genuinely informative diagram from decoration: depict the actual mechanism rather than a labeled box, put a real label on every arrow instead of an unlabeled line that only says "related somehow," and match complexity to what the decision or explanation actually turns on. A full set of layout and style invariants covers a correct CSS-custom-property token system for pages that need to support both light and dark mode, a rem-based type scale with one root-level knob, and — notably — an explicit list of the generic AI-generated-page tells to avoid entirely: gradient-mesh blobs, violet/fuchsia default accents, centered-everything layouts, and emoji section markers among them.


Quick Start

Step 1: Create a Project Folder

mkdir visual-explainer && cd visual-explainer

Step 2: Download the Template

Click Download above, then:

mv ~/Downloads/CLAUDE.md ./

Step 3: Generate a Visual Explanation

claude

Ask Claude to explain a system, review a diff or plan visually, or turn a comparison into a proper page instead of a chat table. It will pick the right representation (Mermaid, CSS cards, a timeline), write and self-audit a design plan first, then produce a complete, self-contained HTML file.


Tips & Best Practices

  • Let the content's domain drive the aesthetic direction deliberately — a CLI/infra explanation calling for a terminal-inspired palette is a stronger choice than reaching for the same generic blue-and-slate treatment on every page regardless of subject.
  • Label every Mermaid arrow with what actually happens along it (writes, polls every 30s) — an unlabeled arrow is close to useless for someone trying to understand the actual mechanism, not just the topology.
  • Check the generic-defaults avoid-list explicitly before finalizing a page — violet/fuchsia accents, gradient-mesh blobs, and centered-everything layouts are specifically called out because they're the most common way an otherwise-good explanation ends up looking like every other AI-generated page.

Limitations

  • A design methodology and set of invariants, not a rendering engine itself — actually building the referenced templates (architecture cards, slide-deck layouts, themed pickers) requires writing the HTML/CSS/JS by hand each time rather than pulling from a bundled template library.
  • Best suited to a one-off or occasional explanatory page; a page meant to be maintained and updated repeatedly may be better served by a proper documentation site than a hand-composed self-contained HTML file.
  • The Mermaid invariants assume Mermaid.js is an acceptable dependency for the page; an environment that can't load it needs the CSS-grid-cards fallback representation instead.

$Related Playbooks

Developer Tools

Web Animation Design Principles

Design web animations that feel natural and purposeful — a decision-first easing blueprint (ease-out for entrances, ease-in-out for movement, ease for hover), duration and frequency rules, spring configuration, the GPU-only performance rule, and mandatory prefers-reduced-motion accessibility patterns with working CSS and Framer Motion code.

5 minutes
Intermediate
Developer Tools

Web Technique to Skill Extractor

Turn a one-off web visual or interaction technique into a reusable, well-scoped skill — the one-sentence mechanism test that separates a real technique from mere styling, a mechanism-vs-staging sort for what belongs in the skill versus the demo, rules anchored to named failures instead of adjectives, and a demo craft bar that treats the acceptance reference as a target, not inspiration.

10 minutes
Advanced
Developer Tools

Planning with Files

Persistent, file-based planning for multi-step AI-agent work — task_plan.md, findings.md, and progress.md on disk, a 2-action rule for capturing multimodal findings before they're lost, a 3-strike error protocol, and a 5-question reboot test to verify state survives a compaction.

5 minutes
Intermediate
Developer Tools

Tool Interface Design for Agents

Design agent-facing tools as contracts an agent must infer entirely from the description alone — the consolidation principle over narrow overlapping tools, architectural reduction toward primitives, actionable error-recovery messages, and an 8-point audit checklist.

10 minutes
Advanced
Developer Tools

PR Queue Triage

Clear a backlog of open pull requests before a release by classifying every PR into an evidence-based disposition — never by title — with a real git merge-tree test against the actual release branch, not the platform's often-wrong mergeable flag.

10 minutes
Intermediate
Developer Tools

Reproducible Database Lookup

A methodology for querying public database APIs — scientific, regulatory, financial, or otherwise — so another agent or human can repeat exactly what you did: bounded calls, count reconciliation, identifier-conversion tracking, and untrusted-data handling for every response.

10 minutes
Advanced
Developer Tools

Project Graveyard: Autopsy Your Abandoned Side Projects

Scan local repos for dead side projects, autopsy each one from its git history, surface your personal death patterns, and pick the one corpse most worth resurrecting — then help ship it.

10 minutes
Intermediate
Developer Tools

PR Review Toolkit

Six specialist reviewers — comments, tests, error handling, type design, general quality, and simplification — each triggered by name or automatically based on what changed in the diff.

5 minutes
Intermediate
Developer Tools

Ralph Wiggum Autonomous Loop

Self-referential development loop that keeps Claude iterating on the same task until it hits a completion promise or an iteration cap — a Stop hook that blocks exit and re-feeds the same prompt.

5 minutes
Advanced
Developer Tools

Vercel Analytics & Speed Insights Setup

Wire up Vercel Analytics, Speed Insights, and SPA routing rewrites into a React/Vite project in one pass — including the routing fix most people miss.

5 minutes
Beginner
Developer Tools

Unslop UI: Kill the AI Design Tells

A frontend guardrail built from a 3.2M-post Reddit analysis of what people actually call AI slop, with a build mode that forces design decisions up front and an audit mode that scans existing code for the tells

10 minutes
Intermediate
Developer Tools

Redesign Existing Projects: UI Audit and Upgrade

A design audit checklist that finds generic AI-look patterns in an existing codebase and fixes them without breaking functionality or migrating frameworks

10 minutes
Intermediate

Browse all Developer Tools playbooks →