/qa-load-testing:web-vitals-inp-deepfrom qa-load-testing
Breaks Interaction to Next Paint (INP) into input delay, processing, and presentation. Asserts per-interaction budgets in Playwright and identifies long tasks. Use when a page feels slow but LCP/CLS are green.
Ships in qa-load-testing. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
INP is "the time from the start of the interaction to the moment the next frame is fully presented" per the INP web.dev article. Thresholds at the 75th percentile of page loads:
npm install web-vitals
Per the INP web.dev article.
import { onINP } from 'web-vitals';
onINP((metric) => {
console.log('INP:', metric.value, metric);
// metric.attribution gives interaction details (target, eventType, etc.)
});
Per the INP web.dev article: the web-vitals library handles
edge cases (BFCache restoration, visibility changes) that raw
PerformanceObserver does not.
INP encompasses three components per the INP web.dev article:
Use metric.attribution (provided by web-vitals INP attribution
build) to identify which component dominates:
import { onINP } from 'web-vitals/attribution';
onINP((metric) => {
console.log('Total INP:', metric.value);
console.log('Input delay:', metric.attribution.inputDelay);
console.log('Processing duration:', metric.attribution.processingDuration);
console.log('Presentation delay:', metric.attribution.presentationDelay);
console.log('Long animation frame:', metric.attribution.longAnimationFrameEntries);
});
import { test, expect } from '@playwright/test';
test('modal open INP under 200ms', async ({ page }) => {
await page.addInitScript({ path: 'node_modules/web-vitals/dist/web-vitals.iife.js' });
await page.goto('https://localhost:3000');
await page.evaluate(() => {
(window as any).__inpValues = [];
(window as any).webVitals.onINP((m: any) => {
(window as any).__inpValues.push(m.value);
});
});
// The interaction under test
await page.click('[data-testid="open-modal"]');
await page.waitForSelector('[role="dialog"]');
// Force INP to flush. web-vitals finalizes INP inside its own
// visibilitychange handler, which reads document.visibilityState
// synchronously (per the [web-vitals README]). Redefine the property to
// 'hidden' FIRST, THEN dispatch the event: if you dispatch first, the
// handler still sees 'visible' and never reports.
await page.evaluate(() => {
Object.defineProperty(document, 'visibilityState', {
configurable: true,
get: () => 'hidden',
});
document.dispatchEvent(new Event('visibilitychange'));
});
const inps = await page.evaluate(() => (window as any).__inpValues);
const max = Math.max(...inps);
expect(max).toBeLessThan(200);
});
test('no long tasks > 50ms during route change', async ({ page }) => {
// Install the observer BEFORE navigation and push entries onto a
// window-scoped array. A closure-local array would never reach
// window.__longTasks, so the later read returns [] and the assertion
// passes vacuously regardless of real long tasks.
await page.addInitScript(() => {
(window as any).__longTasks = [];
const obs = new PerformanceObserver((list) => {
for (const e of list.getEntries()) {
(window as any).__longTasks.push({
name: e.name, duration: e.duration, startTime: e.startTime,
});
}
});
// 'longtask' is the Long Tasks API entry type; buffered:true replays
// tasks recorded before the observer attached (per [MDN longtask]).
obs.observe({ type: 'longtask', buffered: true });
});
await page.goto('https://localhost:3000');
await page.click('[data-testid="route-link"]');
await page.waitForLoadState('networkidle');
const blocking = (await page.evaluate(() => (window as any).__longTasks ?? []))
.filter((t: any) => t.duration > 50);
expect(blocking).toEqual([]);
});
The richer successor to Long Tasks is the Long Animation Frames (LoAF) API
(type: 'long-animation-frame'), but it is not yet Baseline across browsers
per MDN LoAF, so attach it as a separate, guarded observer rather than
relying on it alone.
Lab + field don't always match. Pair lab tests with CrUX queries:
# CrUX REST API - key from the environment, sent as a header
curl -X POST 'https://chromeuxreport.googleapis.com/v1/records:queryRecord' \
-H "x-goog-api-key: $CRUX_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"url":"https://yoursite.com/","metrics":["interaction_to_next_paint"]}'
Send the key in the x-goog-api-key header rather than a ?key= query
parameter: per Google API keys, a key in the URL is exposed to theft through
URL scans.
Field 75th percentile INP ≤ 200 ms = "Good" per the INP web.dev article. Lab passing + field failing = sample population mismatch (real devices slower, real interactions less predictable).
| Anti-pattern | Why it fails | Fix |
|---|---|---|
Use raw PerformanceObserver for INP | Misses BFCache, visibility-change reporting | Use web-vitals library (Step 2) |
Test INP only on click events | INP measures all interactions; tap, keypress also count | Test representative interactions per type |
| Use desktop CPU 4× speed | Hides regressions; field is mobile + slower CPU | Throttle CPU 4 - 6× in Playwright config |
| Assert single sample | INP is jittery; one bad sample fails CI | Run interaction N times; assert P75 ≤ budget |
Fix INP by fragmenting handlers with setTimeout(0) | Hides yield, doesn't reduce work | Actually reduce processing duration via deferral patterns |
attribution API requires the web-vitals/attribution build
bundle, not the default.web-vitals libraryonINP, and the
visibilitychange flush behaviorx-goog-api-key
header, and why a key in the URL is exposedWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub testland/qa --plugin qa-load-testing9 skills in this plugin
/db-query-plan-analyzerUse for any question or task about a slow SQL query or a database bottleneck, including how to read EXPLAIN or EXPLAIN ANALYZE output and database CPU that saturates under load. Reads plans from PostgreSQL, MySQL or SQLite, finds the main cost (sequential scans, nested loops, sort spills, missing or unusable indexes) and proposes the index or query rewrite./flame-graph-analyzerUse for any question or task about reading a flame graph or CPU profile, including finding the hot path after a slow release or a regression traced to one commit. Reads flame graphs and profiles from py-spy, async-profiler, Go pprof or clinic.js, finds the hottest frames, tells CPU-bound from lock contention or allocation pressure and suggests the next step./jmeter-load-testingUse when a project already uses Apache JMeter or needs JVM-native load testing: .jmx test plans with thread groups, HTTP samplers, assertions and listeners, headless jmeter -n runs, the HTML dashboard and CI gates from JTL results./k6-load-testingUse whenever HTTP, WebSocket or gRPC load tests should be written in JavaScript with k6, or a k6 threshold passes but the system still feels slow: VU scripts with checks, stages for ramps, thresholds on p95 latency and errors as the CI gate, and how to read tail latency and coordinated omission./lighthouse-perfUse when a web frontend needs Core Web Vitals (LCP, INP, CLS) checked on every PR, or its first performance budgets drafted. Sets up Lighthouse CI with Google's thresholds at the 75th percentile, per-route budgets by page type, resource-size budgets, report artifacts and PR comments./load-testing-overviewUse when a service needs load or performance testing and no tool, load profile or pass/fail threshold is chosen yet, or a live performance incident needs its cause found. Picks k6, JMeter, Gatling, Locust or Artillery, explains the six load profiles and percentiles, and gives a first CI gate.2 plugins ship this exact skill · first indexed Nov 12, 2026
Other plugins' skills for the same job