performance-optimization
Skill2 starsChanged 7 months agoMITView on GitHub
Frontend performance patterns — Core Web Vitals, bundle optimization, React rendering, lazy loading, memoization. Use when optimizing load times, investigating performance issues, or auditing before launch.
83 other projects use a version of this, 2 of them edited.
Adopted by
Most recently taken up by
- Lukk17/agent-standardstheir own version, first seen Oct 5, 2026
- GuillemRoca/agent-skills-androidtheir own version, first seen Oct 3, 2026
- addyosmani/agent-skillstheir own version, first seen Oct 3, 2026
- weisser-dev/agentic-skillstheir own version, first seen Oct 3, 2026
- Rvey/agent-engineering-kittheir own version, first seen Oct 1, 2026
- JPeetz/agent-skillstheir own version, first seen Sep 29, 2026
Used with
Projects with it also use constraint-driven-development, 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.
vinvcnSkillconstraint-driven-development
把一个项目的质量线确立为书面契约,并阻止 agent 悄悄降低它。通过访谈确定用户在意哪些维度,当用户心里没有数字时提供合理的默认阈值,把一切记录进 CONSTRAINTS.md,并盯住 diff 中质量线被削弱的迹象——新增的 @ts-ignore 或 eslint-disable 抑制注释、被跳过或删除的测试、被剥掉的断言、未实现的 stub、被调低的阈值。当没有任何质量线被写下来时使用;当用户说 "set up constraints" 或 "define our standards" 时;当用户希望把他们在意的维度——无障碍性、Web 性能、覆盖率——设置成被强制执行的约束时;当 agent 为了变绿不断静默检查或跳过测试时;当你需要一个覆盖率或性能阈值却不知道该选什么数字时;或者当 agent 写下的代码超出任何人会读的体量时。
Also in 4 projects that use this
LLl0k0laDSkillusing-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 21 projects that use this
LLl0k0laDSkillgit-workflow-and-versioning
Use when making any code change. Use when committing, branching, resolving conflicts, or when you need to organize work across multiple parallel streams.
Also in 23 projects that use this
borhen68Skillobservability-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 12 projects that use this
az9713Skilldeprecation-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 21 projects that use this
az9713Skillcode-simplification
Simplifies code for clarity. Use when refactoring code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be. Use when reviewing code that has accumulated unnecessary complexity.
Also in 29 projects that use this
- +6 more from LLl0k0laD
Other versions83 projects use a version of this.
Word for word · 0
None found.
Edited · 2
- rohitg00/awesome-claude-code-toolkit★ 2.7k11% same
- valentinesamuel/claude-skills★ 111% same
Wrote their own version · 81
- addyosmani/agent-skills★ 101ksame name
- gamedev-skills/awesome-gamedev-agent-skills★ 1.3ksame name
- ukanwat/overtime★ 387same name
- Mindrally/skills★ 266same name
- shashankswe2020-ux/whoop-mcp★ 165same name
- magnus919/agent-skills★ 109same name
- thiientv/godmode★ 96same name
- dylantarre/animation-principles★ 94same name
- DevelopersGlobal/ai-agent-skills★ 69same name
- thienanblog/awesome-ai-agent-skills★ 68same name
71 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository18 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- accessibilitySkill
- api-layerSkill
- auth-patternsSkill
- core-web-vitalsSkill
- css-architectureSkill
- design-intelligenceSkill
- error-handlingSkill
- frontend-designSkill
- i18nSkill
- monorepo-patternsSkill
- react-patternsSkill
- security-auditSkill
- seo-fundamentalsSkill
- state-managementSkill
- structured-dataSkill
- systematic-debuggingSkill
- testing-strategySkill
The file
Files
Performance Optimization
Core Web Vitals Targets
| Metric | Good | Needs Work | Poor |
| LCP (Largest Contentful Paint) | ≤ 2.5s | ≤ 4.0s | > 4.0s |
| INP (Interaction to Next Paint) | ≤ 200ms | ≤ 500ms | > 500ms |
| CLS (Cumulative Layout Shift) | ≤ 0.1 | ≤ 0.25 | > 0.25 |
Bundle Optimization
Code Splitting
import { lazy, Suspense } from 'react';
// Route-level splitting (mandatory)
const Dashboard = lazy(() => import('./pages/Dashboard'));
const Settings = lazy(() => import('./pages/Settings'));
// Component-level splitting (for heavy components)
const MarkdownEditor = lazy(() => import('./components/MarkdownEditor'));
const ChartWidget = lazy(() => import('./components/ChartWidget'));
// Always wrap with Suspense + meaningful fallback
<Suspense fallback={<DashboardSkeleton />}>
<Dashboard />
</Suspense>Tree-Shaking
// BAD: imports entire library
import _ from 'lodash';
_.debounce(fn, 300);
// GOOD: imports only what's needed
import debounce from 'lodash/debounce';
debounce(fn, 300);
// BEST: use native or lightweight alternative
function debounce<T extends (...args: unknown[]) => void>(fn: T, ms: number) {
let timer: ReturnType<typeof setTimeout>;
return (...args: Parameters<T>) => {
clearTimeout(timer);
timer = setTimeout(() => fn(...args), ms);
};
}Import Analysis
# Analyze bundle composition
npx vite-bundle-visualizer # Vite
npx @next/bundle-analyzer # Next.js
# Find heavy dependencies
du -sh node_modules/* | sort -rh | head -20React Rendering Optimization
When to Memoize
// MEMOIZE: Expensive computation
const sortedItems = useMemo(
() => items.sort((a, b) => b.date - a.date),
[items]
);
// MEMOIZE: Referential stability for child components
const handleSubmit = useCallback(
(data: FormData) => {
submitMutation.mutate(data);
},
[submitMutation.mutate]
);
// DON'T MEMOIZE: Simple computation
// const fullName = useMemo(() => `${first} ${last}`, [first, last]);
const fullName = `${first} ${last}`; // Just compute it
// DON'T MEMOIZE: Primitive props
// const title = useMemo(() => 'Hello', []);
const title = 'Hello'; // Primitives are already stableRule of thumb: Profile first, memoize second. useMemo/useCallback add complexity — use only when measured impact.
Preventing Unnecessary Re-renders
// BAD: New object every render
<UserCard style={{ marginTop: 16 }} />
// GOOD: Stable reference
const cardStyle = { marginTop: 16 } as const; // Outside component
<UserCard style={cardStyle} />
// BAD: Inline function creates new reference
<List onItemClick={(id) => navigate(`/item/${id}`)} />
// GOOD: Stable callback
const handleItemClick = useCallback(
(id: string) => navigate(`/item/${id}`),
[navigate]
);
<List onItemClick={handleItemClick} />Virtualization for Long Lists
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: () => 64, // Estimated row height
overscan: 5,
});
return (
<div ref={parentRef} className="h-[600px] overflow-auto">
<div style={{ height: `${virtualizer.getTotalSize()}px`, position: 'relative' }}>
{virtualizer.getVirtualItems().map((virtualItem) => (
<div
key={virtualItem.key}
style={{
position: 'absolute',
top: 0,
transform: `translateY(${virtualItem.start}px)`,
height: `${virtualItem.size}px`,
width: '100%',
}}
>
<ItemRow item={items[virtualItem.index]} />
</div>
))}
</div>
</div>
);
}Use virtualization when: List has 100+ items, or items are complex components.
Image Optimization
// Next.js Image (automatic optimization)
import Image from 'next/image';
<Image
src="/hero.jpg"
alt="Hero banner showing the product dashboard"
width={1200}
height={600}
priority // LCP image: preload it
placeholder="blur" // Show blur while loading
/>
// Non-Next.js: native lazy loading
<img
src="/photo.jpg"
alt="Team photo"
loading="lazy" // Browser-native lazy loading
decoding="async" // Non-blocking decode
width={400}
height={300} // Always set dimensions (CLS prevention)
/>Font Loading
/* Preload critical fonts */
<link rel="preload" href="/fonts/inter-var.woff2" as="font" type="font/woff2" crossorigin>
@font-face {
font-family: 'Inter';
src: url('/fonts/inter-var.woff2') format('woff2');
font-display: swap; /* Show fallback immediately, swap when loaded */
font-weight: 100 900;
}Network Performance
// Parallel fetching instead of sequential
// BAD: waterfall
const user = await fetchUser(id);
const posts = await fetchPosts(id);
const comments = await fetchComments(id);
// GOOD: parallel
const [user, posts, comments] = await Promise.all([
fetchUser(id),
fetchPosts(id),
fetchComments(id),
]);
// Prefetching on hover
function NavLink({ href, children }: NavLinkProps) {
const queryClient = useQueryClient();
return (
<Link
href={href}
onMouseEnter={() => {
queryClient.prefetchQuery({
queryKey: ['page', href],
queryFn: () => fetchPageData(href),
});
}}
>
{children}
</Link>
);
}Performance Checklist
- Route-level code splitting for all pages
- Images optimized: lazy loading, proper dimensions, modern formats
- Fonts: preloaded,
font-display: swap - No unnecessary re-renders (profile with React DevTools)
- Long lists virtualized (100+ items)
- API calls parallelized where possible
- Third-party scripts deferred/async
- Bundle analyzed for unnecessary dependencies
- CLS: all images/embeds have dimensions
- LCP element identified and optimized
Integration with Other Skills
- react-patterns: Component structure affects rendering
- state-management: Store selectors prevent re-renders
- css-architecture: CSS strategy affects paint performance
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
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.

