Index of every page on this site: llms.txt
All skills
kiln-skills avatar

/web-performance

@555d7ea
Run it yourself

Diagnose and fix website speed — Core Web Vitals (LCP, INP, CLS), bundle size, images, fonts, caching, and rendering strategy — for Next.js, React/Vite, Vue/Nuxt, Astro, and static sites. Use whenever the user says the site is slow, "website lemot", wants a better Lighthouse/PageSpeed score, mentions Core Web Vitals, large bundles, or is preparing a site for launch.

Use this Skill: https://skilld.dev/gh/kiln-skills/kiln/web-performance

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈97 tokens for metadata: the name and description. ≈711 when used: this file.

Description uses 4.8% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈386 characters, or 4.8%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Web Performance

Measure → fix the biggest bottleneck → measure again. Never optimize blind.

1. Measure

  • Production build only (npm run build && npm run start / preview). Dev mode numbers are meaningless.
  • Lighthouse (mobile preset): npx lighthouse <url> --preset=perf --form-factor=mobile --output=json --output-path=./lh.json --chrome-flags="--headless" if Chrome is available; otherwise ask the user to run PageSpeed Insights and paste the result.
  • Bundle: npx vite-bundle-visualizer, ANALYZE=true with @next/bundle-analyzer, or npx source-map-explorer 'dist/**/*.js'.
  • Note the baseline: LCP, INP/TBT, CLS, total JS (gzipped), page weight.

Targets: LCP < 2.5s, INP < 200ms, CLS < 0.1, initial JS < ~170KB gzipped for content sites.

2. Fix by metric

LCP (largest content slow)

  • Find the LCP element (usually hero image or heading).
  • Hero image: modern format (AVIF/WebP), correct size, fetchpriority="high", NOT loading="lazy". Next.js: <Image priority />.
  • Remove render-blocking CSS/JS in <head>; inline critical CSS if needed.
  • Server: use SSG/ISR or cache HTML for pages that don't need per-request data; check TTFB.
  • preconnect to required third-party origins (fonts CDN, API).

CLS (layout jumps)

  • width/height or aspect-ratio on every image, video, iframe, ad slot.
  • Fonts: font-display: swap + size-adjusted fallback (next/font does this), or optional.
  • Don't insert banners/content above existing content after load; reserve space.

INP (slow interactions)

  • Find long tasks (> 50ms). Break up heavy handlers; defer non-urgent work (requestIdleCallback, startTransition).
  • Avoid re-rendering huge lists — virtualize (@tanstack/react-virtual), memoize expensive children.
  • Third-party scripts (chat widgets, analytics, tag managers): load afterInteractive/lazyOnload, or on user intent.

Bundle size

  • Dynamic import heavy, below-the-fold or route-specific code (next/dynamic, React.lazy, defineAsyncComponent).
  • Replace heavy deps: moment → date-fns/dayjs, lodash → native or lodash-es per-function imports, full icon packs → individual imports.
  • Next.js App Router: keep "use client" as low in the tree as possible; data fetching in server components.
  • Remove unused dependencies (npx depcheck).

Assets & caching

  • Images: responsive srcset/sizes; lazy-load below the fold.
  • Fonts: self-host, subset, WOFF2, preload only the 1–2 used above the fold.
  • Static assets: hashed filenames + Cache-Control: public, max-age=31536000, immutable. HTML: short cache or revalidate.
  • Compression (Brotli/gzip) on the server/CDN.

3. Re-measure and report

Show a before/after table of the same metrics. List remaining opportunities ranked by expected impact vs effort. Don't claim gains you didn't measure.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts15d3 checks · Risk SAFE
  • Gen Agent Trust Hub15d

    The skill provides a comprehensive and safe framework for diagnosing and optimizing web performance using industry-standard tools and best practices.

  • Socket15d

    No alerts

  • Snyk15d

    Risk: LOW · No issues

Signed by skilld at 555d7ea. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 2 weeks ago

README badge

README badge for kiln-skills/kiln/web-performance