render-as-html · design system
Canonical reference for the render-as-html skill. Components, patterns, and the principles behind them. Copy patterns from here rather than re-deriving CSS — generated artifacts should feel like one system.
Philosophy
Apple-quality typography and color, Linear/Stripe density.
Wide. Dense. Opinionated. Studio Displays exist; narrow centered columns waste them. 14-16px body, 1.45-1.55 line-height, tight padding. Information density is a feature.
The medium is the source of truth. Thariq: "there is almost no set of information that Claude can read that you cannot fairly efficiently represent with HTML." Lean into tables, SVG, CSS-as-data, and interaction. If flattening the artifact loses nothing but a diagram, the artifact is probably still too close to static prose.
The real reason for all this: staying in the loop. As Claude does more work, the temptation is to skim-and-approve plans you'd otherwise read carefully. A well-built HTML artifact pulls you back in. You actually read it, poke at the controls, push state back via copy-as-prompt. The doc becomes a conversation surface, not a deliverable to rubber-stamp.
Page shapes
Different content wants different bones. Pick the shape FIRST from content signals, then design inside it.
dashboard default for data
Ops console for tabular/system data. Wide, multi-column, dense.
document default for prose
Reading-shape for plans, specs, briefings. Single column with sticky TOC.
timeline spec'd
Chronological event spine for diaries, logs, retros, trip journals.
runbook spec'd
Sequential procedure being executed — DR, deploy, machine rebuild.
comparison spec'd
Weighted decision matrix. Items as columns, criteria as rows.
triage-board spec'd
Drag-between-buckets editor — GTD reorg, inbox triage, re-prioritization.
developer spec'd
PR explainer, code review, "explain this code" — annotated diff with severity findings.
network-map spec'd
Entity graph — people, relationships, brain backlinks, dependencies.
The 8 information dimensions (Thariq)
HTML can express state, interaction, layout, and visual relationships inside the file itself. Aim for at least 4 of these dimensions; if you only used 1-2, redesign before saving.
The bar (read this every time)
If I flattened this HTML to static text, what would be impossible to preserve?
If the only answer is "the SVG diagram," it's styled prose, not an HTML artifact. A passing artifact has 3+ HTML-native features:
- Live filter / search input
- Clickable elements that cross-highlight other content
- Inline SVG charts generated from data
- Spatial layouts (floor plans, zone maps)
- Color swatches showing real colors
- Toggle controls (show/hide columns, dark/light)
- Side-by-side visual diffs
- Click-to-copy / sortable headers
- Copy-as-prompt buttons that round-trip state back to the HTML file ← Thariq's killer pattern
Color tokens
All colors via CSS variables; both modes via prefers-color-scheme. Text-use colors meet WCAG AA on light backgrounds.
Typography
One display, one body, one mono. Display and body use the system font stack, so generated artifacts stay self-contained.
cv11 & ss01 features on for the right "g" and "1".Static components
Read-only display primitives. None of these are clickable — for interactive editing use the controls in the next section.
Stat tiles
Status pills — display only, NEVER interactive
Callouts
Use sparingly — every callout dilutes the rest. 2-3 per artifact is plenty.
Visual diff (old → new)
| Subnet | 192.168.68.0/24→192.168.1.0/24 |
| core link | Wi-Fi→2.5 GbE wired |
Dense table
| IP | Device | MAC | Notes |
|---|---|---|---|
.254 | BGW620-700 | — | gateway · multigig WAN |
.225 | core · M2 Ultra | a4:fc:14:xx:xx:xx | 2.5 GbE wired |
Real controls for real actions
If the user is supposed to toggle, edit, pick, or trigger something, use a control that LOOKS like a control. Never invent gestures on decorative elements.
Search input
Filter chips — every filter needs a visible clear path
Click to toggle. When ≥1 chip is OFF, an explicit "× clear" affordance appears nearby. Never rely on double-click / escape / click-outside to reset.
Native checkboxes — the editing affordance
- Camera HTTP creds obtained
- core on wired Ethernet
- Decide: Luma NVR vs SecuritySpy
- Prune stale Tailscale nodes
For TODO-shaped data, use the universal checklist affordance. Anyone gets it in 0 seconds. Paired with copy-as-prompt below, you have a real editing surface.
Toggle buttons
Copy-as-prompt — the killer pattern
Thariq's two-way loop: tune values in the browser → click a button → paste-able prompt for Claude Code that applies the changes back to the HTML artifact. Try the live demo below.
pattern code (the 20 lines that make this work)
// Read state from your controls, format as instruction
async function copyPrompt() {
const h = +$('#hue').value, s = +$('#sat').value, l = +$('#lig').value;
const prompt = `In ${ARTIFACT_PATH}, update --accent to hsl(${h} ${s}% ${l}%)`;
$('#prompt-output').value = prompt;
try {
await navigator.clipboard.writeText(prompt);
} catch {
$('#prompt-output').focus();
$('#prompt-output').select();
}
}
$('#copy-btn').onclick = copyPrompt;
// The prompt MUST:
// - name the HTML artifact file (so Claude knows what to edit)
// - state deltas, not the full HTML
// - read naturally when pasted as a user message
// - remain selectable when clipboard access is blocked
Per-section copy — document-shape pattern
For document-shape artifacts, every h2 should have a quiet "copy section" button that lands the section's HTML on the clipboard for reuse or follow-up edits.
Implementation: copy the section's HTML directly from the DOM, and reveal the button on h2 hover via CSS opacity. Keep a visible fallback text area for browsers that block clipboard writes.
pattern code
<section id="workstreams">
<h2>Workstreams <button class="copy-section" data-section="workstreams">copy section</button></h2>
...
</section>
<textarea id="copy-fallback" hidden readonly></textarea>
$$('.copy-section').forEach(btn => btn.onclick = () => {
const html = $('#' + btn.dataset.section).outerHTML;
navigator.clipboard.writeText(html).catch(() => {
$('#copy-fallback').hidden = false;
$('#copy-fallback').value = html;
$('#copy-fallback').focus();
$('#copy-fallback').select();
});
});
Charts & diagrams
All hand-written inline SVG. No chart libraries — they cost weight and produce generic-looking output.
Donut chart
donut math — circumference-100 trick
<!-- r=15.9 → circumference ≈ 100, so stroke-dasharray uses percentages directly -->
<circle r="15.9" cx="21" cy="21" fill="transparent"
stroke="var(--accent)" stroke-width="6"
stroke-dasharray="20 80" <!-- 20% slice -->
stroke-dashoffset="-10"/> <!-- offset after previous slice -->
Topology / workflow pattern
Solid = wired/sync, dashed = wireless/async. Fill = category soft, border = category full. Make nodes clickable to cross-highlight rows in the data table.
Anti-patterns
- Narrow centered column on data. Studio Displays exist. Default wide; narrow only for prose.
- Styled prose. If flattening to static text loses nothing but the SVG, the artifact failed. ≥3 HTML-native features.
- Invented gestures on decorative elements. Don't put click handlers on pills, badges, stat tiles. They read as static info. If editing needed, add a real checkbox/button.
- Hidden keyboard modifiers (shift-click, alt-click) for primary actions. Undiscoverable. Use visible controls instead.
- Filter without a clear path. Every activate gesture must also deactivate, AND show an explicit "× clear" affordance while filtered.
- Generous whitespace as taste. Information density is a feature.
- Emoji explosion. 1-3 per doc, not 1 per heading.
- Tailwind utility soup. Hand-written CSS reads better, renders the same.
- "Key Insights" decoration. Avoid generic AI-report ornamentation unless it adds real structure.
- Drop shadows on everything. Reserve for floating elements (copy button, modals).
- Skipping the HTML-native check. Name 3 features that die outside HTML before saving. Can't? Redesign.
Using this file
Before generating a new artifact:
- Pick the page shape from content signals —
dashboardfor data,documentfor prose. If unclear, ask. - Copy the
:root+ dark-mode block as starting CSS - Pattern-match components from this gallery — don't re-derive
- Plan the HTML-native features — write down 3+ before opening the editor
- Add copy-as-prompt if there's mutable state worth round-tripping
- Validate against the bar — what would die outside HTML? If <3, redesign.