src/orchestrator/skills/performance-optimization/SKILL.md
Profiles and reduces frontend/backend costs: split bundles, optimize assets, apply caching, and fix Core Web Vitals regressions. Use when profiling Lighthouse/CI regressions, reducing bundle size, or fixing high CLS/LCP/TTI metrics.
npx skillsauth add etylsarin/opencastle performance-optimizationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Rule: Measure first (Chrome DevTools, Lighthouse, Datadog), optimize second. Set budgets (load time, memory, API latency). Automate in CI/CD.
Domain-specific patterns (rendering, JS, Node optimizations) are referenced in REFERENCE.md to keep this skill concise.
| Domain | Key patterns |
|--------|-------------|
| Rendering | React.memo/useMemo/useCallback only after profiling; stable key props; CSS classes over inline styles; CSS animations (GPU); requestIdleCallback for non-critical work |
| Assets | WebP/AVIF images; SVG icons; bundle+minify+tree-shake (esbuild/Rollup); loading="lazy"; dynamic imports; long-lived cache headers + cache-busting; font subsetting + font-display: swap |
| JS | Web Workers for heavy computation; debounce/throttle events; clean up listeners/intervals; Map/Set for lookups; TypedArray for numeric data |
| Node.js | Async APIs only (never readFileSync in prod); clustering/worker threads for CPU; streams for large I/O; profile with clinic.js / node --inspect |
// BAD: fetch on every keystroke
input.addEventListener('input', (e) => fetch(`/search?q=${e.target.value}`));
// GOOD: debounced 300 ms
let t; input.addEventListener('input', (e) => { clearTimeout(t); t = setTimeout(() => fetch(`/search?q=${e.target.value}`), 300); });
// Lazy-load a heavy chart only on client
import dynamic from 'next/dynamic';
const Chart = dynamic(() => import('../components/Chart'), { ssr: false, loading: () => <div>Loading chart…</div> });
export default function Page(){ return <Chart />; }
import React, { Profiler } from 'react';
const Item = React.memo(function Item({data}){ return <div>{data.title}</div>; });
function onRender(id, phase, actualDuration){ console.log(id, phase, actualDuration); }
export default function List({items}){
return (
<Profiler id="List" onRender={onRender}>
{items.map(i=> <Item key={i.id} data={i} />)}
</Profiler>
);
}
--emulated-form-factor=mobile.clinic for backend.
development
Defines 10 sequential validation gates: secret scanning, lint/test/build checks, blast radius analysis, dependency auditing, browser testing, cache management, regression checks, and smoke tests. Use when running pre-deploy validation or CI checks, CI/CD pipelines, deployment pipeline validation, pre-merge checks, continuous integration, or pull request validation.
development
Generates test plans, writes unit/integration/E2E test files, identifies coverage gaps, and flags common testing anti-patterns. Use when writing tests, creating test suites, planning test strategies, mocking dependencies, measuring code coverage, or test planning.
development
Provides model routing rules, validates delegation prerequisites, supplies cost tracking templates, and defines dead-letter queue formats for Team Lead orchestration. Load when assigning tasks to agents, choosing model tiers, starting a delegation session, running a multi-agent workflow, delegating work, choosing which model to use, or assigning tasks.
testing
Saves and restores session state including task progress, file changes, and delegation history. Use when saving progress, resuming interrupted work, picking up where you left off, or checkpointing current work.