agentleFS
HayoDevHayoDev/safari-devtools-mcp/skills/performance-debugging/SKILL.md

performance-debugging

Skill2 starsChanged 8 months agoMITView on GitHub

Use this skill when investigating slow page loads, rendering issues, or optimizing Core Web Vitals in Safari. Use evaluate_script to capture key metrics from the browser: Common causes of slow LCP: Common causes of CLS: - Safari uses WebKit's rendering engine which handles compositing differently from Blink — will-change and transform: translateZ(0)

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. iuliandita/skills★ 7same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository3 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when investigating slow page loads, rendering issues, or optimizing Core Web Vitals in Safari.

    line 3
  2. Very specific:

    Use evaluate_script to capture key metrics from the browser:

    line 8
  3. Distinctive:

    Check for render-blocking resources:

    line 153
  4. Distinctive:

    Check for console errors that might block rendering:

    line 159
  5. Distinctive:

    If LCP is slow, identify the LCP element and check its source in the network log.

    line 171

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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.

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

Performance Debugging with Safari DevTools MCP

Use this skill when investigating slow page loads, rendering issues, or optimizing Core Web Vitals in Safari.

Collect performance metrics

Use evaluate_script to capture key metrics from the browser:

Navigation Timing (TTFB, DOM load, full page load)

evaluate_script function="() => {
  const nav = performance.getEntriesByType('navigation')[0];
  if (!nav) return { error: 'No navigation entry found' };
  return {
    url: nav.name,
    redirectTime: Math.round(nav.redirectEnd - nav.redirectStart),
    dnsLookup: Math.round(nav.domainLookupEnd - nav.domainLookupStart),
    tcpConnect: Math.round(nav.connectEnd - nav.connectStart),
    ttfb: Math.round(nav.responseStart - nav.requestStart),
    responseTime: Math.round(nav.responseEnd - nav.responseStart),
    domInteractive: Math.round(nav.domInteractive),
    domContentLoaded: Math.round(nav.domContentLoadedEventEnd),
    fullLoad: Math.round(nav.loadEventEnd),
    transferSize: nav.transferSize,
    encodedBodySize: nav.encodedBodySize,
    decodedBodySize: nav.decodedBodySize
  };
}"

Core Web Vitals (LCP, CLS)

evaluate_script function="() => {
  const results = {};

  // LCP
  const lcpEntries = performance.getEntriesByType('largest-contentful-paint');
  if (lcpEntries.length > 0) {
    const lcp = lcpEntries[lcpEntries.length - 1];
    results.lcp = {
      value: Math.round(lcp.startTime),
      element: lcp.element?.tagName,
      url: lcp.url || null,
      rating: lcp.startTime <= 2500 ? 'good' : lcp.startTime <= 4000 ? 'needs-improvement' : 'poor'
    };
  }

  // CLS
  let clsValue = 0;
  for (const entry of performance.getEntriesByType('layout-shift')) {
    if (!entry.hadRecentInput) clsValue += entry.value;
  }
  results.cls = {
    value: Math.round(clsValue * 1000) / 1000,
    rating: clsValue <= 0.1 ? 'good' : clsValue <= 0.25 ? 'needs-improvement' : 'poor'
  };

  return results;
}"

Resource waterfall (slowest resources)

evaluate_script function="() => {
  const entries = performance.getEntriesByType('resource');
  return entries
    .map(e => ({
      name: e.name.split('/').pop()?.substring(0, 60),
      type: e.initiatorType,
      duration: Math.round(e.duration),
      transferSize: e.transferSize,
      start: Math.round(e.startTime)
    }))
    .sort((a, b) => b.duration - a.duration)
    .slice(0, 15);
}"

Long tasks

evaluate_script function="() => {
  if (!window.__longTasks) {
    window.__longTasks = [];
    new PerformanceObserver(list => {
      for (const entry of list.getEntries()) {
        window.__longTasks.push({
          startTime: Math.round(entry.startTime),
          duration: Math.round(entry.duration)
        });
      }
    }).observe({ type: 'longtask', buffered: true });
    return { status: 'observer started — call again after interaction to see results' };
  }
  return window.__longTasks;
}"

Interpreting results

LCP (Largest Contentful Paint)

RatingThreshold
Good≤ 2.5s
Needs improvement≤ 4.0s
Poor> 4.0s

Common causes of slow LCP:

  • Large unoptimized images (check with list_network_requests resourceTypes=["image"])
  • Render-blocking CSS/JS (check resource waterfall for early large scripts)
  • Slow server response (check TTFB from Navigation Timing)

CLS (Cumulative Layout Shift)

RatingThreshold
Good≤ 0.1
Needs improvement≤ 0.25
Poor> 0.25

Common causes of CLS:

  • Images without width/height attributes
  • Dynamically injected content above the fold
  • Web fonts causing FOUT (Flash of Unstyled Text)

Safari-specific performance considerations

  • Safari uses WebKit's rendering engine which handles compositing differently from Blink — will-change and transform: translateZ(0) hacks may behave differently.
  • Intelligent Tracking Prevention (ITP) can cause extra network latency for third-party resources.
  • Safari's JS engine (JavaScriptCore) has different JIT behavior than V8. Microbenchmarks may not reflect real-world performance.

Full debugging workflow

  1. Navigate and measure baseline:

    navigate_page url="<target-url>"

    Then run the Navigation Timing and Core Web Vitals scripts above.

  2. Check for render-blocking resources:

    list_network_requests resourceTypes=["script", "stylesheet"]
  3. Check for console errors that might block rendering:

    list_console_messages types=["error"]
  4. Take a screenshot to verify visual completeness:

    take_screenshot
  5. If LCP is slow, identify the LCP element and check its source in the network log.

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.