Optimize Web Font Loading Without Changing Rendering
Once per site, when web fonts are slowing page loads — subset, split and preload fonts to shrink font bytes as far as possible while keeping rendering pixel-identical.
- existing
- operations
- #fonts
- #performance
- #web-fonts
- #subsetting
- #frontend
- by Shu (@shuding)
## Context
This is a live site that already renders correctly. You are optimizing its web fonts:
shrink font bytes as far as possible while keeping rendering identical. This is a
ONE-TIME optimization task.
**The rules in the Guardrails section outrank byte savings. Read them before
starting.**
## Goal
Every page loads fewer font bytes and renders pixel-identically to before, proven with
before/after pixel diffs.
## Inputs
This prompt is self-contained: it discovers everything it needs from the repository —
font files, stylesheets, component styles, content and build setup.
## Instructions
### Measure the current state
For each font file: size, glyph count, variable axes, OpenType features and hinting.
Per page: font bytes loaded and what each page preloads.
### Find out what the site actually uses
Check inline component styles as well as stylesheets:
- Which characters appear in the content.
- Which axis values and weights each font needs — including one-off overrides and
bold inside italics.
- Which OpenType features are turned on.
- CSS side effects, like `hyphens: auto` using the U+2010 hyphen.
### Cut each font down to that usage
- Keep the used characters plus Latin-1 and Latin Extended-A. Leave CJK to system
fonts if that is how it renders today.
- Limit variable axes to the ranges in use. Only fix an axis at one value if nothing
overrides it.
- Drop unused OpenType features and hinting.
### Split each font into two files
- A small core with ASCII and the punctuation most pages use (curly quotes, dashes,
ellipsis), which gets preloaded.
- An extended file behind `unicode-range` that only downloads when a page needs one
of its characters.
- Each file's `unicode-range` lists only characters it actually contains.
### Watch out for these
- A generated fallback face between the core and extended files will draw the
extended characters before the real font does.
- Fonts with a Reserved Font Name under the OFL must be renamed internally once
subset.
- Check the generated files — font tools have quirks.
### Verify before calling it done
- Build a baseline from the same content and pixel-diff before and after on pages
with code, italics, accented characters, components with their own font settings,
and CJK.
- Explain every visible difference: content change, regression to fix, or harmless
sub-pixel rounding.
- Re-measure bytes per page and confirm the extended files only load where needed.
## Output format
Write a report file named `font-optimization-report.md` covering:
1. **Bytes** — before and after per font and per page.
2. **Pixel diffs** — results per tested page, with every visible difference explained
as content change, regression, or harmless sub-pixel rounding.
3. **Deviations** — anywhere you deviated from what was asked, and what it cost.
4. **Rerun** — how to rerun the script and when it is needed.
## Guardrails
These rules outrank byte savings — binding throughout the whole task:
- Treat any visual change as a regression unless I approve it. If an optimization
would change rendering, tell me what it saves and what it changes, and keep the
site looking the same by default.
- Keep the current loading behavior: do not touch `font-display` or fallback fonts.
- Do not add font processing to the build. Write a script I run by hand, commit its
output, and note when it needs rerunning.
- You may modify repository files (font files, stylesheets, the script) as part of
this task.More prompts
## Context You are making this repository's CI as fast as possible without letting it lie. This isa ONE-TIME restructure task. The repository already exists and has a running CI pipelinewith real history to mine. **The rules in the Guardrails section outrank speed. Read them before starting.** ## Goal
Optimize CI Speed Without Weakening Checks
Once per repository, when CI feedback is too slow — audit where pipeline time goes and restructure it toward sub-minute PR results without hiding or dropping any check.
- #ci
- #performance
- #testing
- #bun
pBy @pontusab
## Context The codebase is already built and running. The test suite has accumulated teststhat guard no behavior — they churn on every refactor, yet would stay greenthrough a real regression. Keep a test only if it depends on the intended behavior: it should change onlywhen that behavior changes, and fail only when it regresses.
Prune Tests That Guard No Behavior
Once per codebase, when the test suite has grown bloated — delete or rewrite every test that guards no behavior so each remaining test fails on a regression and only on a regression.
- #testing
- #refactoring
- #tech-debt
- #agents
mBy @mazeincoding
## Context You are setting up an automated gate that blocks sloppy, AI-generated Go code. This is aONE-TIME setup task. The repository already exists and builds; nothing has been gated yet. **The ground rules in the Guardrails section are binding. Read them before starting.** Work in the phases below, in order. Do not write any config before Phase 1 is complete andyou have evidence from this codebase.
Set Up a Self-Improving Quality Gate for a Go Repository
Once per Go repository, when the code is already built and you want an automated gate that blocks sloppy, AI-generated Go code and gets stricter over time.
- #go
- #quality
- #ci
- #linting
- #agents
By Claude Sonnet 5.5 Medium