Trim what loads before first paint
Reduce the data downloaded before the first screen appears, with tests and screenshots guarding behavior and appearance.
Use this when
Use this when a web app feels heavy on its first visit because it downloads too much code, styling, media, or other data before showing the initial screen.
How it runs
- Before changing code, record passing tests, representative mobile and desktop screenshots of the first screen, and a repeatable baseline for compressed transferred bytes—the amount actually downloaded.
- Use a build or bundle report to find large or early downloads, then choose one safe candidate to delay until needed, compress, inline, or remove.
- Rebuild and rerun the same tests, screenshots, and download measurement; keep the change only when every gate passes and bytes decrease, otherwise revert it completely.
- Repeat until no safe candidate remains, several attempts produce no improvement, the measurement is unreliable, or the next change needs approval.
Done when
✓ The first screen downloads less data without a tested behavior or pixel changing. The same production-like measurement reports fewer downloaded bytes, existing tests pass, every representative screenshot is pixel-identical, and uncertain dependency removal remains approval-gated.
Why it works
Recording behavior and screenshots before the first change prevents a broken screen from becoming the new normal. One download change per round also makes it clear which edit saved bytes and makes a failed attempt easy to undo.
Implementation note
Measure compressed transferred bytes—the amount sent over the network—not the larger source files developers read. Screenshots protect only the states they capture, so include logged-out, logged-in, empty, error, or other relevant first screens before trusting a risky change.
More testing loops
Watch tests while you work
A passive watchdog loop that reruns your test suite every 15 minutes and surfaces failing tests with their error output.
Kill flaky tests
Run your test suite repeatedly, collect every intermittent failure, and fix or quarantine flaky tests until you get five consecutive green runs.
Make all tests pass
Implement remaining code and run tests repeatedly until the full suite passes.