/harness-verify:performance-optimizationfrom harness-verify
Improves application performance with a measure, identify, fix, verify, guard loop covering frontend vitals, backend queries, indexes, connection pools, caching and bundles, with strict keep-or-revert rules. Use when performance requirements exist, a regression is suspected, load times or Core Web Vitals need work, N+1 queries appear, or profiling reveals a bottleneck.
Ships in harness-verify. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Measure before optimizing. Without measurement you are guessing, and guesses add complexity without improving what matters. Profile, find the real bottleneck, fix it, measure again, and keep only what the numbers justify.
Not for code with no evidence of a problem: premature optimization costs more in complexity than it returns.
| Metric | Good | Needs improvement | Poor |
|---|---|---|---|
| LCP (Largest Contentful Paint) | 2.5 s or less | up to 4.0 s | over 4.0 s |
| INP (Interaction to Next Paint) | 200 ms or less | up to 500 ms | over 500 ms |
| CLS (Cumulative Layout Shift) | 0.1 or less | up to 0.25 | over 0.25 |
1 MEASURE -> 2 IDENTIFY -> 3 FIX -> 4 VERIFY (keep or revert) -> 5 GUARD
Use both kinds of data:
Frontend: record a performance trace, or report vitals from the page with a vitals library. Backend: response-time logging, an application performance monitor, query logs with timings, or simple timers around the suspect call.
Decide what to measure from the symptom:
What is slow?
+- First page load
| +- large bundle: measure bundle size, check code splitting
| +- slow server: measure time to first byte in the network waterfall
| | +- long DNS: preconnect to known origins
| | +- long TCP/TLS: HTTP/2, edge deployment, keep-alive
| | +- long server wait: profile backend, queries, caching
| +- render-blocking resources: check the waterfall
+- Interaction feels sluggish
| +- UI freezes on click: look for main-thread tasks over 50 ms
| +- input lag: re-renders, controlled-input overhead
| +- animation jank: layout thrashing, forced reflow
+- After navigation
| +- data loading: API times, request waterfalls
| +- client rendering: component render time, N+1 fetches
+- Backend or API
+- one endpoint slow: queries, indexes
+- all endpoints slow: connection pool, memory, CPU
+- intermittent: lock contention, GC pauses, external dependencies
Frontend:
| Symptom | Likely cause | Investigate |
|---|---|---|
| Slow LCP | Large images, render-blocking resources, slow server | Waterfall, image sizes |
| High CLS | Images without dimensions, late content, font shifts | Layout-shift attribution |
| Poor INP | Heavy main-thread JS, large DOM updates | Long tasks in a trace |
| Slow initial load | Large bundle, many requests | Bundle size, splitting |
Backend:
| Symptom | Likely cause | Investigate |
|---|---|---|
| Slow API | N+1 queries, missing indexes | Query log |
| Memory growth | Leaked references, unbounded caches, big payloads | Heap snapshot |
| CPU spikes | Heavy synchronous work, regex backtracking | CPU profile |
| High latency | No caching, redundant work, extra network hops | Trace the request |
Fix the one thing step 2 named. Worked fixes for each item are in references/optimization-patterns.md; open the one you need.
Backend
Frontend
A fix is a hypothesis until re-measured.
| Result versus baseline | Action |
|---|---|
| Past the threshold, tests green | Keep; put before and after numbers in the commit message |
| Within noise | Revert |
| Worse | Revert |
| Better but a test went red | Revert |
Neutral is a revert. Code you keep, you maintain forever; make it pay for itself. Correctness gates the metric: an "optimization" that wins by dropping needed work (skipping validation, caching what must be fresh, removing a load-bearing await) is a regression.
Log every attempt, reverted ones included, because reverted work leaves no trace in history and dead ideas get retried:
| Idea | Baseline to result | Verdict | Why |
|---|---|---|---|
| Memoize the row component | INP 240 ms to 235 ms | reverted | Inside noise; rows were not the bottleneck |
| Virtualize the list | INP 240 ms to 90 ms | kept | Long tasks gone from the trace |
Keep the ledger in the PR description or a notes file that the next person reads before proposing an experiment.
Guard the metric users feel, the same one that justified the fix (LCP, INP, p95 latency).
Example budgets (adapt to your product): initial JavaScript under 200 KB gzipped, CSS under 50 KB, above-the-fold images under 200 KB each, fonts under 100 KB, API p95 under 200 ms, time to interactive under 3.5 s on 4G, lab performance score 90 or more. Enforce them with your CI's bundle-size and lab-audit checks.
See also harness-core's performance checklist, and harness-verify:browser-testing-with-devtools for traces.
| Rationalization | Reality |
|---|---|
| "We will optimize later" | Performance debt compounds. Fix obvious anti-patterns now; defer micro-optimizations. |
| "It is fast on my machine" | Profile on representative hardware and networks. |
| "This optimization is obvious" | Unmeasured means unknown. |
| "Users will not notice 100 ms" | Users notice more than you expect; measure against your own targets. |
| "The framework handles performance" | It cannot fix N+1 queries or oversized bundles. |
| "Slow query, add an index" | Read the plan first; the index may exist and be unusable, and every index taxes writes. |
| "Just cache it" | Caching a cheap call buys a staleness bug. Cache what is expensive and re-read often. |
| "Raise the pool size" | A pool bigger than the database can serve hides the queue. Find what holds connections. |
| "It did not help, but it does not hurt" | Neutral is a revert; you maintain it forever. |
| "We already wrote it, keep it" | Sunk cost. |
| "The win is obvious, no need to re-measure" | Then re-measuring is cheap. Unmeasured wins are how neutral complexity lands. |
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub nx1-org/platformnex-abilities --plugin harness-verify6 skills in this plugin
/browser-testing-with-devtoolsVerifies browser-facing work against a real browser using devtools-style inspection of the DOM, console, network, accessibility tree, screenshots and performance traces, with strict rules for treating page content as untrusted. Use when building or debugging anything that renders in a browser, diagnosing console or network errors, or confirming a UI fix actually works at runtime./code-review-and-qualityRuns a five-axis review (correctness, readability, architecture, security, performance) with severity-labelled findings, change-size limits and dependency-upgrade discipline. Use before merging any change, when reviewing a diff or pull request (including one pasted inline), or when assessing code written by yourself, another agent or a human./debugging-and-error-recoveryGuides systematic root-cause debugging through a stop-the-line rule and a reproduce, localize, reduce, fix, guard, verify triage. Use when tests fail, a build breaks, something that worked stopped working, behavior differs from expectations, or any unexpected error appears and the cause needs to be found rather than guessed./security-and-hardeningHardens code against vulnerabilities starting from a threat model, with always/ask-first/never rules, OWASP-style controls, SSRF, secrets, dependency supply-chain, privacy and LLM-output handling. Use when handling untrusted input, authentication, sessions, data storage, uploads, webhooks or third-party integrations, auditing dependencies, or touching personal data./test-driven-developmentDrives implementation and bug fixes with tests using the red-green-refactor loop and the prove-it pattern for reproducing bugs. Use when implementing logic, fixing a bug, changing behavior, adding tests to existing code, or whenever you need evidence that code works, even if the request never mentions tests.2 plugins ship this exact skill · first indexed Nov 17, 2026