agentleFS
sadrmaneshsadrmanesh/commerce-agent-skills/skills/storefront-performance/SKILL.md

storefront-performance

Skill1 starsChanged 18 days agoMITView on GitHub

Improve storefront Core Web Vitals (LCP, INP, CLS) using field data at the 75th percentile, image and font loading, caching of catalog pages, and lighter third-party scripts. Use when product or category pages feel slow, Web Vitals fail, or a theme, app, or script change needs a performance check.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every template's p75 LCP, INP, and CLS is classified, mobile and desktop separately.

    line 52
  2. Distinctive:

    After changes, field data at p75 improves over the next 28 days without a drop in conversion.

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “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

Storefront performance

Judge speed by what real shoppers get, not one lab run. Core Web Vitals are measured at the 75th percentile of page loads, split by mobile and desktop. Thresholds and causes are in the Web Vitals notes.

MetricGoodPoor
LCP, Largest Contentful Paint2500 ms or lessover 4000 ms
INP, Interaction to Next Paint200 ms or lessover 500 ms
CLS, Cumulative Layout Shift0.1 or lessover 0.25

INP replaced First Input Delay as a Core Web Vital in March 2024.

Procedure

  1. Get field data per template (home, category, product, cart, checkout) from the Chrome UX Report, Search Console, or your own real-user monitoring with the web-vitals library. Lab tools explain causes but do not decide pass or fail.
  2. Classify the p75 values: node scripts/check-web-vitals.mjs vitals.json prints good, needs improvement, or poor for each template.
  3. Fix the worst metric on the highest-traffic template first.
  4. LCP: the LCP element on a product page is usually the main product image. Serve it in a modern format at the displayed size, do not lazy-load it, give it fetchpriority="high", and cut server response time with full-page caching for anonymous shoppers.
  5. INP: break up long JavaScript tasks, defer third-party tags, and make variation pickers and add-to-cart update the UI before network work finishes.
  6. CLS: set width and height (or aspect-ratio) on images, reserve space for banners, reviews widgets, and price blocks, and avoid inserting content above what the shopper is reading.
  7. Recheck field data after 28 days, the window the Chrome UX Report uses.

Caching a store

Cache category and product pages for shoppers without a session. Bypass the cache for cart, checkout, account pages, and requests carrying cart or session cookies. Load the mini-cart count with a small request instead of disabling the page cache. Purge a product's page when its price or stock changes.

Third-party scripts

Chat widgets, review apps, A/B testing, and tag managers often cost more than the theme. List every script with its owner and purpose, remove unused ones, and load the rest after the page is interactive. A/B testing scripts that hide the page while loading hurt LCP directly.

Gotchas

  • loading="lazy" on the main product image delays LCP.
  • A cookie banner or promo bar inserted at the top shifts the whole page and adds CLS.
  • Web fonts without font-display: swap or a matching fallback can hide text or shift it.
  • Caching pages for logged-in shoppers can show one shopper's cart to another.
  • A good Lighthouse score on a desktop connection says little about mobile p75 field data.
  • Large carousels that load every slide image at once compete with the LCP image.

Verification

  • Every template's p75 LCP, INP, and CLS is classified, mobile and desktop separately.
  • The LCP image is not lazy-loaded and is requested early.
  • Cart and checkout are never served from a shared page cache.
  • After changes, field data at p75 improves over the next 28 days without a drop in conversion.

Evaluation

Worked examples and the checks they must satisfy are in evals/tasks.json.

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.