agentleFS
Kin9ZeusKin9Zeus/senior-engineer-skills/skills/performance-engineering/SKILL.md

performance-engineering

Skill3 starsChanged 2 months agoMITView on GitHub

Performance engineering across the stack — Core Web Vitals (LCP, INP, CLS), bundle size and rendering strategy, image and font optimisation, backend latency budgets, caching layers, database query cost, profiling, and load testing. Use when the user says "slow", "performance", "optimize", "Core Web Vitals", "LCP", "INP", "CLS", "Lighthouse", "PageSpeed", "bundle size", "page speed", "latency", "TTFB", "caching", "CDN", "it takes forever to load", "high response times" or "will this scale"; and as a pass in any project audit. By Devleck.

We split this skill into the rules it gives an agent

5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 8 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never report "this will be slow" without a measurement.

    line 18
  2. Distinctive:

    Never insert content above existing content after load — the classic offender is a cookie banner or promotional bar that pushes the page …

    line 100
  3. Very specific:

    The rule that prevents a P0: never cache user-scoped data in a shared cache without the user or tenant in the key.

    line 189
  4. Distinctive:

    Every performance claim in a report carries:

    line 214
  5. Distinctive:

    Never write "this is slow" or "this will not scale" without the measurement, the conditions, and the target it is being compared against.

    line 226

“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Performance Engineering

Three rules, in order:

  1. Measure first. Optimising the wrong thing is worse than doing nothing — it costs time and adds complexity for no gain.
  2. Fix the biggest thing. Performance work follows a power law; one bottleneck usually dominates.
  3. Set a budget and enforce it in CI. Performance regresses by accretion, one small addition at a time, and is only ever recovered by deliberate effort.

Never report "this will be slow" without a measurement. Never report a measurement without saying what it was measured on.


Frontend: the numbers that matter

Core Web Vitals, measured at the 75th percentile of real users — not from your laptop on office wifi.

MetricGoodNeeds workPoorWhat it measures
LCP≤ 2.5s≤ 4.0s> 4.0sWhen the main content appears
INP≤ 200ms≤ 500ms> 500msResponsiveness to interaction
CLS≤ 0.1≤ 0.25> 0.25Visual stability

Supporting: TTFB (≤ 800ms), total JavaScript, and total page weight.

Lab vs field. Lighthouse is a lab tool: reproducible, useful for catching regressions, and not what your users experience. Field data (Chrome UX Report, or your own real-user monitoring) is the truth. Use lab to iterate, field to decide.


LCP — usually the highest-leverage fix

LCP is almost always an image or a heading blocked by something.

  1. Find the element. Chrome DevTools Performance panel marks it; PageSpeed Insights names it.
  2. Attack the chain in this order:
    • TTFB — slow server, no CDN, no caching, a slow database query in the render path.
    • Render-blocking resources — synchronous CSS and JS in <head>. Inline critical CSS, defer the rest.
    • Resource load time — the image itself: format, size, compression.
    • Element render delay — waiting on JavaScript, or on a font.
  3. Preload the LCP image (<link rel="preload" fetchpriority="high">), and never lazy-load it. Lazy-loading the hero image is one of the most common self-inflicted LCP problems.

Images, the single biggest lever on most sites:

<img src="hero-800.avif" alt="..."
     srcset="hero-400.avif 400w, hero-800.avif 800w, hero-1600.avif 1600w"
     sizes="(max-width: 768px) 100vw, 800px"
     width="1600" height="900"          <!-- always: prevents CLS -->
     fetchpriority="high"                <!-- for the LCP image only -->
     decoding="async">

AVIF or WebP with a fallback; responsive srcset; explicit dimensions; lazy-load everything below the fold and nothing above it.

Fonts: font-display: swap (or optional), preload the one face used above the fold, self-host, subset to the characters you use, and set a metric-matched fallback so the swap does not shift layout.


INP — responsiveness

