Skip to content
Back to skills

Web Perf Review

ASecurity

Audit and optimize frontend page, modal, motion, and bundle performance for a PR, branch, or URL with restrained, evidence-backed recommendations and before/after measurements. Use when reviewing or optimizing page load speed, LCP, CLS, TBT, modal or animation jank, idle rAF or CPU usage, media weight, or initial bundle size.

  • 5,448 stars
  • 0 votes
  • 4 copies
  • 8 views
  • Added November 30, 2026
ai-agentsshellbashnodeexpressrailsrefactoringgitapifrontendbackend

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned November 30, 2026

npx -y skills add nexu-io/opengame --skill web-perf-review --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Web Perf Review?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Web Perf Review
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nexu-io-web-perf-review/badge)](https://www.skillsdirectory.com/skills/nexu-io-web-perf-review)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: web-perf-review
description: >-
  Audit and optimize frontend page, modal, motion, and bundle performance for a PR, branch, or URL with restrained, evidence-backed recommendations and before/after measurements. Use when reviewing or optimizing page load speed, LCP, CLS, TBT, modal or animation jank, idle rAF or CPU usage, media weight, or initial bundle size.
---

# Web Performance Review and Optimization

Audit or optimize the frontend performance of a PR, local branch, page, or interactive modal without over-engineering or degrading product craft. Deliver concise, decision-ready results directly in the current conversation; write external files, PR comments, or Feishu docs only when explicitly requested.

## Modes

Choose the mode from the user's request. Default to **Audit** when ambiguous.

1. **Audit (default, read-only):** Inspect the diff, build output, and live runtime behavior. Report a verdict, measured baseline, prioritized findings (`P0` / `P1` / `P2`), and whether any proposed fix changes visuals or interaction. Do not edit product code.
2. **Optimize (explicit request or approval):** Lock a **Before** measurement baseline, apply the smallest restrained fixes for `P0` and high-ROI `P1` issues, verify visual/content/tracking fidelity, re-measure **After** under identical conditions, and present the Before/After delta table.

## Restraint Rules

Follow these six guardrails on every run:

1. **Diff-first scope:** Audit only the routes, modals, entry chunks, and assets touched or affected by the target PR or request. Log unrelated legacy debt briefly under "Out-of-scope observations" without blocking the PR or refactoring unrelated files.
2. **Evidence before fixes:** Do not propose speculative micro-optimizations (for example, wrapping trivial expressions in `useMemo` or splitting tiny JSON files). Every finding must cite concrete evidence (file/line, asset size, or measured metric) and an observable user benefit.
3. **Visual and product fidelity lock:** Never silently swap artwork provenance, skip business-rule slots, visibly degrade image sharpness, or alter analytics attribution, session deduplication, keyboard focus traps, `Escape` handling, or `prefers-reduced-motion` behavior. Mark any suggestion that alters visible appearance or motion cadence as **Needs Design/PM sign-off**.
4. **Severity discipline:**
   - **P0 (Fix before merge):** Unbounded media/hotlink flood, severe LCP/modal-ready regression, visible CLS, sustained animation jank or idle `rAF`/CPU leak, large entry-bundle leak, or untriggered modal pre-fetching heavy media.
   - **P1 (High-ROI recommended):** Missing dimensions/priority hints, oversized images relative to rendered slots, high-frequency state re-rendering large subtrees, or missing visibility/occlusion pause.
   - **P2 (Observe only):** Marginal gains or broad architectural refactors; note briefly and do not churn code in an unrelated PR.
5. **Honest measurement hygiene:** Never benchmark a dev/HMR server as performance evidence. Compare Before and After on the same production build mode, viewport, throttling, and 3-run cold median. Label evidence confidence (`L1`–`L4`) and state what was not measured (for example, production CDN or low-end physical devices).
6. **Falsifiable regression guards:** When adding a performance regression test in Optimize mode, verify that the test exercises the active code path and fails against the unoptimized behavior rather than passing trivially via an early-return branch.

Detailed thresholds and anti-noise rules live in [checklist.md](references/checklist.md). Measurement rules live in [measurement-protocol.md](references/measurement-protocol.md). Visual and test pitfalls live in [visual-fidelity-guard.md](references/visual-fidelity-guard.md). Repository-specific commands live in [repo-profile.md](references/repo-profile.md).

## Workflow

### 1. Establish target and applicable dimensions

Identify the target (PR URL/number, git base..head range, uncommitted diff, or live/local URL) and read the repository's `AGENTS.md` plus [repo-profile.md](references/repo-profile.md).

Run the static diff scanner first so you only audit the performance dimensions touched by the change:

```bash
node .agents/skills/web-perf-review/scripts/scan-diff-payload.mjs \
  --repo . --base origin/main --head HEAD
```

If the diff touches only docs, tests, or backend code with zero frontend asset/render/bundle surface, stop early and report **No frontend performance impact detected** instead of inventing findings.

### 2. Inspect build artifacts and static payload

When the change affects built JS/CSS chunks or static media, build the production bundle (or inspect an existing production build) and compare entry-chunk and asset deltas:

```bash
node .agents/skills/web-perf-review/scripts/scan-diff-payload.mjs \
  --repo . --base origin/main --head HEAD \
  --build-dir studio/build --base-build-dir /path/to/base-build \
  --json /tmp/perf-static.json
```

Verify both total asset size and **initial entry graph size** (scripts, `modulepreload`, and stylesheets referenced by `index.html`) so lazy-loading wins are visible and accidental static imports into the entry shell stand out immediately.

### 3. Measure live runtime behavior

Run the zero-dependency Chrome/CDP probe against a **production build** (never a dev server) or a preview URL. Choose the probe mode that matches the feature:

- **Page load (`--mode page`):** Measures cold-load `FCP`, `LCP`, `CLS`, `TBT`, Long Tasks, above-fold image readiness, transfer bytes by resource type, duplicate GET requests, uncompressed large text assets, third-party origins, image slot overflow ratios, Blink `RecalcStyle`/`Layout`/`Script` time, and post-settle idle `rAF/s` (with top caller attribution).
- **Modal / motion (`--mode modal`):** Measures pre-trigger network/rAF hygiene, `open -> media ready` latency, modal-triggered transfer bytes, active animation window FPS / janky frame % / style-recalc & layout deltas, and post-close residual `rAF/s` and active `<video>` count.
- **UI interaction (`--mode interaction`):** Measures click/tab/filter/search responsiveness (`interaction -> next paint`, Event Timing INP proxy, interaction TBT/Long Tasks, style/layout/script cost, triggered or duplicate requests, and DOM/heap delta).

```bash
# Example: page load against a local production build
node .agents/skills/web-perf-review/scripts/measure-runtime.mjs \
  --mode page --serve-dir studio/build --spa-fallback --stub-api \
  --path / --runs 3 --viewport 1440x900 --dpr 2 \
  --throttle-kbps 12000 --latency-ms 100 \
  --out /tmp/perf-before.json

# Example: modal / motion probe
node .agents/skills/web-perf-review/scripts/measure-runtime.mjs \
  --mode modal --serve-dir studio/build --spa-fallback --stub-api \
  --path / --trigger-click "#open-modal" \
  --modal-selector "[role='dialog']" --close-key Escape \
  --runs 3 --active-ms 3000 --idle-ms 1500 \
  --out /tmp/perf-modal-before.json

# Example: click / filter / search interaction probe (INP)
node .agents/skills/web-perf-review/scripts/measure-runtime.mjs \
  --mode interaction --serve-dir studio/build --spa-fallback --stub-api \
  --path /explore --click "button[role='tab']" \
  --runs 3 --out /tmp/perf-interaction-before.json
```

If the repository already provides a canonical performance script (such as a Lighthouse runner), reuse it alongside or instead of a custom run. If a browser or production build cannot run locally, state the exact reason and downgrade confidence honestly to `L3` or `L4`.

### 4. Optimize with restraint (Optimize mode only)

1. Save the Before measurement JSON and commit SHA before editing code.
2. Address `P0` findings first, then only low-risk, high-ROI `P1` items. Pause and ask before applying any fix marked **Needs Design/PM sign-off**.
3. Follow [visual-fidelity-guard.md](references/visual-fidelity-guard.md) to verify artwork provenance, visual sharpness, slot rules, attribution/tracking, and accessibility.
4. Rebuild in the exact same production mode and re-run `measure-runtime.mjs` with identical flags to produce `after.json`.
5. Generate the deterministic Before/After comparison:

```bash
node .agents/skills/web-perf-review/scripts/compare-report.mjs \
  --before /tmp/perf-before.json --after /tmp/perf-after.json \
  --static /tmp/perf-static.json
```

6. Add or update at most the minimal deterministic regression guard needed for `P0` risks (for example, static import boundary test, asset weight test, or idle `rAF` test with proper visibility stubbing), then run the repository's boundary checks.

### 5. Deliver the conversation report

Present the result directly in the current conversation using this compact structure:

1. **Verdict (2–3 lines):** `Pass` / `Optimize recommended` / `P0 blocker`, issue counts, and exact measurement label (confidence level, environment, viewport, throttling, run count, SHAs).
2. **Comparison table (Optimize mode) or Baseline snapshot (Audit mode):** Paste the concise delta table from `compare-report.mjs` showing key user-facing metrics (`LCP` / `open->ready`, transfer bytes, FPS / style+layout cost, idle `rAF/s`, entry chunk gzip).
3. **Prioritized findings (`P0` / `P1` / `P2`):** Compact table with severity, location, user-visible symptom, smallest fix, and visual/UX impact (`None` vs `Needs Design/PM sign-off`).
4. **Fidelity, guards, and caveats:** Confirm what stayed intact (visuals, slots, tracking, a11y), list any regression test added, note out-of-scope observations separately, and explicitly state what remains unverified (for example, CI runner or production CDN).

Do not post PR comments, create Feishu documents, or commit/push files unless the user explicitly asks.

Files in this skill

  • SKILL.md9.5 KB
  • references/checklist.md7.9 KB
  • references/measurement-protocol.md6.8 KB
  • references/repo-profile.md3.1 KB
  • references/visual-fidelity-guard.md5.1 KB
  • scripts/compare-report.mjs18 KB
  • scripts/measure-runtime.mjs59 KB
  • scripts/scan-diff-payload.mjs36.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.