SKILL.md
Frontend performance auditor
An evidence-first workflow to attribute loading and interaction latency before proposing optimization.
- Revision
- 2
- Verified
- 2026-10-20
Compatibility and paths
Codex
skills/frontend-performance-audit/SKILL.mdClaude Code
.claude/skills/frontend-performance-audit/SKILL.mdVS Code
.github/skills/frontend-performance-audit/SKILL.mdTrust and provenance
Curated record reviewed 2026-10-20. Results still depend on the supplied context and target environment.
Generated assetReady to copy or download
---
name: frontend-performance-audit
description: Attributes user-visible frontend latency to measured work before proposing optimization. Use with a named interaction/trace and field or lab context; distinguish queued-work opportunities from total completion time and actual Core Web Vitals.
license: CC-BY-4.0
compatibility: One complete original HTML lab includes styles, scripts and all synthetic work, no packages/assets/analytics. Standard timers plus feature-detected scheduler.yield fallback. Actual browser interaction required; local results are not field INP or full device coverage.
metadata:
author: oneliners
version: "2.0.0"
---
# Frontend performance auditor
## Name the slow task and data source
Record route/build, actual user action, device/browser/network/cache state, field versus lab data and relevant user-visible budget. For interaction latency distinguish already-running work (input delay), handler work and presentation/rendering delay; do not assume the network or hosting is responsible. Use the affected version's trace, waterfall and resource initiators. Protect telemetry privacy and never add analytics or upload customer traces without authorization.
## Complete task-boundary experiment
Save the whole block as scheduling-lab.html and open it in a browser. This intentionally spends roughly a quarter second on artificial CPU work; use only this throwaway page, not a real form. Type a disposable draft, run synchronous/adaptive/timer-fallback modes separately, and record each visible JSON result. All code/data/styles are included; no token file, font, API or instrumentation package is missing.
```html
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Owned scheduling evidence</title><style>:root{color-scheme:dark;--surface:#151a21;--text:#f0f4f8;--action:#89b4fa;--on-action:#111820;--focus:#ffd75f}*{box-sizing:border-box}body{margin:0;background:var(--surface);color:var(--text);font:1rem/1.5 system-ui,sans-serif}main{max-inline-size:58rem;margin:auto;padding:24px}button,input{font:inherit}button{background:var(--action);color:var(--on-action);border:1px solid var(--action);border-radius:8px;min-block-size:44px;padding:12px;margin:4px}input{max-inline-size:100%;padding:12px;background:var(--surface);color:var(--text);border:1px solid var(--action)}button:focus-visible,input:focus-visible{outline:3px solid var(--focus);outline-offset:3px}pre{white-space:pre-wrap;overflow-wrap:anywhere}p{overflow-wrap:anywhere}</style></head><body><main><h1>Owned main-thread scheduling lab</h1><p>40 artificial CPU jobs of at least6ms each. A deliberate negative control blocks this page briefly. No real workload, analytics, files or network. Run one mode at a time.</p><label for="draft">Owned draft</label> <input id="draft" value="Keep this input"><p><button id="sync" type="button">Run synchronous</button><button id="adaptive" type="button">Run adaptive yielding</button><button id="fallback" type="button">Run timer fallback</button></p><p id="status" role="status">Ready.</p><pre id="result">No measurement yet.</pre></main><script>const result=document.getElementById('result');
const status=document.getElementById('status');
const controls=[...document.querySelectorAll('button')];
function ownedJob(){const end=performance.now()+6;while(performance.now()<end){};return 1;}
async function run(mode){
controls.forEach(button=>button.disabled=true);status.textContent='Running '+mode+' on owned synthetic work';
const started=performance.now();let probeDelayMs=null,probeResolve;const probe=new Promise(resolve=>probeResolve=resolve);
setTimeout(()=>{probeDelayMs=performance.now()-started;probeResolve();},0);
let completed=0,yields=0,sliceStart=performance.now(),maxSliceMs=0;
for(let job=0;job<40;job++){
completed+=ownedJob();
if(mode!=='synchronous'&&performance.now()-sliceStart>=12){
maxSliceMs=Math.max(maxSliceMs,performance.now()-sliceStart);yields++;
if(mode==='adaptive'&&typeof globalThis.scheduler?.yield==='function')await globalThis.scheduler.yield();
else await new Promise(resolve=>setTimeout(resolve,0));
sliceStart=performance.now();
}
}
maxSliceMs=Math.max(maxSliceMs,performance.now()-sliceStart);const workElapsedMs=performance.now()-started;
await probe;
result.textContent=JSON.stringify({mode,completed,yields,probeDelayMs,workElapsedMs,maxSliceMs,yieldPath:mode==='synchronous'?'none':mode==='adaptive'&&typeof globalThis.scheduler?.yield==='function'?'scheduler.yield':'setTimeout',scope:'Local synthetic work and timer scheduling only; not Event Timing, INP, field percentile, paint or network measurement.'},null,2);
status.textContent='Completed '+mode+'; 40 owned jobs, no external data.';controls.forEach(button=>button.disabled=false);
}
document.getElementById('sync').addEventListener('click',()=>run('synchronous'));
document.getElementById('adaptive').addEventListener('click',()=>run('adaptive'));
document.getElementById('fallback').addEventListener('click',()=>run('timer-fallback'));</script></body></html>
```
## Interpret only what was actually measured
The included page performs the same40 deliberately artificial jobs in three modes, with the same completed count. Each click queues a zero-delay timer probe before the work. In synchronous mode the probe cannot run until the loop yields back; the local delay therefore includes the full blocking batch. Adaptive mode uses feature-detected scheduler.yield with a timer fallback; the explicit fallback button tests the timer path even in a browser supporting the scheduler.
Read the actual result JSON after each click: completed, yields, probeDelayMs, workElapsedMs and maxSliceMs are local observations, not universal expected durations. Yielding introduces scheduling overhead and may increase completion time while giving queued work earlier opportunities. A12ms checkpoint is a target between indivisible6ms jobs, not a hard maximum task duration under all CPU/preemption conditions. A timer is not an input event and its delay is not INP; the page does not observe presentation/paint or collect field data.
In one actual owned browser run, synchronous work completed40 jobs with no yields, about241.7ms timer delay and240.2ms total work elapsed. Adaptive scheduler mode completed40 with20 yields and12ms measured slices, yet its timer delay remained about240.8ms. That is not an early-timer improvement: prioritized continuations and task-source scheduling mean a queued timer is not a reliable proxy for input/paint opportunities. The forced timer fallback completed40 with20 yields, about12.9ms probe delay and303.4ms work elapsed. It exposed the latency/completion tradeoff for this run, not a universal superiority of timers over the scheduler. Preserve these distinct observations rather than selecting only the attractive timing. Timings vary with browser visibility, timer clamping, CPU and other work; rerun the full exercise in the actual target environment.
Preserve an entered Owned draft while testing all modes and check actual desktop/mobile layout, native focus and console. The page makes no external requests and sends no RUM beacon. For a real frontend audit, inspect a representative trace/waterfall and field evidence, split input delay/processing/presentation, then attribute the actual script/layout/resource cost before optimizing. This synthetic exercise neither establishes a slow OneLiners host nor a field CWV improvement. Do not claim a screen-reader/device matrix, LCP/CLS/INP percentile or universal sub50ms guarantee from these local counters.
## Choose and retest the real repair
[web.dev long-task guidance](https://web.dev/articles/optimize-long-tasks) explains task-boundary yielding and the explicit cross-browser fallback; a resolved Promise alone does not let rendering/input tasks run. Keep critical user work first, reduce unnecessary work, then use bounded chunking or an appropriate worker where evidence supports it. Field INP requires proper Event Timing aggregation/attribution and representative interactions, not this timer probe. Return source/build/route/action, evidence type and bottleneck, actual raw before/after local or field measurements, correctness/state checks, supported fallback behavior and untested devices. Stop on missing evidence; do not bundle a hosting migration, app redesign or tracking installation into a performance review.
Real example
Input
Use only the complete original scheduling-lab.html in SKILL.md. Enter a disposable draft and run all three buttons. Record real result JSON, queued timer delay, completion count and retained input; distinguish task opportunities, overhead and local timing from field INP/paint/network evidence.
Expected result
The included page performs the same40 deliberately artificial jobs in three modes, with the same completed count. Each click queues a zero-delay timer probe before the work. In synchronous mode the probe cannot run until the loop yields back; the local delay therefore includes the full blocking batch. Adaptive mode uses feature-detected scheduler.yield with a timer fallback; the explicit fallback button tests the timer path even in a browser supporting the scheduler. Read the actual result JSON after each click: completed, yields, probeDelayMs, workElapsedMs and maxSliceMs are local observations, not universal expected durations. Yielding introduces scheduling overhead and may increase completion time while giving queued work earlier opportunities. A12ms checkpoint is a target between indivisible6ms jobs, not a hard maximum task duration under all CPU/preemption conditions. A timer is not an input event and its delay is not INP; the page does not observe presentation/paint or collect field data. In one actual owned browser run, synchronous work completed40 jobs with no yields, about241.7ms timer delay and240.2ms total work elapsed. Adaptive scheduler mode completed40 with20 yields and12ms measured slices, yet its timer delay remained about240.8ms. That is not an early-timer improvement: prioritized continuations and task-source scheduling mean a queued timer is not a reliable proxy for input/paint opportunities. The forced timer fallback completed40 with20 yields, about12.9ms probe delay and303.4ms work elapsed. It exposed the latency/completion tradeoff for this run, not a universal superiority of timers over the scheduler. Preserve these distinct observations rather than selecting only the attractive timing. Timings vary with browser visibility, timer clamping, CPU and other work; rerun the full exercise in the actual target environment. Preserve an entered Owned draft while testing all modes and check actual desktop/mobile layout, native focus and console. The page makes no external requests and sends no RUM beacon. For a real frontend audit, inspect a representative trace/waterfall and field evidence, split input delay/processing/presentation, then attribute the actual script/layout/resource cost before optimizing. This synthetic exercise neither establishes a slow OneLiners host nor a field CWV improvement. Do not claim a screen-reader/device matrix, LCP/CLS/INP percentile or universal sub50ms guarantee from these local counters.