---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://framesfield.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
title: "Satori OG Image and SVG Data Chart Skill"
description: "Installable SKILL.md teaching Claude Code, Cursor, and Codex to generate deterministic 1200x630 Open Graph share PNGs with Satori + sharp and crisp 1400px-wide retina SVG-to-WebP data charts directly from real frontmatter or JSON data—with XML escaping, daylight typography, and mandatory visual QA."
canonical: "https://framesfield.com/skills/satori-og-card-and-chart-generator-skill"
---

# Satori OG Image and SVG Data Chart Skill

> Installable SKILL.md teaching Claude Code, Cursor, and Codex to generate deterministic 1200x630 Open Graph share PNGs with Satori + sharp and crisp 1400px-wide retina SVG-to-WebP data charts directly from real frontmatter or JSON data—with XML escaping, daylight typography, and mandatory visual QA.

- **Canonical URL:** https://framesfield.com/skills/satori-og-card-and-chart-generator-skill
- **Raw Payload URL:** https://framesfield.com/raw/skills/satori-og-card-and-chart-generator-skill
- **Asset Type:** SKILL.md
- **Compatible Hosts:** Claude Code, Cursor, Codex
- **Target Creative Tool:** Satori / Sharp / SVG-to-WebP
- **License:** MIT
- **Last Verified:** 2026-11-30
- **Source Reference:** https://github.com/vercel/satori

## Setup & Install

```bash
mkdir -p .claude/skills/satori-og-and-svg-charts
curl -fsSL https://framesfield.com/raw/skills/satori-og-card-and-chart-generator-skill -o .claude/skills/satori-og-and-svg-charts/SKILL.md

```

## Copyable Asset (SKILL.md)

```markdown
---
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.
```

## Example Input

```text
"Build a build-time 1200x630 Satori OG card renderer for our blog posts and a 1400x700 SVG-to-WebP bar chart comparing API costs from src/content/specs/*.json."
```

## Expected Output

```text
- Wires src/pages/og/[slug].png.ts loading bundled local .ttf fonts into Satori + sharp with exact 1200x630 PNG output.
- Generates scripts/generate-charts.mjs reading verified JSON specs, rendering crisp collision-free 1400x700 WebP at density 144.
- Visually opens and confirms zero text overlap before embedding with explicit width/height attributes.
```

## Requirements

- Node.js 18+ with `satori` and `sharp` installed
- Local `.ttf` / `.otf` font files bundled inside the repo (no flaky runtime network font calls)

## Known Limits

- Satori supports CSS Flexbox only (not CSS Grid) and requires explicit `display: 'flex'` on multi-child containers
- Librsvg inside sharp does not auto-wrap SVG `<text>` lines—break long sentences explicitly into stacked `<text>` nodes

## Implementation Notes

## Build editorial charts that stay synchronized with real data

This exact Satori + `sharp` architecture powers every social share card and technical guide figure across FramesField—see [Guide 10: AI Design-to-Code: Figma MCP, Tokens and Visual QA](/guides/design-to-code-ai-engineering-guide) and [Skill 31: Sharp WebP, AVIF and Responsive Image Skill](/skills/sharp-responsive-webp-image-pipeline-skill).
