react-performance
What it does
This agent helps optimize the performance of websites built with React and Next.js. It organizes over 70 rules to make your code faster and more efficient.
When to use it
- βWhen writing or reviewing React/Next.js code.
- βWhen a website is slow to load or respond.
- βTo reduce the size of files downloaded by the browser.
Skill link
https://github.com/affaan-m/ECC/blob/main/pi/core/skills/react-performance/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βHow can I optimize image loading on my React website?β
5 new skills a week. 1 minute to read.
How it works
It analyzes your code and suggests improvements based on high-performance engineering patterns. The rules are divided by importance, from critical to advanced.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
React Performance
Performance optimization patterns for React 18/19 and Next.js, adapted from Vercel Labs react-best-practices (MIT, v1.0.0). This skill organizes rules by priority and provides decision-tree guidance for active code review and refactoring.
When to Activate
- Writing or reviewing React/Next.js code for performance
- Diagnosing slow page loads, slow interactions, or high CPU on the client
- Auditing bundle size or Lighthouse Core Web Vitals regressions
- Removing waterfalls in Server Components / API routes
- Reducing client-side re-renders
- Optimizing long lists, animations, or hydration
- Auditing optimization choices in PRs touching
app/,pages/,components/, or data layers
Priority Index
| Priority | Category | Prefix | When it matters |
|---|---|---|---|
| 1 β CRITICAL | Eliminating Waterfalls | async- |
Anytime await is followed by independent await |
| 2 β CRITICAL | Bundle Size Optimization | bundle- |
First-load JS, route-level imports, third-party libs |
| 3 β HIGH | Server-Side Performance | server- |
RSC, Server Actions, API routes, SSR |
| 4 β MEDIUM-HIGH | Client-Side Data Fetching | client- |
SWR / TanStack Query / raw fetch in hooks |
| 5 β MEDIUM | Re-render Optimization | rerender- |
High-frequency state updates, parent-child fan-out |
| 6 β MEDIUM | Rendering Performance | rendering- |
Long lists, animations, hydration |
| 7 β LOW-MEDIUM | JavaScript Performance | js- |
Hot loops, frequent allocations |
| 8 β LOW | Advanced Patterns | advanced- |
Effect-event integration, stable refs |
1. Eliminating Waterfalls (CRITICAL)
"Waterfalls are the #1 performance killer" β every sequential
awaitadds full network latency.
Cheap conditions before await
Check sync conditions (props, env, hardcoded flags) before awaiting remote data.
// INCORRECT
async function Page({ id }: { id: string }) {
const flag = await getFlag("show-page");
if (!flag || !id) return null;
const data = await getData(id);
// ...
}
// CORRECT β short-circuit on cheap sync condition first
async function Page({ id }: { id: string }) {
if (!id) return null;
const flag = await getFlag("show-page");
if (!flag) return null;
const data = await getData(id);
}
Defer awaits until used
Move await into the branch that uses it.
// INCORRECT β awaits before deciding it needs the data
const user = await getUser(id);
if (mode === "guest") return renderGuest();
return renderUser(user);
// CORRECT
if (mode === "guest") return renderGuest();
const user = await getUser(id);
return renderUser(user);
Promise.all for independent work
// INCORRECT β sequential
const user = await getUser(id);
const posts = await getPosts(id);
const followers = await getFollowers(id);
// CORRECT β parallel
const [user, posts, followers] = await Promise.all([
getUser(id),
getPosts(id),
getFollowers(id),
]);
Partial dependencies β start early, await late
// CORRECT β kick off all promises, await only when each result is needed
const userP = getUser(id);
const postsP = getPosts(id);
const profile = await getProfile(id);
if (profile.private) return null;
const [user, posts] = await Promise.all([userP, postsP]);
Suspense for streaming
Push <Suspense> boundaries close to the data so the page paints what it can while slower sub-trees stream in. The trade-off: layout shift when content arrives β reserve space (skeleton or min-height).
Server Components: parallel through composition
// INCORRECT β sibling awaits run sequentially inside one component
export default async function Page() {
const user = await getUser();
const cart = await getCart();
return <View user={user} cart={cart} />;
}
// CORRECT β split into children, React runs them in parallel
export default async function Page() {
return (
<View>
<UserSection />
<CartSection />
</View>
);
}
2. Bundle Size Optimization (CRITICAL)
Direct imports, not barrels
Barrel index.ts files force the bundler to walk the entire module graph even when tree-shaking removes most of it. Direct imports save 200-800ms of first-load JS in many real-world apps.
// INCORRECT
import { Button, Card, Modal } from "@/components";
// CORRECT
import { Button } from "@/components/Button";
import { Card } from "@/components/Card";
β¦
FAQ
What are 'waterfalls'?
These are sequential calls that delay loading. The agent helps make these calls in parallel to speed things up.
What is 'bundle size'?
It's the total size of JavaScript files the browser needs to download. Reducing this makes the website faster, especially on slow connections.
Do I need to know a lot about React to use this?
No, the agent explains concepts simply and focuses on applying best practices to improve performance.
Details
Original description by the author
React and Next.js performance optimization patterns adapted from Vercel Engineering's React Best Practices (https://github.com/vercel-labs/agent-skills). Organizes 70+ rules across 8 priority categories β waterfalls, bundle size, server-side, client fetching, re-render, rendering, JS micro-perf, advanced. Use when writing, reviewing, or refactoring React/Next.js code for performance.
repo: affaan-m/ECC
Popularity
- GitHub stars
- 280k
- Ranking position
- #238
- License
- MIT
- Updated
- 10/15/2026
Comments
- β¦
More skills from this repository
accessibility
280kHelps your agent create interfaces that everyone can use. Ensures websites and apps work well for people with disabilities, like those who are blind or have reduced mobility.
agent-architecture-audit
280kMakes your agent check if everything is working correctly. It finds and fixes problems in AI systems, ensuring they perform as expected.
agent-eval
280kHelps your agent compare different AI coding tools. It measures which one is faster, cheaper, and more reliable for specific tasks.
agent-harness-construction
280kMakes your agent better understand how to perform tasks. It optimizes the tools and instructions the agent uses to increase its chances of success.
Similar skills
dream-loop
260kLets your agent push a 3D scene or visual app toward high graphical quality by comparing its screenshots to concept art and iterating.
pretext
260kBuilds playful browser demos where text reflows around moving shapes, forms game levels, or breaks apart into particles.
page-agent
260kHelps your agent add a built-in AI assistant to a web app, so users can give plain-language commands that the page carries out.