diff --git a/README.md b/README.md index df109d7..16f9bda 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A curated collection of JavaScript snippets to measure and debug Web Performance [![CI](https://github.com/nucliweb/webperf-snippets/actions/workflows/ci.yml/badge.svg)](https://github.com/nucliweb/webperf-snippets/actions/workflows/ci.yml) [![Release](https://img.shields.io/github/v/release/nucliweb/webperf-snippets)](https://github.com/nucliweb/webperf-snippets/releases) -[![Snippets](https://img.shields.io/badge/snippets-47-0f766e)](https://webperf-snippets.nucliweb.net) +[![Snippets](https://img.shields.io/badge/snippets-48-0f766e)](https://webperf-snippets.nucliweb.net) [![License](https://img.shields.io/github/license/nucliweb/webperf-snippets)](./LICENSE) [![Star History](https://img.shields.io/github/stars/nucliweb/webperf-snippets?style=social)](https://star-history.com/#nucliweb/webperf-snippets&Date) @@ -87,9 +87,9 @@ This installs skills to `~/.claude/skills/` for use across any project. | Skill | Snippets | Description | | ------------------------- | -------- | ---------------------------------------------------------------- | -| `webperf` | 47 | Main entry point for all web performance analysis | +| `webperf` | 48 | Main entry point for all web performance analysis | | `webperf-core-web-vitals` | 7 | LCP, CLS, INP measurements with detailed breakdowns | -| `webperf-loading` | 28 | TTFB, FCP, script/font analysis, resource hints, service workers | +| `webperf-loading` | 29 | TTFB, FCP, script/font analysis, resource hints, service workers | | `webperf-interaction` | 8 | Long tasks, animation frames, scroll jank, INP debugging | | `webperf-media` | 3 | Image/video audits, lazy loading validation, SVG analysis | | `webperf-resources` | 1 | Network bandwidth, connection quality, adaptive loading | diff --git a/SKILLS.md b/SKILLS.md index 97fafbe..53071bb 100644 --- a/SKILLS.md +++ b/SKILLS.md @@ -6,7 +6,7 @@ A collection of [Agent Skills](https://agentskills.io/) for measuring and debugg ## Why WebPerf Skills? -These skills transform 47 battle-tested JavaScript snippets into agent capabilities for any skills-compatible AI coding assistant: +These skills transform 48 battle-tested JavaScript snippets into agent capabilities for any skills-compatible AI coding assistant: - **Browser Console Integration**: Run performance measurements directly in Chrome DevTools - **Real-time Analysis**: Measure actual user experience on live pages @@ -22,7 +22,7 @@ These skills transform 47 battle-tested JavaScript snippets into agent capabilit | ------------------------------------------------------- | ---------- | ------------------------------------------------------------ | | **[webperf](#webperf)** | Meta-skill | "Audit performance", "check web vitals", "analyze this page" | | **[webperf-core-web-vitals](#webperf-core-web-vitals)** | 7 | "Debug LCP", "check CLS", "measure INP" | -| **[webperf-loading](#webperf-loading)** | 28 | "Analyze TTFB", "check render-blocking", "audit scripts" | +| **[webperf-loading](#webperf-loading)** | 29 | "Analyze TTFB", "check render-blocking", "audit scripts" | | **[webperf-interaction](#webperf-interaction)** | 8 | "Debug jank", "long tasks", "animation frames" | | **[webperf-media](#webperf-media)** | 3 | "Audit images", "optimize video", "lazy loading" | | **[webperf-resources](#webperf-resources)** | 1 | "Check bandwidth", "network quality" | @@ -105,7 +105,7 @@ The main entry point that helps identify the right skill for your performance qu **What it does:** - Routes to the appropriate specialized skill -- Provides overview of all 47 available snippets +- Provides overview of all 48 available snippets - Suggests which skill to use based on your question ### webperf-core-web-vitals diff --git a/pages/DevTools-Overrides/Fetch-XHR-Timeline.mdx b/pages/DevTools-Overrides/Fetch-XHR-Timeline.mdx new file mode 100644 index 0000000..5c8f335 --- /dev/null +++ b/pages/DevTools-Overrides/Fetch-XHR-Timeline.mdx @@ -0,0 +1,98 @@ +import injectSnippet from '../../snippets/DevTools-Overrides/Fetch-XHR-Timeline-inject.js?raw' +import readSnippet from '../../snippets/DevTools-Overrides/Fetch-XHR-Timeline-read.js?raw' +import { Snippet } from '../../components/Snippet' + +# Fetch & XHR Timeline + +### Overview + +Intercepts every `fetch()` and `XMLHttpRequest` call made during the page lifecycle and correlates them with the [Largest Contentful Paint (LCP)](https://web.dev/articles/lcp) timing. + +Console snippets can only see requests that have already completed and are visible in the Resource Timing API. That excludes cross-origin requests without `Timing-Allow-Origin`, requests made by service workers, and calls that fail before a response is received. This snippet patches `window.fetch` and `XMLHttpRequest.prototype` at page initialization, so every call is captured regardless of origin or outcome. + +**What it helps diagnose:** + +- API calls that complete *before* LCP and may be blocking the critical rendering path +- Failed or errored requests during framework bootstrap (Angular, React, Vue resolvers and guards) +- Unnecessary authentication checks on pages where the user is known to be unauthenticated +- The full request inventory of a page, including calls invisible to the Network panel timing data + +> This snippet requires [DevTools Overrides](/DevTools-Overrides). Read [What are DevTools Overrides?](/DevTools-Overrides) for setup instructions. + +--- + +### Part 1 — Inject snippet + +Add this inside a ` +``` + +**Step 4 — Reload and read** + +Reload the page. The override fires before any other script. Once the page has loaded, run the companion **read snippet** from the console to see the captured data. + +--- + +### Workflow + +``` +Setup (once) Every page load Console (on demand) +───────────── ──────────────── ─────────────────── +Enable Overrides → Inject snippet runs → Paste read snippet +Save HTML file Captures data into See results correlated +Add