INP measures the worst interaction latency. It is dominated by long tasks blocking the main thread.

  • Break up long tasks. Anything over 50ms blocks input. Yield to the main thread between chunks.
  • Reduce hydration cost. Server components, islands, partial or progressive hydration — ship less JavaScript that must execute before the page is interactive.
  • Debounce expensive handlers; move heavy computation to a Web Worker.
  • Avoid layout thrashing — reading a layout property after writing one forces a synchronous reflow. Batch reads, then writes.
  • Virtualise long lists.
  • Profile in the Performance panel with CPU throttling on. A fast laptop hides everything your users experience on a mid-range phone.

CLS — stability

Almost entirely preventable:

  • width and height (or aspect-ratio) on every image, video and iframe.
  • Reserve space for ads, embeds and banners before they load.
  • Never insert content above existing content after load — the classic offender is a cookie banner or promotional bar that pushes the page down.
  • font-display: optional, or a metric-matched fallback.
  • Animate transform and opacity only; animating width, height, top or margin triggers layout on every frame.

JavaScript weight

The most reliable structural improvement available to most sites.

npx vite-bundle-visualizer         # or: next build (prints per-route sizes)
npx source-map-explorer 'dist/**/*.js'
  • Route-level code splitting, and dynamic imports for heavy components (editors, charts, PDF viewers, date-locale data, maps).
  • Audit the largest dependencies. The usual offenders are a full date library where a formatter would do, a full icon set where five icons are used, a charting library on a page with one sparkline, and locale data for every language.
  • Tree-shakeable imports (import { x } from "lib", never import * as lib).
  • Question every third-party script. They are frequently more than half the JavaScript on a marketing page, they run on the main thread, and each one is also a privacy and security surface. Load them after consent, deferred, or via a partytown-style worker.
  • Set a bundle-size budget and fail CI on regression. Without a gate, bundle size only goes one way.

Rendering strategy

Choose per route. Getting this wrong is a structural performance defect that no amount of micro-optimisation fixes.

ContentStrategy
Marketing, blog, docsStatic generation. Nothing beats a file on a CDN
Personalised but crawlableServer-render, stream where supported
Authenticated appClient render is fine; SEO is irrelevant behind a login
Frequently-changing public dataIncremental regeneration or short-TTL edge cache

A marketing page that ships 400KB of JavaScript to render static text is a performance and an SEO defect.


Backend latency

Set a budget per endpoint before optimising:

p50 < 100ms · p95 < 300ms · p99 < 1000ms

Then find where the time goes, with a profiler or a trace — never by reading code and guessing.

Where backend time actually goes, in order of frequency:

  1. Database queries — missing index, N+1, unnecessary data. See database-engineering. This is the answer most of the time.
  2. Sequential external calls that could be parallel.
  3. Work in the request path that belongs in a queue — email, image processing, report generation, webhook delivery.
  4. Serialisation of large payloads.
  5. Application code — genuinely last, and usually not worth touching until the four above are handled.

Quick wins that are almost always available: parallelise independent I/O (Promise.all rather than sequential await), move non-blocking work to a queue, add the missing index, enable compression, return less data.


Caching — in order of preference

  1. Make it fast. Cache is not a substitute for an index; it is a layer over one, and it will mask the problem until the cache fails.
  2. CDN / edge for static assets and public pages. Immutable hashed filenames with a long max-age, stale-while-revalidate for HTML.
  3. HTTP caching — ETag, Cache-Control — so browsers stop asking.
  4. Application cache (Redis) for expensive computed results, with an explicit TTL and an explicit invalidation rule. If you cannot state the invalidation rule, you have stale data, not a cache.
  5. Database-level — materialised views for expensive aggregates.

The rule that prevents a P0: never cache user-scoped data in a shared cache without the user or tenant in the key. Cross-user cache leakage is a data breach, and it is a recurring one in real audits.


Enforcing it

# In CI — performance regresses by accretion unless something stops it
- name: Lighthouse CI
  run: lhci autorun
  # budgets: LCP < 2500ms, CLS < 0.1, total JS < 300KB, TBT < 300ms

- name: Bundle size
  run: npx size-limit    # fails the build on regression

Plus, in production: real-user monitoring for Core Web Vitals, and alerts on p95 latency per endpoint against the budget.


The measurement discipline

Every performance claim in a report carries:

