agentleFS
dvy1987dvy1987/agent-loom/.agents/skills/performance-optimization/SKILL.md

performance-optimization

Skill4 starsChanged 3 months agoMITView on GitHub

Measure, profile, and fix performance bottlenecks — Core Web Vitals, backend latency, bundle size, and database queries. Load when performance requirements exist, users report slowness, profiling reveals bottlenecks, or the user asks to optimize load time, LCP, INP, CLS, or response time. Not for premature optimization without evidence. Pairs with browser-testing-with-devtools and ci-cd-and-automation for regression guards.

130 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use constraint-driven-development, using-agent-skills and 5 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.
  • MrCipherSmithSkill

    constraint-driven-development

    Use when a project needs a persistent, measurable quality bar — starting a project without documented standards, 'set up constraints', or when coverage/perf/a11y thresholds get re-debated per-PR. Produces CONSTRAINTS.md with enforceable numbers, ratchets, and a guard against silent weakening. NOT for throwaway prototypes or a one-off CI setup.

    Also in 15 projects that use this

  • LLl0k0laDSkill

    using-agent-skills

    Use when starting a session or when you need to discover which skill applies to the current task. This is the meta-skill that governs how all other skills are discovered and invoked.

    Also in 33 projects that use this

  • LLl0k0laDSkill

    idea-refine

    Refine ideas through structured divergent and convergent thinking. Use "idea-refine" or "ideate" to trigger.

    Also in 41 projects that use this

  • HK-hubSkill

    deprecation-and-migration

    Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when deciding whether to maintain or sunset existing code.

    Also in 39 projects that use this

  • ukanwatSkill

    input-systems

    Architect game input — action mapping (abstracting keys into named actions), rebinding with conflict detection and persistence, multi-device support (keyboard, gamepad, touch), analog deadzones, and feel features like input buffering and coyote time, plus accessibility. Engine-neutral. Use when the user mentions input mapping, rebind controls, gamepad support, deadzone, input buffering, coyote time, or accessible controls.

    Also in 4 projects that use this

  • HK-hubSkill

    observability-and-instrumentation

    Instruments code so production behavior is visible and diagnosable. Use when adding logging, metrics, tracing, or alerting. Use when shipping any feature that runs in production and you need evidence it works. Use when production issues are reported but you can't tell what happened from the available data.

    Also in 31 projects that use this

  • +1 more from LLl0k0laD

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 115 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never optimize without a baseline measurement (synthetic + real-user when possible).

    line 27
  2. Distinctive:

    Document what you measured, what you changed, and the delta.

    line 31
  3. Distinctive:

    Use symptom → probe map:

    line 55
  4. Distinctive:

    Prefer highest-impact, lowest-risk fixes: indexes, caching, code-split, image sizing, defer non-critical JS.

    line 66
  5. Distinctive:

    Add Lighthouse CI budget, bundle-size check, or perf test on the hot path.

    line 74
  6. Distinctive:

    No evidence of a problem and no stated budget

    line 80
  7. Distinctive:

    No changes — citation audit passed.

    line 151

“Common” is measured: kept by at least 6 in 10 of the 115 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 Optimization

Measure before optimizing. Profile first, fix the proven bottleneck, measure again, then guard against regression.

Hard Rules

  • Never optimize without a baseline measurement (synthetic + real-user when possible).
  • Fix the actual bottleneck — not the most interesting code.
  • One change at a time when validating; otherwise you cannot attribute wins.
  • Set budgets (LCP, bundle KB, p95 latency) and fail CI when exceeded.
  • Document what you measured, what you changed, and the delta.

Core Web Vitals Targets

MetricGoodNeeds workPoor
LCP≤ 2.5s≤ 4.0s> 4.0s
INP≤ 200ms≤ 500ms> 500ms
CLS≤ 0.1≤ 0.25> 0.25

Workflow

Step 1 — Measure baseline

  • Frontend: Lighthouse (synthetic), DevTools Performance, web-vitals RUM.
  • Backend: APM, query logs with timing, p50/p95/p99 on critical endpoints.
  • Record environment, device, and data volume.

Step 2 — Identify bottleneck

Use symptom → probe map:

Slow first load → bundle size, render-blocking, LCP element
Slow interaction → INP, main-thread long tasks, layout thrash
Slow API → N+1 queries, missing indexes, cold starts
Memory growth → leaks, unbounded caches, retained DOM

Step 3 — Fix narrowly

Prefer highest-impact, lowest-risk fixes: indexes, caching, code-split, image sizing, defer non-critical JS.

Step 4 — Verify

Re-run the same measurement as Step 1. Report before/after numbers.

Step 5 — Guard

Add Lighthouse CI budget, bundle-size check, or perf test on the hot path.


When NOT to use

  • No evidence of a problem and no stated budget
  • Micro-optimizing cold paths while hot paths are unmeasured
  • Replacing architecture before profiling

Gotchas

  • Synthetic scores ≠ real-user experience — use both.
  • Optimizing the wrong layer (CSS when the DB is the bottleneck).
  • Caching without invalidation creates subtle bugs.
  • Bundle "tree-shaking" claims without measuring shipped bytes.

Common Rationalizations

ExcuseReality
"It feels fast on my machine"Your machine is not production traffic or network.
"We'll add monitoring later"Without baselines you cannot prove improvement.
"Let's rewrite in Rust"Profile first — often the query or algorithm is the issue.
"Lighthouse is enough"Lab scores miss real devices and cache states.
"Ship now, optimize later"Regressions are cheaper to block in CI than fix in prod.

Output Format

## Performance report — [area]

Baseline: [metrics + how measured]
Bottleneck: [evidence]
Change: [what]
After: [metrics]
Guard: [CI/monitoring added]

Examples

<examples> <example> <input>"Homepage LCP is 5s in CrUX."</input> <output>Measure LCP element (hero image). Compress, preload, fix CLS from font swap. Re-run Lighthouse + verify CrUX trend.</output> </example> </examples>

Verification

  • Baseline captured with method and environment noted
  • Bottleneck identified with evidence (not assumption)
  • After metrics show improvement on the same probe
  • Regression guard added or explicitly deferred with reason
  • No premature micro-opts on unmeasured paths

Red Flags

  • Optimization started without baseline measurement
  • CSS or frontend tuned while DB is actual bottleneck
  • Multiple changes shipped — win cannot be attributed
  • Synthetic score improved but real-user metrics flat

Prune Log

Last pruned: 2026-07-04

  • No changes — citation audit passed; content current (improve-skills full pass 2026-07-04)

Impact Report

Area: [frontend/backend] | Baseline: [key metric]
Bottleneck: [one line] | Delta: [before → after]
Guard: [added/deferred]

Download now (ZIP)

Does it work?

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

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.