agentleFS
chiruu12chiruu12/claude-skills-template/.claude/skills/performance-optimization/SKILL.md

performance-optimization

Skill0 starsChanged 7 months agoMITView on GitHub

Systematic performance optimization workflow: measure, identify bottlenecks, fix, verify improvement. Use when user reports slowness, wants to optimize, mentions "performance", "slow", "latency", "bundle size", or "page load". Not for premature optimization — only when there's a measured problem.

156 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use accessibility-engineering, using-agent-skills 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.
  • steven123397Skill

    accessibility-engineering

    Audits existing interfaces for WCAG 2.2 AA conformance and remediates the violations found. Use when auditing a page or component for accessibility, running axe-core or pa11y, triaging a11y violations, or checking screen reader and contrast issues before shipping.

    Also in 4 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 40 projects that use this

  • 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 20 projects that use this

  • LLl0k0laDSkill

    idea-refine

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

    Also in 45 projects that use this

  • jaydubya818Skill

    deprecation-and-migration

    Retire APIs or migrate consumers and persistent data across releases.

    Also in 46 projects that use this

  • jaydubya818Skill

    observability-and-instrumentation

    Add or review logs, metrics, traces, and actionable alerts.

    Also in 36 projects that use this

  • +5 more from LLl0k0laD

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 138 edited versions we read keep these.

  • 2

    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:

    NOT: when there's no measured problem — that's premature optimization

    line 19
  2. Distinctive:

    If improvement is less than 10%, the bottleneck was misidentified.

    line 70

“Common” is measured: kept by at least 6 in 10 of the 138 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. Optimize the bottleneck, not what's easy to change. Verify the improvement with numbers, not vibes. Performance work without measurement is guessing.

When to Use

  • User reports observable slowness or latency
  • Metrics show degradation (response time, page load, bundle size)
  • Preparing for scale (known upcoming traffic increase)
  • NOT when there's no measured problem — that's premature optimization
  • NOT for readability refactors disguised as "perf improvements"

Process

1. Establish baseline

Measure BEFORE changing anything:

# Web: Core Web Vitals
# API: Response time p50/p95/p99
# Build: Bundle size, build time
# Database: Query execution time, explain plans

Record specific numbers. "It's slow" is not a baseline. "P95 response time is 2.3s, target is 500ms" is.

2. Identify the bottleneck

Profile to find WHERE time is spent — don't guess:

  • Frontend: Browser DevTools Performance tab, Lighthouse, bundle analyzer
  • Backend: Profiler (cProfile, pprof, perf), APM traces, slow query logs
  • Database: EXPLAIN ANALYZE on slow queries, connection pool stats
  • Network: Waterfall chart, DNS/TLS/TTFB breakdown

The bottleneck is the one thing that, if fixed, moves the metric. Usually it's one of: N+1 queries, missing index, uncompressed assets, synchronous blocking, or memory allocation churn.

3. Fix the bottleneck

Apply the fix for the identified bottleneck. Common fixes:

BottleneckFix
N+1 queriesEager loading / batch queries
Missing indexAdd index on filter/join columns
Large bundleCode splitting, tree shaking, lazy loading
Synchronous blockingAsync/parallel execution
Uncompressed assetsgzip/brotli, image optimization
Excessive re-rendersMemoization, virtualization
Cold startsConnection pooling, pre-warming

4. Verify improvement

Re-run the same measurement from step 1. Compare numbers:

  • Did the metric improve?
  • By how much? (absolute and percentage)
  • Any regressions in other metrics?

If improvement is less than 10%, the bottleneck was misidentified. Re-profile.

5. Document the threshold

Set a threshold that triggers future investigation:

"API response time p95 must stay under 500ms. If it exceeds this, investigate."

Common Rationalizations

ShortcutWhy It Fails
"I know what's slow, I don't need to profile"Developers are wrong about bottlenecks ~80% of the time. Profile. The real bottleneck is almost never where you think it is.
"Let's optimize everything while we're at it"Optimizing non-bottlenecks doesn't improve the metric. It adds complexity for zero user-facing benefit. Fix the ONE thing that moves the needle.
"It feels faster after my change"Feelings aren't measurements. A/B test, before/after numbers, or it didn't happen. Confirmation bias makes everything "feel faster" after you touch it.
"We should optimize this before it becomes a problem"Premature optimization is the root of all evil. Optimize when you have evidence of a real problem, not a hypothetical future one.

Red Flags

  • Optimization work started without baseline numbers — can't verify improvement
  • Multiple optimizations applied at once — can't attribute improvement to any specific change
  • "It feels faster" as the only evidence — no objective measurement
  • Optimizing code that runs once per request when the DB query takes 95% of the time — wrong bottleneck

Verification Checklist

  • Baseline measurement recorded before any changes
  • Bottleneck identified through profiling (not guessing)
  • Fix targets the identified bottleneck specifically
  • Post-fix measurement shows quantifiable improvement (>10%)
  • No regressions in other metrics
  • Performance threshold documented for future monitoring

Anti-patterns

  • DO NOT optimize without measuring first — you're guessing, not engineering
  • DO NOT apply multiple optimizations simultaneously — you can't attribute improvement
  • DO NOT optimize non-bottleneck code — it adds complexity without moving the metric
  • DO NOT accept "feels faster" as verification — use numbers

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.