render-blocking-resources

Find and remove what blocks first paint. Lists the critical path of a saved HTML page in document order and flags parser-blocking scripts in the head and early body, third-party stylesheets and scripts on the critical path, CSS @import chains, document.write, A/B-testing anti-flicker snippets, oversized inline CSS, too many blocking stylesheets, missing and excessive preconnect hints. Explains defer vs async vs type=module, critical CSS inlining, non-blocking CSS loading and resource hints with copy-paste snippets. Use when Lighthouse reports "Eliminate render-blocking resources", "Render blocking requests" or a long critical request chain, FCP or LCP render delay is high, the page stays white for seconds, or the user asks whether to use defer or async.

O que é render-blocking-resources?

render-blocking-resources is a Claude Code agent skill that find and remove what blocks first paint. Lists the critical path of a saved HTML page in document order and flags parser-blocking scripts in the head and early body, third-party stylesheets and scripts on the critical path, CSS @import chains, document.write, A/B-testing anti-flicker snippets, oversized inline CSS, too many blocking stylesheets, missing and excessive preconnect hints. Explains defer vs async vs type=module, critical CSS inlining, non-blocking CSS loading and resource hints with copy-paste snippets. Use when Lighthouse reports "Eliminate render-blocking resources", "Render blocking requests" or a long critical request chain, FCP or LCP render delay is high, the page stays white for seconds, or the user asks whether to use defer or async.

Funciona com✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/saizul/web-performance-skills/tree/HEAD/skills/render-blocking-resources

Installed? Explore more Programação e Desenvolvimento skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Perguntar na sua IA favorita

Abre um novo chat com esta habilidade de agente já pré-carregada.

Documentação

Render-blocking resources

Goal: the browser can paint the first screen after the HTML plus a small amount of critical CSS. Scripts never block parsing unless there is a documented reason.

Paths below are relative to this skill's folder (in Claude Code: ${CLAUDE_SKILL_DIR}).

When to use

  • Lighthouse "Eliminate render-blocking resources" / "Render blocking requests" / "Avoid chaining critical requests" / network dependency tree
  • High FCP, or LCP render delay dominates
  • "White screen for 3 seconds", "should this script be async or defer?"

When not to use

  • Fonts are the blocking resource: web-font-loading
  • The page is a client-rendered SPA shell: lcp-optimization (server rendering)
  • Too much JavaScript overall: js-bundle-budget

Workflow

  1. Get the server HTML (what the preload scanner sees):
    curl -sL https://example.com/ -o page.html
    
  2. Run the scanner (read-only):
    python3 scripts/render_blocking.py page.html --base-url https://example.com/
    python3 scripts/render_blocking.py page.html --json
    
    The "Critical path" list is every resource the first paint waits for, in order.
  3. Classify each blocking script (the decision table and snippets are in references/patterns.md):
    • independent (analytics, ads, widgets) -> async, or load after consent/idle
    • needs the DOM or other scripts in order -> defer (or type="module", deferred by default)
    • must run before paint (theme/dark-mode flag, consent defaults) -> keep a tiny inline script, move everything else out
    • jQuery dependents: deferring jQuery requires deferring every script that uses it and replacing inline $() calls. Test the page after this change.
  4. Fix CSS: replace @import with <link>, self-host third-party CSS that styles the first screen, load print/non-critical CSS non-blocking, and consider inlining critical CSS (~14 KB compressed) for the first screen when CSS is large.
  5. Anti-flicker snippets (Optimizely, VWO, Google Optimize-style async-hide): explain they hide the page for up to their timeout. Recommend removing them on pages without a running experiment, or server-side testing. This is a business decision: ask.
  6. Resource hints: preconnect for 2-4 third-party origins used in the first seconds, dns-prefetch for others. Remove hints for origins the page does not use.
  7. Propose a diff of the <head> and wait for confirmation; then verify by re-running the script and a Lighthouse run (FCP and "render blocking" savings should drop).

Output

Critical path: 12 resources (5 scripts, 7 stylesheets) before first paint
1. 4 sync scripts (emoji, jquery, jquery-migrate, slider) -> defer; jQuery-dependent inline code moved to DOMContentLoaded   [high]
2. widget.js from cdn.widgets-example.net -> async + facade                                [high]
3. Anti-flicker snippet (4 s timeout) -> remove, no experiment is running (asked marketing) [medium]
4. Google Fonts + widget CSS (third-party) -> self-host fonts, widget CSS loaded on demand  [medium]
5. @import extra.css inside <style> -> <link rel=stylesheet>                               [medium]
Expected: ~1.4 s faster FCP (Lighthouse estimate). Patch for header.php below.

Individual skills in this repo

This repo contains 2 individual skills — each has its own dedicated page.

image-optimization-audit

Audit page images for weight, format, sizing and loading behaviour, then produce a conversion and markup plan. Reads saved HTML (missing width/height, srcset without sizes, large images without srcset, lazy-loading on the first images or missing further down, JPEG/PNG outside a picture element with AVIF/WebP, animated GIFs) and HAR files (images over a KB budget, legacy formats with real byte counts, uncompressed SVG, broken image requests, total image weight). Includes exact commands for cwebp, avifenc, ImageMagick and sharp, and responsive image markup. Use when images are the heaviest part of a page, Lighthouse flags "Properly size images", "Serve images in next-gen formats", "Efficiently encode images", "Defer offscreen images" or "Improve image delivery", or the user asks to convert images to WebP/AVIF or set up srcset.

web-font-loading

Make web fonts fast and stable. Audits HTML and CSS for @font-face rules without font-display or with block, fonts without a WOFF2 source, Google Fonts links without display=swap or preconnect, too many weights, font preloads missing crossorigin (double downloads) or pointing at unused files, CSS @import of font stylesheets, icon fonts, too many font files and swapping fonts without metric-matched fallbacks. Covers self-hosting Google Fonts, subsetting with unicode-range and pyftsubset, variable fonts and size-adjust fallback faces that remove font-swap layout shift. Use when Lighthouse flags "Ensure text remains visible during webfont load" or "Font display", text is invisible or flashes while loading, fonts cause layout shift, or the user wants to self-host Google Fonts.

Habilidades Relacionadas