Web Performance Tuning

VerifiedSafe

Optimizes Core Web Vitals (LCP, INP, CLS), bundle size, rendering strategy, image and font loading, caching, and database query performance. Use when optimizing performance, reducing load time, fixing slow pages, or analyzing bundle size in Next.js, Vite, React, and Python backends.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude Code
#performance-tuning#core-web-vitals#bundle-analysis#image-optimization

Recommended for

Automated summary

This skill optimizes web application performance by measuring Core Web Vitals, analyzing bundle sizes, optimizing images and fonts, and adjusting rendering strategies.

Strengths

  • Step-by-step guide with actionable commands
  • Comprehensive coverage of LCP, INP, and CLS metrics
  • Analysis tools to identify bottlenecks

Limitations

  • Requires command-line access to run audits
  • Does not cover advanced server-side optimizations (CDN caching, scaling)
  • Recommendations are generic; project-specific tweaks may be needed
When to use it

Use this skill when you need to improve performance of a Next.js, Vite, React, or Python backend application, or when the user mentions 'slow', 'Lighthouse', or 'Web Vitals'.

When not to use it

Avoid this skill if the issue is related to network infrastructure or server without accessible application code.

Security analysis

Safe
Quality score85/100

The skill only contains diagnostic and analysis commands (npx lighthouse, grep, find, ls) for performance auditing. No destructive, exfiltrating, or obfuscated actions are present.

No concerns found

How this analysis is made

Examples

Bundle size analysis
Analyze the bundle size of my Next.js app and suggest optimizations for large dependencies.
Optimize Core Web Vitals
Optimize the Core Web Vitals (LCP, INP, CLS) for my landing page. Suggest actionable steps.
Image optimization check
Check image sizes in my project and recommend optimizations, format changes, and lazy loading strategies.

name: performance-tuning description: > Optimizes Core Web Vitals (LCP, INP, CLS), bundle size, rendering strategy, image and font loading, caching, and database query performance for Next.js, Vite, React, and Python backends. Use when optimizing performance, reducing load time, fixing slow pages, analyzing bundle size, or when user mentions performance, speed, Lighthouse, or Web Vitals.

Performance Tuning

Fast apps win. Performance is UX. Performance is SEO. Performance is conversion. Slow kills.


Phase 1: Core Web Vitals Measurement

Targets (2026)

| Metric | Good | Needs Work | Poor | |--------|------|------------|------| | LCP (Largest Contentful Paint) | < 2.5s | 2.5-4s | > 4s | | INP (Interaction to Next Paint) | < 200ms | 200-500ms | > 500ms | | CLS (Cumulative Layout Shift) | < 0.1 | 0.1-0.25 | > 0.25 |

Run:

# Lighthouse audit (local)
npx lighthouse http://localhost:3000 --output json --output-path report.json 2>/dev/null

# Or in Chrome: DevTools → Lighthouse → Analyze page load

Phase 2: Bundle Size Analysis

Run:

# Next.js bundle analysis
ANALYZE=true npm run build 2>/dev/null

# Vite bundle analysis
npx vite-bundle-visualizer 2>/dev/null

