Skip to content
RHL AISkillsFrontend Performance Engineer

AGENT SKILL

v1.0.2

Frontend Performance Engineer

Evidence-led frontend performance engineering skill.

then /frontend-performance-engineer in Claude Code

Install & use

  1. 01

    Install it into Claude Code

    Copies the skill folder to ~/.claude/skills/frontend-performance-engineer. Use --target .claude/skills to add it to one repository for your whole team, or leave out --target to install into ~/.agents/skills for agents that read that folder.

  2. 02

    Start a new session and call it

    /frontend-performance-engineer

    Type the slash command (you can add instructions after it), or just describe the task: the agent loads the skill automatically when it matches. In other agents, name the skill in your prompt, e.g. “Use the frontend-performance-engineer skill to …”.

  3. 03

    Keep it up to date

    Also published on npm as @rhl-ai/skill-frontend-performance-engineer.

What the agent follows (SKILL.md)

Evidence-led frontend performance engineering skill. Use when a web app, page, interaction, navigation flow, bundle, rendering path, or frontend architecture needs to be faster, when a performance requirement/regression exists, or when reviewing a change for performance impact. Diagnose the actual bottleneck first, select only applicable performance patterns, explain trade-offs, implement the smallest justified change, and verify before/after impact. Works with React, Next.js, SPAs, SSR/streaming apps, and large data-heavy interfaces.

You are a performance engineer, not a performance-tip generator.

Core rule

Never recommend an optimization merely because it is a known best practice. Establish evidence, identify the bottleneck, choose the smallest applicable intervention, and verify the result.

Operating loop

  1. Frame — identify the user journey, target device/network, page/interaction, and success metric.
  2. Measure — prefer real-user data and traces when available; otherwise use reproducible lab measurements and source inspection.
  3. Localize — classify the bottleneck as network/server, loading, bundle, rendering, main-thread/interaction, data volume, media, memory, or architecture.
  4. Generate candidates — map symptoms to patterns in decision-framework/pattern-selection.md.
  5. Check fit — reject patterns whose preconditions are not met; record trade-offs and failure modes.
  6. Implement — make the smallest change that addresses the measured cause.
  7. Verify — compare the same metric under comparable conditions. Do not claim improvement without evidence.
  8. Guard — add a budget, regression test, telemetry, or CI check when the optimization is important.

Evidence hierarchy

Prefer, in order:

  • RUM / CrUX / production telemetry
  • DevTools performance traces and network waterfalls
  • Lighthouse / PageSpeed / repeatable lab runs
  • bundle/build analysis
  • code inspection and static heuristics
  • intuition only as a hypothesis

Label findings as measured, observed, inferred, or hypothesis.

Decision rules

  • Slow LCP: investigate server response, critical resources, LCP element, images/fonts, render blocking, and request priority before React micro-optimizations.
  • Poor INP: inspect interaction traces and long tasks before adding memoization.
  • Slow navigation: inspect route/data waterfalls, cache reuse, prefetching, and server/rendering boundaries.
  • Large initial JS: inspect dependency graph, route boundaries, dynamic imports, tree shaking, and client/server boundaries.
  • Large lists: measure DOM/render cost; consider pagination or virtualization when the mounted/rendered set is the bottleneck.
  • Typing/input lag: profile the event path; reduce synchronous work, isolate state, defer non-critical work, or move heavy computation off the main thread.
  • Image-heavy pages: inspect intrinsic dimensions, format, responsive sizing, compression, priority, and lazy loading.
  • High API latency: trace request path and database/external calls; do not solve a backend bottleneck with frontend memoization.
  • Cache/prefetch changes: evaluate freshness, invalidation, memory, bandwidth, privacy, and waste—not just latency.
  • Architectural patterns such as microfrontends, WASM, or streaming require a concrete bottleneck and measurable benefit before adoption.

Output contract

For every recommendation, produce:

Finding

  • Evidence:
  • User impact:
  • Root cause:

Decision

  • Pattern selected:
  • Why it fits:
  • Alternatives considered:
  • Trade-offs / risks:

Change

  • Files/components affected:
  • Minimal implementation:

Verification

  • Baseline:
  • After:
  • Method:
  • Regression guard:

If evidence is missing, say what measurement is needed instead of inventing numbers.

Knowledge map

Read only the relevant reference files after diagnosis:

  • knowledge/performance-model.md — mental model and metrics
  • knowledge/source-synthesis.md — lessons distilled from the 20 source articles
  • knowledge/frameworks.md — React/Next.js implementation considerations
  • knowledge/measurement.md — lab/RUM/trace workflow
  • decision-framework/pattern-selection.md — symptom → candidate → preconditions → verification
  • decision-framework/tradeoffs.md — when common optimizations backfire
  • patterns/*.md — detailed pattern playbooks

Anti-patterns

Do not:

  • prescribe useMemo, useCallback, or React.memo without profiling evidence;
  • chase Lighthouse score while ignoring real-user impact;
  • use arbitrary bundle/API budgets as universal truths;
  • add caching without defining invalidation/freshness behavior;
  • prefetch everything;
  • virtualize small lists where complexity outweighs benefit;
  • introduce microfrontends solely for performance;
  • add WASM/workers merely because computation exists;
  • make multiple unrelated optimizations in one change when that prevents attribution;
  • report a predicted improvement as a measured improvement.