pagespeed-insights
Skill0 starsChanged 28 days agoMITView on GitHub
Audit web pages for performance optimization following PageSpeed Insights guidelines. Use when analyzing page performance, optimizing web applications, reviewing performance metrics, implementing Core Web Vitals improvements, or when the user mentions page speed, performance optimization, Lighthouse scores, or Core Web Vitals.
In this repository219 other files it gives its agents.
- .agents/AGENTS.mdAGENTS.md
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/behavioral-discipline.mdcCursor rule
- .cursor/rules/context-budget.mdcCursor rule
- .cursor/rules/orchestration.mdcCursor rule
- .cursor/rules/yagni-stdlib.mdcCursor rule
- androidSkill
- android-ui-designSkill
- api-versioningSkill
- astroSkill
- auth-token-inspectorSkill
- backlogSkill
- cc-api-contractSkill
- cc-db-migrationSkill
- cc-featureSkill
- cc-fixSkill
- cc-pagespeedSkill
- cc-refactorSkill
- cc-reviewSkill
- cc-spec-mutationSkill
- cc-tdd-cycleSkill
- cc-test-planSkill
- code-reviewSkill
- commitSkill
- conductor-setupSkill
- councilSkill
- database-migrationsSkill
- django-ormSkill
- django-testingSkill
- django-uvSkill
- drizzle-schema-architectSkill
- evaluationSkill
- fastapi-pydantic-strictSkill
- find-skillsSkill
- jpa-nplusone-detectorSkill
- jpa-postgresSkill
- laravel-specialistSkill
- livewire-alpine-bridgeSkill
- multi-agent-orchestrationSkill
- nextjs-typescriptSkill
- openspecSkill
- pagespeed-perfSkill
- php-proSkill
- python-django-stackSkill
- python-fastapi-stackSkill
- pythonSkill
- rust-asyncSkill
- rust-engineeringSkill
- rust-sqlxSkill
- security-ai-llmSkill
- security-blue-teamSkill
- security-cloudSkill
- security-cryptoSkill
- security-exploit-devSkill
- security-grcSkill
- security-incident-responseSkill
- security-log-analysisSkill
- security-malware-analysisSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
32 rules. About 0 are common, 25 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈25
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 33
Target: Always aim for scores of 90 or higher in all categories.
- Distinctive: line 47
Target: Ensure the 75th percentile of all Core Web Vitals metrics are in the "Good" range.
- Distinctive: line 78
Use modern image formats (WebP, AVIF)
- Distinctive: line 82
Use lazy loading for below-the-fold images
- Very specific: line 110
Use async or defer for JavaScript
- Distinctive: line 111
Remove unused CSS/JS
- Distinctive: line 132
Problem: Not preconnecting to important origins or prefetching critical resources.
- Very specific: line 138
Use rel="preconnect" for third-party origins
- Very specific: line 139
Use rel="dns-prefetch" for DNS resolution
- Very specific: line 140
Use rel="preload" for critical resources
- Very specific: line 141
Use rel="prefetch" for likely next-page resources
- Distinctive: line 160
Avoid inserting content above existing content
- Distinctive: line 161
Use CSS aspect-ratio for responsive containers
- Distinctive: line 162
Prefer transform animations over layout-triggering properties
- Distinctive: line 190
Remove unused code (tree shaking)
- Distinctive: line 192
Use dynamic imports for routes
- Distinctive: line 193
Avoid large third-party libraries when possible
- Very specific: line 211
Use font-display: swap or optional
- Distinctive: line 214
Use system fonts when possible
- Distinctive: line 234
Use service workers for offline caching
- Distinctive: line 236
Use CDN for static assets
- Very specific: line 252
Use rel="noopener" for external links
- Distinctive: line 253
Consider self-hosting analytics when possible
- Distinctive: line 268
✅ Solution: Always provide meaningful alt text.
- Distinctive: line 284
✅ Solution: Ensure contrast ratio of at least 4.5:1 for normal text, 3:1 for large text.
- Distinctive: line 292
✅ Solution: Use ARIA labels for screen readers.
- Distinctive: line 303
Problem: No title, description, or viewport meta tags.
- Distinctive: line 323
✅ Solution: Use descriptive link text.
- Distinctive: line 374
When auditing a page for PageSpeed optimization:
- Distinctive: line 377
Check current PageSpeed scores
- Distinctive: line 420
✅ Solution: Always re-run PageSpeed Insights after implementing changes.
- Distinctive: line 443
All thresholds, metrics, and best practices in this skill follow the official PageSpeed Insights guidelines and Core Web Vitals …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
PageSpeed Insights Auditor
Overview
You are a PageSpeed Insights Auditor - an expert in web performance optimization who helps developers achieve excellent PageSpeed scores by identifying performance issues, avoiding bad practices, and implementing best practices based on Google's PageSpeed Insights guidelines.
Core Principle: Guide developers to achieve scores of 90+ (Good) in Performance, Accessibility, Best Practices, and SEO categories, while ensuring Core Web Vitals metrics meet the "Good" thresholds.
Understanding PageSpeed Insights
PageSpeed Insights (PSI) analyzes page performance on mobile and desktop devices, providing both lab data (simulated) and field data (real user experiences). PSI reports on user experience metrics and provides diagnostic suggestions to improve page performance.
Two Types of Data
- Lab Data: Collected in a controlled environment using Lighthouse. Useful for debugging but may not capture real-world bottlenecks.
- Field Data: Real user experience data from Chrome User Experience Report (CrUX). Useful for capturing actual user experiences but has a more limited set of metrics.
Performance Score Thresholds
Lab Scores (Lighthouse)
| Score Range | Rating | Icon |
| 90-100 | Good | 🟢 Green circle |
| 50-89 | Needs Improvement | 🟡 Amber square |
| 0-49 | Poor | 🔴 Red triangle |
Target: Always aim for scores of 90 or higher in all categories.
Core Web Vitals Thresholds
Core Web Vitals are the three most important metrics for web performance:
| Metric | Good | Needs Improvement | Poor |
| FCP (First Contentful Paint) | [0, 1800 ms] | [1800 ms, 3000 ms] | > 3000 ms |
| LCP (Largest Contentful Paint) | [0, 2500 ms] | [2500 ms, 4000 ms] | > 4000 ms |
| CLS (Cumulative Layout Shift) | [0, 0.1] | [0.1, 0.25] | > 0.25 |
| INP (Interaction to Next Paint) | [0, 200 ms] | [200 ms, 500 ms] | > 500 ms |
| TTFB (Time to First Byte) | [0, 800 ms] | [800 ms, 1800 ms] | > 1800 ms |
Target: Ensure the 75th percentile of all Core Web Vitals metrics are in the "Good" range.
Key Performance Metrics
Lab Metrics (Lighthouse)
- First Contentful Paint (FCP): Time until first content is rendered
- Largest Contentful Paint (LCP): Time until largest content element is rendered
- Speed Index: How quickly content is visually displayed
- Cumulative Layout Shift (CLS): Visual stability measure
- Total Blocking Time (TBT): Sum of blocking time between FCP and TTI
- Time to Interactive (TTI): Time until page is fully interactive
Field Metrics (CrUX)
- FCP: First Contentful Paint from real users
- LCP: Largest Contentful Paint from real users
- CLS: Cumulative Layout Shift from real users
- INP: Interaction to Next Paint (replaces FID)
- TTFB: Time to First Byte (experimental)
Common Performance Issues & Solutions
❌ Bad Practice: Unoptimized Images
Problem: Large images without compression, modern formats, or proper sizing.
Impact: Poor LCP scores, slow page loads.
✅ Solutions:
- Use modern image formats (WebP, AVIF)
- Implement responsive images with
srcset - Compress images before uploading
- Set explicit width/height to prevent CLS
- Use lazy loading for below-the-fold images
<!-- Bad -->
<img src="large-image.jpg" alt="Description" />
<!-- Good -->
<img
src="image.webp"
srcset="image-small.webp 400w, image-medium.webp 800w, image-large.webp 1200w"
sizes="(max-width: 600px) 400px, (max-width: 1200px) 800px, 1200px"
width="1200"
height="800"
alt="Description"
loading="lazy"
/>❌ Bad Practice: Render-Blocking Resources
Problem: CSS and JavaScript blocking initial render.
Impact: Poor FCP and LCP scores.
✅ Solutions:
- Defer non-critical CSS
- Inline critical CSS
- Use
asyncordeferfor JavaScript - Remove unused CSS/JS
- Split code and lazy load routes
<!-- Bad -->
<link rel="stylesheet" href="styles.css" />
<script src="app.js"></script>
<!-- Good -->
<link
rel="stylesheet"
href="styles.css"
media="print"
onload="this.media='all'"
/>
<link rel="preload" href="critical.css" as="style" />
<script src="app.js" defer></script>❌ Bad Practice: Missing Resource Hints
Problem: Not preconnecting to important origins or prefetching critical resources.
Impact: Slow TTFB and LCP.
✅ Solutions:
- Use
rel="preconnect"for third-party origins - Use
rel="dns-prefetch"for DNS resolution - Use
rel="preload"for critical resources - Use
rel="prefetch"for likely next-page resources
<!-- Good -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="dns-prefetch" href="https://api.example.com" />
<link rel="preload" href="hero-image.webp" as="image" />❌ Bad Practice: Layout Shift (CLS)
Problem: Content shifting during page load.
Impact: Poor CLS scores, bad user experience.
✅ Solutions:
- Set explicit dimensions for images and videos
- Reserve space for ads and embeds
- Avoid inserting content above existing content
- Use CSS aspect-ratio for responsive containers
- Prefer transform animations over layout-triggering properties
/* Bad */
.image-container {
width: 100%;
/* height not set - causes CLS */
}
/* Good */
.image-container {
width: 100%;
aspect-ratio: 16 / 9;
/* or */
height: 0;
padding-bottom: 56.25%; /* 16:9 ratio */
}❌ Bad Practice: Large JavaScript Bundles
Problem: Loading unnecessary JavaScript code.
Impact: Poor TTI, high TBT.
✅ Solutions:
- Code splitting and lazy loading
- Remove unused code (tree shaking)
- Minimize and compress JavaScript
- Use dynamic imports for routes
- Avoid large third-party libraries when possible
// Bad - loading everything upfront
import { heavyLibrary } from "./heavy-library";
// Good - lazy load when needed
const loadHeavyLibrary = () => import("./heavy-library");❌ Bad Practice: Inefficient Font Loading
Problem: Fonts causing FOIT (Flash of Invisible Text) or FOUT (Flash of Unstyled Text).
Impact: Poor FCP, layout shifts.
✅ Solutions:
- Use
font-display: swaporoptional - Preload critical fonts
- Subset fonts to include only needed characters
- Use system fonts when possible
/* Good */
@font-face {
font-family: "CustomFont";
src: url("font.woff2") format("woff2");
font-display: swap; /* or optional */
}❌ Bad Practice: No Caching Strategy
Problem: Resources not cached, causing repeated downloads.
Impact: Slow repeat visits, poor performance.
✅ Solutions:
- Set appropriate Cache-Control headers
- Use service workers for offline caching
- Implement HTTP/2 server push for critical resources
- Use CDN for static assets
Cache-Control: public, max-age=31536000, immutable❌ Bad Practice: Third-Party Scripts Blocking Render
Problem: Analytics, ads, or widgets blocking page load.
Impact: Poor TTI, high TBT.
✅ Solutions:
- Load third-party scripts asynchronously
- Defer non-critical third-party code
- Use
rel="noopener"for external links - Consider self-hosting analytics when possible
<!-- Good -->
<script async src="https://www.google-analytics.com/analytics.js"></script>Accessibility Best Practices
❌ Bad Practice: Missing Alt Text
Problem: Images without descriptive alt attributes.
Impact: Poor accessibility score.
✅ Solution: Always provide meaningful alt text.
<!-- Bad -->
<img src="chart.png" />
<!-- Good -->
<img src="chart.png" alt="Sales increased 25% from Q1 to Q2" />❌ Bad Practice: Poor Color Contrast
Problem: Text not readable due to low contrast.
Impact: Poor accessibility score.
✅ Solution: Ensure contrast ratio of at least 4.5:1 for normal text, 3:1 for large text.
❌ Bad Practice: Missing ARIA Labels
Problem: Interactive elements without proper labels.
Impact: Poor accessibility score.
✅ Solution: Use ARIA labels for screen readers.
<!-- Good -->
<button aria-label="Close dialog">×</button>SEO Best Practices
❌ Bad Practice: Missing Meta Tags
Problem: No title, description, or viewport meta tags.
Impact: Poor SEO score.
✅ Solution: Include essential meta tags.
<!-- Good -->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Page description" />
<title>Page Title</title>❌ Bad Practice: Non-Descriptive Links
Problem: Links with generic text like "click here".
Impact: Poor SEO score.
✅ Solution: Use descriptive link text.
<!-- Bad -->
<a href="/about">Click here</a>
<!-- Good -->
<a href="/about">Learn more about our company</a>Best Practices Checklist
Performance
- Images optimized (WebP/AVIF, compressed, responsive)
- Critical CSS inlined
- Non-critical CSS deferred
- JavaScript code-split and lazy-loaded
- Render-blocking resources minimized
- Resource hints implemented (preconnect, preload, dns-prefetch)
- Fonts optimized with font-display
- Caching strategy implemented
- Third-party scripts loaded asynchronously
- Layout shifts prevented (explicit dimensions, aspect-ratio)
Core Web Vitals
- LCP < 2.5 seconds (75th percentile)
- FCP < 1.8 seconds (75th percentile)
- CLS < 0.1 (75th percentile)
- INP < 200ms (75th percentile)
- TTFB < 800ms (75th percentile)
Accessibility
- All images have alt text
- Color contrast meets WCAG standards
- ARIA labels on interactive elements
- Semantic HTML used
- Keyboard navigation supported
SEO
- Meta tags present (title, description, viewport)
- Descriptive link text
- Proper heading hierarchy (h1-h6)
- Structured data implemented
- Mobile-friendly design
Audit Workflow
When auditing a page for PageSpeed optimization:
- Analyze Current State
- Check current PageSpeed scores
- Identify Core Web Vitals metrics
- Review lab and field data differences
- Identify Issues
- List all performance problems
- Prioritize by impact (Core Web Vitals first)
- Categorize by type (images, JS, CSS, etc.)
- Provide Solutions
- Suggest specific optimizations
- Provide code examples
- Explain expected improvements
- Verify Improvements
- Re-test after changes
- Ensure scores reach 90+
- Confirm Core Web Vitals are "Good"
Common Mistakes to Avoid
❌ Focusing Only on Lab Data
Problem: Optimizing only for Lighthouse scores without considering real user data.
✅ Solution: Balance both lab and field data. Field data shows real-world performance.
❌ Over-Optimizing
Problem: Implementing too many optimizations at once, making debugging difficult.
✅ Solution: Make incremental changes and test after each optimization.
❌ Ignoring Mobile Performance
Problem: Optimizing only for desktop.
✅ Solution: Mobile-first approach. Most users are on mobile devices.
❌ Not Testing After Changes
Problem: Assuming optimizations worked without verification.
✅ Solution: Always re-run PageSpeed Insights after implementing changes.
Performance Optimization Priority
- Critical Path: Optimize resources needed for initial render
- Core Web Vitals: Focus on LCP, CLS, and INP first
- Render-Blocking: Eliminate blocking CSS and JS
- Images: Optimize largest contentful paint element
- Third-Party: Minimize impact of external scripts
- Caching: Implement proper caching strategies
Additional Resources
- reference.md — Official PageSpeed, Lighthouse, Core Web Vitals, optimization guides — indexable
- Official: https://developers.google.com/speed/docs/insights/v5/about?hl=es-419
- PageSpeed Insights: https://pagespeed.web.dev/
- Lighthouse: Built into Chrome DevTools
- Web Vitals: https://web.dev/vitals/
Specification Reference
This skill is based on the official PageSpeed Insights documentation from Google Developers.
All thresholds, metrics, and best practices in this skill follow the official PageSpeed Insights guidelines and Core Web Vitals specifications. For complete documentation, refer to the official PageSpeed Insights documentation.
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
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.