# Check largest JS chunks
ls -lhS .next/static/chunks/*.js 2>/dev/null | head -10
ls -lhS dist/assets/*.js 2>/dev/null | head -10

# Find largest dependencies
npx cost-of-modules 2>/dev/null | head -20

# Unused dependencies
npx depcheck 2>/dev/null | head -20

Bundle Size Targets

| Category | Target | Action if Over | |----------|--------|---------------| | Total JS | < 200KB gzip | Code split aggressively | | First Load | < 100KB gzip | Defer non-critical | | Largest chunk | < 50KB gzip | Dynamic import |

Common Bloat Sources

| Dependency | Size | Alternative | |-----------|------|-------------| | moment.js | 300KB | date-fns or dayjs (2KB) | | lodash (full) | 72KB | lodash-es or native JS | | chart.js | 200KB | Import only needed modules | | three.js | 600KB | Import only: import { Scene } from 'three' |

Run to detect:

# Tree shaking violations
grep -rn "import .* from 'lodash'" src/ --include="*.ts" --include="*.tsx" 2>/dev/null
grep -rn "require('lodash')" src/ --include="*.ts" --include="*.js" 2>/dev/null

Phase 3: Image & Font Optimization

Run:

# Find large images
find src/ public/ -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" 2>/dev/null | xargs ls -lhS 2>/dev/null | head -20

# Check for next/image usage
grep -rn "next/image\|Image" src/ --include="*.tsx" 2>/dev/null | wc -l

# Check for lazy loading
grep -rn "loading=\"lazy\"\|loading=\"eager\"" src/ --include="*.tsx" 2>/dev/null | wc -l

# Check font loading
grep -rn "next/font\|@font-face\|font-display" src/ app/ --include="*.tsx" --include="*.css" 2>/dev/null

Image Targets

| Image Type | Max Size | Format | Loading | |-----------|----------|--------|---------| | Hero/banner | 200KB | WebP/AVIF | eager, fetchpriority="high" | | Card thumbnails | 50KB | WebP | lazy | | Icons | 5KB | SVG (inline) | Inline | | Backgrounds | 100KB | WebP | CSS lazy |

Flag if: images > 200KB, no next/image usage, no font-display: swap.


Phase 4: Rendering Strategy

Decision Tree

| Page Type | Strategy | Why | |-----------|----------|-----| | Marketing/Landing | SSG + ISR | Fast, cacheable, SEO | | Blog/Content | SSG with on-demand ISR | Changes, needs SEO | | Dashboard | CSR or Streaming SSR | Personalized, real-time | | E-commerce Product | ISR (1-60 sec) | Changes often, SEO matters | | Search Results | Server Components | Dynamic, personalized |

Run:

# Check rendering strategy in Next.js
grep -rn "export const dynamic\|export const revalidate\|getStaticProps\|getServerSideProps" app/ src/ --include="*.ts" --include="*.tsx" 2>/dev/null

# Check for code splitting
grep -rn "React.lazy\|dynamic(\|lazy(" src/ --include="*.tsx" --include="*.ts" 2>/dev/null | wc -l

Flag if: no dynamic imports for heavy components, all pages use the same rendering strategy.


Phase 5: Database Query Performance

Run:

# N+1 query patterns (ORM)
grep -rn "findMany\|findAll\|\.all()" src/ lib/ --include="*.ts" --include="*.py" 2>/dev/null
grep -rn "include:\|select:\|prefetch_related\|select_related" src/ lib/ --include="*.ts" --include="*.py" 2>/dev/null

# Missing pagination
grep -rn "take\|limit\|offset\|skip\|paginate\|LIMIT" src/ lib/ --include="*.ts" --include="*.py" 2>/dev/null | wc -l

Flag if: findMany/findAll without include (N+1), no pagination on list queries.


Phase 6: Caching Strategy

Run:

# Check for caching headers
grep -rn "Cache-Control\|s-maxage\|stale-while-revalidate\|unstable_cache" src/ app/ --include="*.ts" --include="*.tsx" 2>/dev/null

# Check for ISR configuration
grep -rn "revalidate" app/ --include="*.ts" --include="*.tsx" 2>/dev/null

Flag if: no caching on static assets, no ISR for dynamic content, no API response caching.


⛔ STOP GATE — Performance

DO NOT mark performance as optimized without:

  1. Running Lighthouse or equivalent measurement
  2. Showing bundle size analysis results
  3. Confirming Core Web Vitals meet "Good" thresholds

Output Format

## Performance Report — [Project Name]

### Current State
| Metric | Score | Target | Gap |
|--------|-------|--------|-----|
| LCP | Xs | < 2.5s | Xs |
| INP | Xms | < 200ms | Xms |
| CLS | X | < 0.1 | X |
| Bundle Size | XKB | < 200KB | XKB |

### Issues Found (Priority Order)
1. 🔴 [Critical — directly impacts user experience]
2. 🟡 [Medium — impacts at scale]
3. 🟢 [Nice to have]

### Optimization Plan
1. [Fix 1] — Expected impact: X
2. [Fix 2] — Expected impact: X

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/web-performance-tuning-mmk3nhdx/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/web-performance-tuning-mmk3nhdx' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/web-performance-tuning-mmk3nhdx/download' --output '.skill-downloads/web-performance-tuning-mmk3nhdx/SKILL.md.part' && mv '.skill-downloads/web-performance-tuning-mmk3nhdx/SKILL.md.part' '.skill-downloads/web-performance-tuning-mmk3nhdx/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/web-performance-tuning-mmk3nhdx/SKILL.md' && test -s '.skill-downloads/web-performance-tuning-mmk3nhdx/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/performance-tuning' && cp -R '.skill-downloads/web-performance-tuning-mmk3nhdx' '.claude/skills/performance-tuning'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/web-performance-tuning-mmk3nhdx'

openskills read 'web-performance-tuning-mmk3nhdx'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/web-performance-tuning-mmk3nhdx/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills