web-performance

Optimize web applications for Core Web Vitals with JavaScript code-splitting and caching strategies.

364|53|Updated May 9, 2026
One-click install
npx skills add https://github.com/cosmicstack-labs/mercury-agent-skills --skill web-performance-cosmicstack-labs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: web-performance
Source: https://github.com/cosmicstack-labs/mercury-agent-skills/tree/main/categories/frontend/web-performance
Command: npx skills add https://github.com/cosmicstack-labs/mercury-agent-skills --skill web-performance-cosmicstack-labs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you systematically improve slow page loads, janky user experiences, and unstable layouts by targeting the metrics that matter for real visitors.

Core Features & Use Cases

  • Core Web Vitals Optimization: Drive LCP, INP, CLS, and related responsiveness goals with measurable targets (including LCP < 2.5s, INP < 200ms, CLS < 0.1).
  • Performance Tactics Across the Stack: Apply JavaScript code-splitting and bundle analysis, optimize images for responsive delivery, and set caching strategies (e.g., cache-first for static assets and network-first for APIs).
  • Production-Ready Monitoring Mindset: Reduce regressions by setting performance budgets and validating changes with Lighthouse, WebPageTest, and RUM.
  • Use Case: Improve a Next.js storefront where hero images delay rendering and client-side scripts block interaction, resulting in poor Lighthouse and Core Web Vitals scores.

Quick Start

Ask an agent to optimize your Next.js web app for Core Web Vitals and provide a step-by-step plan that includes JS splitting, image optimization, caching strategy, and performance budget checks.

Frequently Asked Questions about web-performance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize Core Web Vitals for a Next.js storefront?

To optimize Core Web Vitals for a Next.js storefront, you must improve LCP, INP, and CLS scores by applying JavaScript code-splitting, responsive image delivery, and targeted caching strategies to reduce render-blocking and layout shifts.

What's the best way to improve LCP when hero images delay page rendering?

The best way to improve LCP delayed by hero images is to implement responsive image delivery using Next.js Image components, ensuring properly sized assets load rapidly without blocking the initial render of your web application.

How does JavaScript code splitting reduce client-side interaction delays?

JavaScript code splitting reduces interaction delays by using dynamic imports to break large bundles into smaller chunks, minimizing the main-thread blocking that impacts INP and overall web performance responsiveness.

How do I prevent web performance regressions in CI pipelines?

Prevent web performance regressions in CI pipelines by enforcing strict performance budgets and validating code changes against measurable Lighthouse, WebPageTest, and Real User Monitoring (RUM) benchmarks before deployment.

What caching strategy should I use for static assets and API requests?

Use a cache-first strategy for static assets to serve them instantly from local storage, and a network-first caching strategy for API requests to ensure users receive fresh data while maintaining web performance.

What are the measurable targets for Core Web Vitals optimization?

Measurable targets for Core Web Vitals optimization require achieving an LCP under 2.5 seconds, an INP under 200 milliseconds, and a CLS score below 0.1 to ensure a smooth, stable user experience.