agentleFS
nrjdalalnrjdalal/inscope/.agents/skills/fonts/SKILL.md

fonts

Skill3 starsChanged 36 days agoMITView on GitHub

Add, swap, or remove a self-hosted web font (latin variable woff2 from fontsource, localized via next/font/local). Use when adding a font role, or debugging font loading, preload, or CLS.

4 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is 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.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Verify loading: dev CSS emits hashed /_next/static/media/*.woff2 urls plus the generated "<family> Fallback" faces, and a production build …

    line 33
  2. Distinctive:

    If a public page changed, check CLS and LCP for layout shift before shipping.

    line 34

“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

[!CAUTION] Synced from https://github.com/nrjdalal/zerostarter. Customize this skill or remove this note to stop syncing.

Fonts

Every font is self-hosted through next/font/local. That loader is what generates the metric-adjusted "<family> Fallback" faces that keep CLS near zero, so it is not optional. Do NOT switch to fontsource CSS imports: the bundler resolves their url() references to node_modules paths that 404 in dev, and they emit no compiler-only fallback metrics.

Layout

  • web/next/src/fonts/*.woff2, the vendored latin variable files
  • web/next/src/lib/fonts.ts, one localFont per family, each exporting a CSS variable
  • web/next/src/app/layout.tsx, where the variables are applied on <html>
  • web/next/src/app/globals.css @theme inline, where roles chain to the font variables (--font-sans: var(--font-dm-sans), sans-serif)

Add or swap a font

  1. Fetch the latin variable file from the fontsource CDN directly, no dependency needed:

    curl -L -o web/next/src/fonts/<name>-latin-wght-normal.woff2 \
      https://cdn.jsdelivr.net/npm/@fontsource-variable/<name>/files/<name>-latin-wght-normal.woff2
  2. Declare it in web/next/src/lib/fonts.ts: localFont({ src: "../fonts/<file>", variable: "--font-<name>", weight: "<min> <max>" }). The weight range is MANDATORY for a variable font: omit it and the face pins to 400, so every bold glyph becomes faux-bold synthesis. Read the range from the fontsource CSS, curl -s https://cdn.jsdelivr.net/npm/@fontsource-variable/<name>/index.css | grep font-weight. A serif also sets adjustFontFallback: "Times New Roman" (the metrics default to Arial).
  3. Apply the export's .variable on <html> in layout.tsx.
  4. Wire the role in globals.css @theme inline: --font-<role>: var(--font-<name>), <generic>.
  5. Verify loading: dev CSS emits hashed /_next/static/media/*.woff2 urls plus the generated "<family> Fallback" faces, and a production build (Vercel preview, protection-bypass header) emits one <link rel="preload" as="font"> per file, with no font 404s.
  6. If a public page changed, check CLS and LCP for layout shift before shipping.

Notes

  • The data table measures header labels from bundled metrics of the sans woff2, generated by packages/scripts/src/data-table-metrics.ts into .generated/data-table-metrics.json (in the web build, dev, and check-types chains). Swapping the sans re-measures automatically on the next run, but the script's FONT path must point at the new file: update it when the filename changes.
  • Preload is scoped by import. Any font in web/next/src/lib/fonts.ts preloads on every page, because the root layout imports it. To scope a font to specific routes, declare it in a module only those routes import: author-only fonts live in web/next/src/lib/marketing/fonts.ts, with woff2 under web/next/src/fonts/marketing/.
  • DM Sans vendors its italics: src is an array of { path, style } entries under one top-level weight. Mono renders synthetic oblique for italics, by choice.
  • A non-variable font takes the per-weight files, with src as an array carrying a weight per entry.
  • To remove a font, delete the woff2, its localFont definition, the <html> variable, and the globals.css role, then grep the variable name to catch stragglers.

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.