Skip to main content

Claude Prompt to Run a Frontend Performance Audit

Run a frontend performance audit targeting Core Web Vitals with actionable fixes for bundle size, lazy loading, code splitting, rendering and network.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt
Perform a comprehensive frontend performance audit for a Next.js e-commerce storefront with 500+ product pages.

**Current tech stack:**
- Framework: Next.js 14 (App Router)
- Bundler: Turbopack (dev) / Webpack 5 (prod)
- Hosting/CDN: Vercel with Edge Network
- Current Lighthouse score: 62 on mobile, 84 on desktop
- Biggest known pain point: product listing page takes 4s to become interactive on 4G

**Audit the following areas and provide specific, actionable fixes:**

1. **Core Web Vitals Analysis:**
   - **LCP (Largest Contentful Paint):** Identify the LCP element, optimize critical rendering path, preload key resources, implement `fetchpriority="high"` on hero images
   - **INP (Interaction to Next Paint):** Find long tasks (>50ms), break up event handlers with `scheduler.yield()`, debounce/throttle input handlers, move computation to Web Workers
   - **CLS (Cumulative Layout Shift):** Audit layout shifts with explicit `width`/`height` on media, skeleton screens, font `size-adjust` for FOIT/FOUT prevention

2. **Bundle Analysis & Code Splitting:**
   - Analyze the dependency tree — identify the 10 heaviest dependencies
   - Route-based code splitting with dynamic `import()`
   - Component-level lazy loading with `React.lazy`/`defineAsyncComponent`/equivalent
   - Replace heavy libraries with lighter alternatives (provide a substitution table)
   - Tree-shaking verification — detect side-effect-ful imports preventing dead code elimination

3. **Asset Optimization:**
   - Image format strategy: WebP/AVIF with `<picture>` fallbacks
   - Responsive images with `srcset` and `sizes` attributes
   - Font subsetting and `font-display: swap` with preload
   - SVG optimization (SVGO config) and inline vs. sprite sheet decision
   - CSS purging configuration and critical CSS extraction

4. **Network & Caching Strategy:**
   - Resource hints: `preconnect`, `dns-prefetch`, `preload`, `prefetch` recommendations
   - Service Worker caching strategy (stale-while-revalidate for assets, network-first for API)
   - HTTP/2 or HTTP/3 multiplexing considerations
   - CDN cache headers (`Cache-Control`, `ETag`, `Vary`) recommendations
   - API response caching with `stale-while-revalidate` pattern

5. **Rendering Performance:**
   - Virtual scrolling for long lists (>100 items)
   - `content-visibility: auto` for below-fold sections
   - `will-change` and `transform` for animation performance
   - `requestAnimationFrame` for visual updates, `requestIdleCallback` for background tasks
   - React: memo/useMemo/useCallback audit (or framework equivalent)

6. **Monitoring & Budgets:**
   - Performance budget configuration for Turbopack (dev) / Webpack 5 (prod): max JS 150KB gzipped, max CSS 30KB gzipped
   - Real User Monitoring (RUM) setup with `web-vitals` library
   - CI integration: Lighthouse CI GitHub Action with threshold gates
   - Bundle size tracking with `bundlesize` or `size-limit`

Output a prioritized action plan sorted by impact (high/medium/low) with estimated performance gain for each fix.

What this prompt does

This prompt runs a comprehensive frontend performance audit for the app you describe and returns a prioritized, actionable fix list. You provide [app_description], [framework], [bundler], [hosting], your [current_score], and the [pain_point] that bothers you most, and it audits Core Web Vitals, bundle size, assets, network/caching, rendering, and monitoring.

The structure works because "make it faster" is useless — real performance work is a sequence of specific, measurable fixes. The prompt splits the audit into LCP, INP, and CLS, then into bundle, asset, and caching layers, mirroring how Core Web Vitals are actually chased. It analyzes your [top_n_deps] heaviest dependencies, recommends code-splitting and lighter library substitutions, and enforces a performance budget using your [js_budget] and [css_budget]. Critically, it sorts every fix by impact so you know what to ship first.

When to use it

  • An app feels sluggish and you need a prioritized plan instead of scattered tips.
  • Your Lighthouse or Core Web Vitals scores are dropping and you need to find the cause.
  • A specific [pain_point] — like a slow product page on 4G — is hurting conversions.
  • Your bundle has grown and you need to find and replace the [top_n_deps] heaviest dependencies.
  • You're setting performance budgets ([js_budget], [css_budget]) and want CI gates to enforce them.
  • You need to brief a team on what to fix first, ranked by expected performance gain.

Example output

You get an audit broken into the same areas you'd work through manually: a Core Web Vitals section with concrete LCP, INP, and CLS fixes (preloading, scheduler.yield(), explicit media dimensions); a bundle analysis naming your [top_n_deps] heaviest packages with a substitution table; asset, network, and rendering recommendations; a monitoring section with budgets and Lighthouse CI gates; and a final prioritized action plan sorted high/medium/low impact with an estimated gain per fix.

Pro tips

  • Name your real [framework] and [bundler]; the code-splitting and tree-shaking advice is specific to them.
  • Put your actual [current_score] (mobile and desktop) so the model knows how far you have to climb.
  • Make [pain_point] concrete — a named slow page beats "it's slow" and focuses the whole audit.
  • Set [top_n_deps] based on how deep you want the dependency analysis to go.
  • Use [js_budget] and [css_budget] as real targets so the monitoring and CI section produces enforceable gates.
  • Work the prioritized plan top-down; ship the high-impact fixes first and re-measure before tackling the rest.

Frequently Asked Questions

Does it cover INP, or just the older FID metric?
It covers INP (Interaction to Next Paint), the current Core Web Vital that replaced FID. The audit looks for long tasks over 50ms, recommends breaking up event handlers with `scheduler.yield()`, debouncing inputs, and moving heavy computation to Web Workers.
Will it actually measure my site or just give advice?
It does not crawl or measure your live site — it reasons from the details you provide, like `[current_score]` and `[pain_point]`. Pair it with real Lighthouse and field data; the prompt turns those numbers into a prioritized, framework-specific fix plan.
Can it recommend lighter alternatives to heavy libraries?
Yes. It analyzes your `[top_n_deps]` heaviest dependencies and provides a substitution table suggesting lighter replacements, along with tree-shaking checks to catch side-effectful imports that block dead-code elimination. Validate each swap against your feature needs.
Does it help set up performance budgets in CI?
It generates a performance-budget configuration for your `[bundler]` using your `[js_budget]` and `[css_budget]`, plus a Lighthouse CI GitHub Action with threshold gates and bundle-size tracking, so regressions get caught on pull requests rather than in production.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Frontend Development Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

AI assistant · trained on my work

👋

Hey there!

Quick Actions

WhatsApp Direct line to me

Chat on WhatsApp

+880 1723 741224 · Replies within the hour on working days

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

mejba.13@gmail.com

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support