optimize-web-fonts
Installation
SKILL.md
optimize-web-fonts
Make a site's web fonts smaller and keep rendering pixel-identical. You run scripts by hand, commit their output and say when to rerun them. Nothing is added to the site's build.
Inspired by Shu Ding's prompt: https://x.com/shuding/status/2115855028737200211
Rules (from the owner's brief; do not relax them silently)
- Any visual change is a regression unless the user approves it. If an optimization would change rendering,
say what it saves and what it changes, and leave it off by default (
--axes trimis exactly that case). - Keep the current loading behaviour: do not touch
font-display,size-adjust/override descriptors or fallback fonts. The scripts copy those descriptors verbatim. - Preloading is optional. Some sites forbid preloads (they can hurt FCP). Default is to preserve the site's policy:
--preload autopreloads the core file only where the site already preloaded that font;offnever;onalways. - No font processing in the site's build. The user runs the scripts by hand and commits the generated files.
- Never ship a Reserved-Font-Name font under its original name after subsetting (OFL). See
references/ofl-rfn.md. - Before you call it done: pixel diff on pages with code, italics, accented characters, components with their own font settings and CJK; explain every differing pixel; re-measure; confirm extended files load only where needed.