agentleFS
nathanchasenathanchase/claude-code-starter/.claude/skills/performance-audit/SKILL.md

performance-audit

Skill1 starsChanged 5 months agoMITView on GitHub

Audit Core Web Vitals (LCP, INP, CLS) with deep DOM-element attribution and actionable fix recommendations, using Chrome DevTools MCP. Runs against a local dev server or a production URL.

23 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use accessibility-audit, incident-response and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • GitHubSkill

    accessibility-audit

    Audits actual components and routes against applicable WCAG 2.2 A/AA criteria using consumer-owned design-system evidence and repository tools. Use when asked for an accessibility audit, a11y check, keyboard or focus review, contrast check, or screen-reader verification.

    Also in 4 projects that use this

  • AnthropicSkill

    incident-response

    Run an incident response workflow — triage, communicate, and write postmortem. Trigger with "we have an incident", "production is down", an alert that needs severity assessment, a status update mid-incident, or when writing a blameless postmortem after resolution.

    Also in 4 projects that use this

  • CloudflareSkill

    security-audit

    Security guidance and vulnerability review for codebases, APIs, services, CLI tools, libraries, and daemons. Use for security questions, focused reviews, vulnerability research, security audits, or pen tests. Run the complete workflow only for explicit codebase audit or pen-test requests, full/comprehensive/end-to-end reviews, or requested report artifacts.

    Also in 9 projects that use this

  • AnthropicSkill

    threat-model

    Claude Security plugin: create or update a repository's threat model, or check the findings of a report that this plugin wrote against how the system is deployed.

    Also in 3 projects that use this

  • SentrySkill

    write-tests

    Write tests following project conventions. Use when adding new tests or modifying existing ones.

    Also in 3 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 2 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 20 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Add CSS contain: content or contain: layout to heavy components

    line 110
  2. Very specific:

    Add explicit width/height to images and media elements

    line 111
  3. Very specific:

    Add loading="lazy" to below-the-fold images

    line 112
  4. Very specific:

    Add fetchpriority="high" to the LCP image (and never lazy-load it)

    line 113
  5. Very specific:

    Use content-visibility: auto for off-screen sections

    line 114
  6. Distinctive:

    Remove or restructure DOM elements

    line 120
  7. Distinctive:

    If a fix requires visual or structural changes, present the proposed change and ask for confirmation before implementing.

    line 124

“Common” is measured: kept by at least 6 in 10 of the 20 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Performance Audit

Measure Core Web Vitals (LCP, INP, CLS) for a page and attribute each problem to a specific DOM element, then recommend targeted fixes. This skill is tool-driven — it uses Chrome DevTools MCP and playwright-cli, so it works in any web project without a bespoke script.

Project setup: point the audit at your app. Local dev servers vary by project (npm run dev, vite, next dev, etc.) and by port — detect the running server (lsof -ti:<port>) or start your project's dev command. For production, pass the real URL.

Invocation

  • /performance-audit http://localhost:3000/ — Audit a local page
  • /performance-audit https://example.com/about — Audit a production page
  • /performance-audit <url> --fix — Audit, then produce a fix plan (hand to /ship or implement directly)

Prerequisites

  • The target page is reachable (dev server running, or a public production URL)
  • Chrome DevTools MCP available: ToolSearch("chrome-devtools")
  • Optionally playwright-cli for scripted navigation/screenshots

Instructions

Step 1: Verify the Target

# For a local audit, confirm the dev server is up (substitute your port)
lsof -ti:3000 || echo "start your project's dev server first"

Step 2: Trace with Chrome DevTools MCP

# Load the tools
ToolSearch("chrome-devtools performance")

# Start a trace, navigate, wait for load, then stop + analyze
mcp__chrome-devtools__performance_start_trace
mcp__chrome-devtools__navigate_page(url: "<target-url>")
mcp__chrome-devtools__wait_for(selector: "body", timeout: 10000)
mcp__chrome-devtools__performance_stop_trace
mcp__chrome-devtools__performance_analyze_insight

Emulate a representative mobile device to catch the worst real-user case:

mcp__chrome-devtools__emulate(
  device: "iPhone 15",
  width: 393,
  height: 852,
  deviceScaleFactor: 3,
  mobile: true
)

Step 3: Attribute Each Metric to an Element

Inject PerformanceObserver to identify the exact LCP element and CLS sources:

# LCP element
mcp__chrome-devtools__evaluate_script(expression: "
  new PerformanceObserver(list => {
    const entries = list.getEntries();
    const last = entries[entries.length - 1];
    console.log('LCP:', last.startTime, last.element?.tagName, last.element?.src || '');
  }).observe({ type: 'largest-contentful-paint', buffered: true });
")

# CLS sources
mcp__chrome-devtools__evaluate_script(expression: "
  new PerformanceObserver(list => {
    for (const entry of list.getEntries()) {
      if (entry.hadRecentInput) continue;
      for (const source of entry.sources || []) {
        console.log('CLS source:', source.node?.tagName, source.previousRect, source.currentRect);
      }
    }
  }).observe({ type: 'layout-shift', buffered: true });
")

For INP, simulate real interactions (mcp__chrome-devtools__click) after load, then read the interaction timing — pages with no interactive elements report no INP.

Step 4: Score Against Thresholds

MetricGoodNeeds ImprovementPoor
LCP≤ 2500ms≤ 4000ms> 4000ms
INP≤ 200ms≤ 500ms> 500ms
CLS≤ 0.1≤ 0.25> 0.25

Step 5: Report

Produce a scorecard with, for each page/device:

  • Good / Needs Improvement / Poor rating per metric
  • The LCP element (selector) and why it's slow
  • The CLS sources (which elements shifted)
  • Long tasks / blocking scripts observed in the trace
  • A prioritized Top Issues list with concrete fixes

Fixing Issues — Guardrails

DO:

  • Add CSS contain: content or contain: layout to heavy components
  • Add explicit width/height to images and media elements
  • Add loading="lazy" to below-the-fold images
  • Add fetchpriority="high" to the LCP image (and never lazy-load it)
  • Use content-visibility: auto for off-screen sections
  • Optimize font loading with font-display: swap
  • Break up long JavaScript tasks

DO NOT (without user confirmation):

  • Change visual appearance or layout
  • Remove or restructure DOM elements
  • Modify content or text
  • Change component architecture or remove functionality

If a fix requires visual or structural changes, present the proposed change and ask for confirmation before implementing.

Testing Modes

  • Initial load (SSR / full reload): clear cache, hard-navigate. Measures server render, first paint, hydration-induced shifts.
  • Client-side navigation: navigate within the app (via a link/router) rather than reloading. Measures route-transition rendering and post-navigation shifts. Use whichever navigation primitive your framework provides.

Field Data (Production)

Lab data (this skill) tells you which elements cause issues; field data tells you what real users actually experience. For production field data, use a real-user source such as Google CrUX / PageSpeed Insights (psi API v5) or your CDN's RUM. Field data only exists for publicly reachable pages — auth-gated pages are lab-audit-only.

Workflow: field data finds what's slow in production → this skill diagnoses and fixes it locally → re-check field data after deploy.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.