---
name: satori-og-and-svg-charts
description: Generate deterministic 1200x630 Open Graph PNG share cards using Satori + sharp and crisp 1400px-wide editorial SVG-to-WebP data charts or architecture diagrams grounded in real structured data, enforcing XML escaping, collision-free typography, and visual inspection.
---

# Programmatic Satori OG Card & SVG Data Chart Protocol

Whenever generating Open Graph social share cards (`1200x630` PNG) or publication-grade data charts and architectural diagrams (`1400px` wide WebP), follow this deterministic code-driven design protocol instead of generating AI raster art:

## 1. Open Graph Social Cards (`1200 x 630` via Satori + Sharp)
- Load real local `.ttf` or `.woff` font buffers (never rely on remote Google Fonts fetches during CI/sandbox builds).
- Restrict Satori JSX strictly to supported Flexbox layout properties (`display: 'flex'`, explicit `flexDirection`, zero CSS Grid, zero unsupported `calc()`).
- Enforce clean editorial hierarchy: top mono kicker (`14px`), high-contrast title (`48–56px`, truncated cleanly at word boundary if `> 80` chars), concise 2-line subtitle (`22px`), and bottom metadata strip (left: category/metrics; right: verified date).
- Rasterize Satori's SVG string to PNG with `sharp(Buffer.from(svg)).png({ compressionLevel: 9 }).toBuffer()`.

## 2. Technical Data Charts & Diagrams (`1400px` SVG -> Retina WebP)
- Always escape XML reserved characters (`&`, `<`, `>`) inside `<text>` nodes—an unescaped `<path>` or `&` causes `sharp` / `librsvg` XML parse errors immediately.
- Render SVG at `density: 144` and `webp({ quality: 92, effort: 5 })` so hairline borders and `11px` monospace numbers stay razor-sharp on HiDPI monitors.
- **Collision-Prevention Rules:**
  1. Draw faint gridlines first (`stroke-opacity="0.55"`); place a clean white backdrop pill (`<rect fill="#FFFFFF" opacity="0.94">`) behind any text label that crosses a vertical gridline.
  2. Never slice text strings mid-word; wrap into explicit two-line stacked `<text>` elements with generous horizontal column padding (`>= 18px`).
  3. Place values inside long dark/signal bars in crisp `#FFFFFF` when bar width `> 220px`, and outside to the right otherwise.
  4. Use tabular monospace typography for all dollar amounts, percentages, pixel dimensions, and axis scales.

## 3. Mandatory Visual Inspection Gate
Never ship a freshly generated OG card or data chart without opening the rendered `.png` or `.webp` image and visually inspecting it for clipped margins, colliding labels, broken glyphs, or inaccurate axis scaling.
