
performance-optimization
Web performance optimization including bundle analysis, lazy loading, caching strategies, and Core Web Vitals
- Installs
- 187
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/rohitg00/awesome-claude-code-toolkit --skill performance-optimization- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads performance-optimization automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Performance Optimization
Bundle Analysis and Code Splitting
// Dynamic import for route-level code splitting
const Dashboard = lazy(() => import("./pages/Dashboard"));
const Settings = lazy(() => import("./pages/Settings"));
function App() {
return (
<Suspense fallback={<PageSkeleton />}>
<Routes>
<Route path="/dashboard" element={<Dashboard />} />
<Route path="/settings" element={<Settings />} />
</Routes>
</Suspense>
);
}
// vite.config.ts - manual chunk splitting
export default defineConfig({
build: {
rollupOptions: {
output: {
manualChunks: {
vendor: ["react", "react-dom"],
charts: ["recharts", "d3"],
editor: ["@monaco-editor/react"],
},
},
},
},
});
# Analyze bundle composition
npx vite-bundle-visualizer
npx source-map-explorer dist/assets/*.js
Image Optimization
import Image from "next/image";
function ProductImage({ src, alt }: { src: string; alt: string }) {
return (
<Image
src={src}
alt={alt}
width={800}
height={600}
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"
placeholder="blur"
blurDataURL={generateBlurHash(src)}
loading="lazy"
/>
);
}
<!-- Native lazy loading with aspect ratio -->
<img
src="product.webp"
alt="Product photo"
width="800"
height="600"
loading="lazy"
decoding="async"
fetchpriority="low"
/>
<!-- Preload LCP image -->
<link rel="preload" as="image" href="/hero.webp" fetchpriority="high" />
Caching Headers
function setCacheHeaders(res: Response, options: CacheOptions) {
if (options.immutable) {
res.setHeader("Cache-Control", "public, max-age=31536000, immutable");
return;
}
if (options.revalidate) {
res.setHeader("Cache-Control", `public, max-age=0, s-maxage=${options.revalidate}, stale-while-revalidate=${options.staleWhileRevalidate ?? 86400}`);
return;
}
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
}
app.use("/assets", (req, res, next) => {
setCacheHeaders(res, { immutable: true });
next();
});
app.use("/api", (req, res, next) => {
setCacheHeaders(res, { revalidate: 60, staleWhileRevalidate: 3600 });
next();
});
Virtual Lists for Large Data
import { useVirtualizer } from "@tanstack/react-virtual";
function VirtualList({ items }: { items: Item[] }) {
const parentRef = useRef<HTMLDivElement>(null);
const virtualizer = useVirtualizer({
count: items.length,
getScrollElement: () => parentRef.current,
estimateSize: () => 50,
overscan: 5,
});
return (
<div ref={parentRef} style={{ height: "600px", overflow: "auto" }}>
<div style={{ height: `${virtualizer.getTotalSize()}px`, position: "relative" }}>
{virtualizer.getVirtualItems().map((virtualRow) => (
<div
key={virtualRow.key}
style={{
position: "absolute",
top: 0,
transform: `translateY(${virtualRow.start}px)`,
height: `${virtualRow.size}px`,
width: "100%",
}}
>
<ItemRow item={items[virtualRow.index]} />
</div>
))}
</div>
</div>
);
}
Core Web Vitals Monitoring
import { onCLS, onINP, onLCP } from "web-vitals";
function sendMetric(metric: { name: string; value: number; id: string }) {
navigator.sendBeacon("/api/vitals", JSON.stringify(metric));
}
onCLS(sendMetric);
onINP(sendMetric);
onLCP(sendMetric);
- LCP (Largest Contentful Paint): < 2.5s. Preload hero images, optimize server response time.
- INP (Interaction to Next Paint): < 200ms. Avoid long tasks, use
requestIdleCallback. - CLS (Cumulative Layout Shift): < 0.1. Set explicit dimensions on images and embeds.
Anti-Patterns
- Loading all JavaScript upfront instead of code-splitting by route
- Serving unoptimized images (no WebP/AVIF, no responsive sizes)
- Missing
widthandheighton images (causes layout shift) - Using
Cache-Control: no-cacheon static assets with content hashes - Rendering thousands of DOM nodes instead of virtualizing lists
- Blocking the main thread with synchronous computation
Checklist
- Routes lazy-loaded with dynamic
import()and Suspense - Bundle analyzed and vendor chunks separated
- Images served in WebP/AVIF with responsive
sizesattribute - LCP image preloaded with
fetchpriority="high" - Static assets cached with immutable headers and content hashes
- Lists with 100+ items use virtualization
- Core Web Vitals monitored in production (LCP, INP, CLS)
- No render-blocking resources in the critical path
FAQ
What does the performance-optimization skill do?
Web performance optimization including bundle analysis, lazy loading, caching strategies, and Core Web Vitals
How do I install performance-optimization?
Run npx skills add https://github.com/rohitg00/awesome-claude-code-toolkit --skill performance-optimization in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/performance-optimization/ (personal) or .claude/skills/performance-optimization/ (project).
Which AI agents can use performance-optimization?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is performance-optimization safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains performance-optimization?
It is published by rohitg00 in rohitg00/awesome-claude-code-toolkit. It has 187 recorded installs.
More from rohitg00/awesome-claude-code-toolkit
devops-automation
rohitg00/awesome-claude-code-toolkit
CI/CD pipeline design with GitHub Actions, Docker, Kubernetes, Helm, and GitOps patterns
accessibility-wcag
rohitg00/awesome-claude-code-toolkit
Web accessibility patterns for WCAG 2.2 compliance including ARIA, keyboard navigation, screen readers, and testing
database-optimization
rohitg00/awesome-claude-code-toolkit
Query optimization, indexing strategies, and database performance tuning for PostgreSQL and MySQL
react-patterns
rohitg00/awesome-claude-code-toolkit
React 19 patterns including Server Components, Actions, Suspense, hooks, and component composition
websocket-realtime
rohitg00/awesome-claude-code-toolkit
Real-time communication patterns with WebSocket, Socket.io, Server-Sent Events, and scaling strategies
python-best-practices
rohitg00/awesome-claude-code-toolkit
Pythonic code with modern type hints, dataclasses, async patterns, packaging, and testing
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.