agentleFS
ZmokiZmoki/zmoki-astro-starter/.claude/skills/og-images/SKILL.md

og-images

Skill4 starsChanged 5 months agoMITView on GitHub

Customize the Open Graph / social-share image cards — layout, colors, fonts, text, dimensions, add a template variant, or change which pages get a card. Use when the user wants to change how link previews / social cards / OG images look.

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. richtabor/agent-skills★ 72same name
    2. karero/website-builder★ 6same name
    3. Anglesite/anglesite-skills★ 4same name
    4. amajorai/skills★ 3same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository9 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the PNG to eyeball it.

    line 35
  2. Very specific:

    Add the name to the OgTemplate union in src/og/types.ts.

    line 55
  3. Very specific:

    Write a fooCard(entry) builder in src/og/card.ts and route to it in renderCard.

    line 56
  4. Very specific:

    If you changed any card color or font size, also confirm every text pair still clears WCAG AA against the cream-100 card background (see …

    line 85

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

OG images

Social-share cards (the image shown when a page is posted to X, Slack, LinkedIn, …). They are purpose-built cards rendered at build time by Satori (vdom → SVG) then resvg (SVG → PNG) — no browser, no running server, nothing committed. astro build emits them to dist/og/**/*.png; astro dev renders the same route on request.

Model

Everything lives in src/og/ plus one endpoint. Edit the file that owns what you're changing:

FileOwns
src/og/manifest.tsWhich pages get a card + each card's text (title, description, eyebrow, alt)
src/og/card.tsHow the cards look — the article and site layouts (Satori nodes)
src/og/theme.tsCard colors (from design tokens) + dimensions (OG_WIDTH/OG_HEIGHT)
src/og/fonts.ts + fonts/*.woffThe card font (Noto Sans subset)
src/og/types.tsOgEntry shape + the OgTemplate union
src/pages/og/[...path].png.tsThe endpoint: getStaticPaths from the manifest → render → PNG

The manifest is the single source of truth, shared by the endpoint (to render every card) and BaseLayout.astro (for each page's og:image + og:image:alt, via getOgImage(pathname)). Pages with no entry fall back to the default card.

Preview loop

There is no separate generate step. To see a change:

# dev: hit the route directly (renders on request)
npm run dev        # then open /og/index.png, /og/blog/<id>.png, /og/default.png
# or build: emits every card
npm run build      # then open dist/og/**/*.png

Read the PNG to eyeball it. Always finish with a build (below).

Common edits

Change the card colors

Cards read from the design tokens, so a re-skin does this for you — run the /brand skill and the cards follow. To tune only the cards, edit the token picks in src/og/theme.ts (bg, ink, muted, accent, …). Every value is passed through culori's formatHex (see Gotchas).

Every text/background pair on a card must meet WCAG AA — ≥ 4.5:1 for normal text, ≥ 3:1 for large text (the title/name) and the brand-mark letter. The card background is cream-100 (not white), so re-check contrast against that — don't assume a pair that passes on the site's white cards also passes here. The tight pair is muted text (stone-500) on cream-100 ≈ 4.5:1 — it sits right at the AA floor, so lightening either the bg or muted token drops the eyebrow / description / domain below AA first. If a pair fails, darken the token (or enlarge/bold the text) — don't ship it.

Change the card font

Edit src/og/fonts.ts and drop the new .woff/.ttf (Satori needs the file, not a CSS @font-face) into src/og/fonts/, then use its name in card.ts styles. This is separate from the site's Google Fonts — if you swap the brand typeface (/brand skill), update these too or the cards won't match.

Tweak a card's layout or copy

Edit articleCard / siteCard in src/og/card.ts. They're built with a tiny el(type, style, children) helper (React-like Satori nodes — no JSX). To change the text on a card (e.g. the eyebrow format, or the site card's tagline), edit src/og/manifest.ts instead.

Add a new template variant

  1. Add the name to the OgTemplate union in src/og/types.ts.
  2. Write a fooCard(entry) builder in src/og/card.ts and route to it in renderCard.
  3. In src/og/manifest.ts, build entries with template: "foo".

Change which pages get a card

Edit buildEntries() in src/og/manifest.ts. It mirrors the sitemap (home, blog index, posts, resources, legal, + default). Adding a new content collection? Add a getCollection(...) block and map it to entries, using a unique key (the filename stem under /og/, e.g. key: "notes/<id>" → /og/notes/<id>.png).

Change the image dimensions

Edit OG_WIDTH / OG_HEIGHT in src/og/theme.ts and the og:image:width / og:image:height meta in src/layouts/BaseLayout.astro. Keep the 1.91:1 ratio (1200×630) unless you have a reason not to.

Gotchas (Satori's rendering is a strict subset)

  • Colors must be hex/rgb, not oklch. Tailwind v4's default palettes are oklch() strings, which resvg renders as near-black. theme.ts converts every token with culori's formatHex; keep that wrapper on any new token.
  • Every multi-child container needs display: "flex" and an explicit flexDirection. Satori has no block layout.
  • No line-clamp. Long text overflows the canvas, so the manifest truncates title/description (TITLE_MAX / DESC_MAX). Adjust those caps rather than expecting wrapping to save you.
  • The bundled font is the Latin subset only. For other scripts, bundle a fuller .woff in src/og/fonts/.
  • The footer's site name / domain / brand initial come from src/site.config.ts — no need to hardcode them in a card.

Verify

npm run build        # all cards emit to dist/og/ — a broken font/color pipeline still "builds" but yields blank/black cards, so...
# open a couple of dist/og/**.png and confirm colors, font, and text render
npm run check        # types
npm run lint
npm run format

If you changed any card color or font size, also confirm every text pair still clears WCAG AA against the cream-100 card background (see "Change the card colors") — the muted-text pair is the one that fails first.

Nothing is committed — the PNGs are build output (dist/ is gitignored). The only committed OG assets are the font files under src/og/fonts/.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.