web-vitals-inp-deep
БесплатноБез исполняемых скриптовНе проверенUse when a page feels slow to respond while LCP and CLS are green, or key interactions (form submit, modal open, route change) need an INP budget in CI…
от testland★ 18 звёзд на GitHubОб этом скилле
web-vitals-inp-deep
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:
- Good: ≤ 200 ms
- Needs Improvement: 201 - 500 ms
- Poor: > 500 ms
When to use
- A page reports "feels slow" but LCP and CLS are green - INP is the missing dimension.
- Pre-merge gate: assert key user interactions (form submit, modal open, route transition) stay under budget.
- Field debugging: correlate field INP outliers with specific interaction types.
Step 1 - Install the web-vitals library
npm install web-vitals
Per the [INP web.dev article].
Step 2 - Measure INP in lab (per interaction)
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.
Step 3 - Decompose INP
INP encompasses three components per the [INP web.dev article]:
- Input Delay - time before event handlers begin (often long tasks blocking main thread)
- Processing Duration - time for all event handler callbacks to run
- Presentation Delay - time until browser paints the next frame
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);
});
Step 4 - Playwright assertion per interaction
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);
});
Step 5 - Identify long tasks blocking main thread
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.
Step 6 - CrUX field data correlation
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'
Установить web-vitals-inp-deep в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл web-vitals-inp-deep?
Use when a page feels slow to respond while LCP and CLS are green, or key interactions (form submit, modal open, route change) need an INP budget in CI. Breaks Interaction to Next Paint into input delay, processing and presentation, asserts per-interaction budgets in Playwright and finds long tasks.
Как установить скилл web-vitals-inp-deep?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл web-vitals-inp-deep запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
The scan that the plugin's GitHub Action runs.
от Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
от GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
от GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
от GitHub