Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/farzannajipour/cursor-react-rules/performance-optimizationgit clone --depth 1 https://github.com/Farzannajipour/cursor-react-rulesWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.00813 |
| Opus 5 | $0.00000 | $0.00407 |
| Sonnet 5 | $0.00000 | $0.00163 |
| Haiku 4.5 | $0.00000 | $0.00081 |
Grade A, and why
performance-optimization scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
fetch(url, { How it starts
The opening of the file, as written. The whole thing — 152 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Performance Optimization Patterns
React Performance Rules
1. Memoization
Use React.memo() for expensive pure components:
export const ExpensiveComponent = memo<Props>(({ data }) => {
return <div>{/* expensive rendering */}</div>;
});
Use useMemo() for expensive calculations:
const sortedData = useMemo(() => {
return data.sort((a, b) => a.value - b.value);
}, [data]);
Use useCallback() for function props:
const handleClick = useCallback((id: string) => {
// handler logic
}, []);
2. Code Splitting
Use React.lazy() for route-based splitting:
const Dashboard = lazy(() => import('@/components/Dashboard'));
<Suspense fallback={<Loading />}>
<Dashboard />
</Suspense>
Use dynamic imports for large libraries:
// Only load when needed
const loadChart = async () => {
const Chart = await import('chart.js');
return Chart;
};
3. List Optimization
Always use stable keys:
// ✅ Good - stable ID
{items.map(item => <Item key={item.id} {...item} />)}
// ❌ Bad - index as key
{items.map((item, i) => <Item key={i} {...item} />)}
Virtualize long lists:
import { useVirtualizer } from '@tanstack/react-virtual';
const virtualizer = useVirtualizer({
count: items.length,
getScrollElement: () => parentRef.current,
estimateSize: () => 50,
});
Next.js Specific Optimizations
Image Optimization
import Image from 'next/image';
// Use priority for above-the-fold images
<Image src="/hero.jpg" alt="Hero" width={1200} height={600} priority />
// Lazy load below-the-fold
<Image src="/product.jpg" alt="Product" width={400} height={400} loading="lazy" />
Font Optimization
import { Inter } from 'next/font/google';
const inter = Inter({ subsets: ['latin'], display: 'swap' });
<main className={inter.className}>{children}</main>
Caching Strategies
// Static Generation with revalidation
export const revalidate = 3600; // 1 hour
// Fetch with caching
fetch(url, {
next: { revalidate: 3600, tags: ['posts'] }
});
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 152 lines · 0 tokens per session scan A fb59857d0c22
performance-optimization is a cursor rule published in the GitHub repository Farzannajipour/cursor-react-rules (2 stars, last pushed 7mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 813 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other cursor rules, from other repositories
webkit-browser
Cursor rule "webkit-browser" from duckduckgo/apple-browsers, covering webkit & browser development guidelines, webview configuration, basic webview setup, user scripts management and tab management.
cypress-e2e-testing-cursorrules-prompt-file
Cursor rules for Cypress development with E2E testing.
vasu-playwright-utils
../../templates/cursor-rules/vasu-playwright-utils.mdc.
dev-browser
Fallback browser automation with persistent Chrome state. Use only when Browser Use is unavailable or blocked.
node-dependencies
Enforce Node.js versioning and package management best practices.
security-standards
Cursor rule "security-standards" from wjgogogo/cursor-rules, covering 安全规范, 核心原则 [p0], 输入验证, xss 防护 and csrf 防护.