**Measured:** LCP 4.8s (p75, field data, mobile, last 28 days, n=12,400)
**Cause:**    Hero image is a 2.4MB unoptimised PNG, lazy-loaded, not preloaded
**Fix:**      Convert to AVIF with srcset (est. 180KB), remove loading="lazy",
              add fetchpriority="high"
**Expected:** LCP ~1.9s
**Verify:**   PageSpeed Insights field data after 28 days; Lighthouse CI in the
              meantime

Never write "this is slow" or "this will not scale" without the measurement, the conditions, and the target it is being compared against.

References

  • references/web-performance.md — frontend techniques in depth, with a diagnostic order
  • references/backend-performance.md — profiling, concurrency, caching, capacity planning

Download now (ZIP)

  • Other versions10 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 10

    1. btriapitsyn/openchamber★ 12ksame name
    2. openchamber/openchamber★ 12ksame name
    3. travisjneuman/.claude★ 106same name
    4. HeBtcd/skills★ 5same name
    5. ai-enhanced-engineer/aiee-skills★ 4same name
    6. dathuynh1108/agent-skills★ 4same name
    7. jlu-lujing/TaskHunter★ 4same name
    8. Mnwa/performance-engineering★ 4same name
    9. g-cqd/skills★ 2same name
    10. juninmd/skills★ 2same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Used alongsideProjects with it also use clack-cli-patterns, drag-to-reorder and 10 more.

    Other files people use alongside this one.

    Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
    • jlu-lujingSkill

      clack-cli-patterns

      Use when creating or modifying TaskHunter CLI commands, prompts, terminal output, non-TTY behavior, `--quiet`, or `--json` behavior.

      Also in 3 projects that use this

    • jlu-lujingSkill

      drag-to-reorder

      Use when implementing or modifying TaskHunter sortable or drag-to-reorder behavior, especially `@dnd-kit`, touch/mobile interactions, variable-width items, or wrapping layouts.

      Also in 3 projects that use this

    • gabriellstSkill

      desktop-shell

      Work on the CODM desktop shell — the Tauri v2 host (packages/app/tauri), the react client-side services DI (packages/app/react/src/services — ports + platform services + Container/Token + ServicesProvider), sidecar supervision, or any OS-integration capability (folder picker, notifications, badge, secrets, autostart). Use whenever a task mentions Tauri, the desktop app, sidecars, or an OS capability the react console needs.

      Also in 3 projects that use this

    • lossless-groupSkill

      theme-system

      The Lossless Group's theme and mode architecture — two-tier token system, three-mode contract (light/dark/vibrant), theme.css organization, and design system conventions. Use when setting up themes/modes for any Astro Knots site, debugging mode toggles, working with CSS tokens, or when the user mentions "vibrant mode", "two-tier tokens", "theme.css", or design system patterns.

      Also in 3 projects that use this

    • mamachankoSkill

      communication-style

      Communicate like a professional collaborator — concrete, direct, calibrated, low on filler. Use as the standing style for reports, summaries, reviews, PR text, and conversation, or when the user asks for a specific register such as terse.

      Also in 3 projects that use this

    • malopezr7Skill

      serve-sim

      Controls a running iOS, iPad, or Apple Watch Simulator via the serve-sim CLI (npx serve-sim) and streams it into the host agent's preview pane. Use whenever the user wants an AI agent to view or drive an Apple Simulator — streaming to preview, taps at normalized coordinates, multi-touch gestures, hardware buttons, rotation, memory warnings, CoreAnimation debug, synthetic camera injection, or media drag-drop. Triggers include "serve-sim", "iOS simulator", "Apple simulator", "iPad simulator", "Apple Watch simulator", "stream the simulator", "show the simulator in preview", "view the simulator here", "open simulator in preview", "simulator gestures", "tap on the simulator", "rotate the simulator", "inject camera feed", or any request to drive or display an Apple Simulator visually. Do NOT use for Android emulators, building/installing an iOS app (use xcodebuild), booting a simulator from scratch (use xcrun simctl boot), in-app React Native runtime debugging (use rn-debugger), or real iOS hardware.

      Also in 3 projects that use this

    • +5 more from jlu-lujing
  • In this repository21 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.