Vercel react best practices

From jh941213/my-cc-harness · View interactive version

Vercel react best practices is an AI agent skill from the GitHub repository jh941213/my-cc-harness. Use when writing, reviewing or refactoring React/Next.js code for performance: rendering, data fetching, bundle size.

How to use this skill

Skill file

Vercel React Best Practices

Performance guide for React and Next.js applications: 51 rules in 8 categories, prioritized by impact.

Each rule's full explanation and incorrect/correct examples are in rules/<rule-name>.md in this skill folder. Read only the rules that apply to the code at hand.

When to Apply

Reference these guidelines when:

Rule Categories by Priority

| Priority | Category | Impact | Prefix |

|----------|----------|--------|--------|

| 1 | Eliminating Waterfalls | CRITICAL | async- |

| 2 | Bundle Size Optimization | CRITICAL | bundle- |

| 3 | Server-Side Performance | HIGH | server- |

| 4 | Client-Side Data Fetching | MEDIUM-HIGH | client- |

| 5 | Re-render Optimization | MEDIUM | rerender- |

| 6 | Rendering Performance | MEDIUM | rendering- |

| 7 | JavaScript Performance | LOW-MEDIUM | js- |

| 8 | Advanced Patterns | LOW | advanced- |

Quick Reference

1. Eliminating Waterfalls (CRITICAL)

2. Bundle Size Optimization (CRITICAL)

3. Server-Side Performance (HIGH)

4. Client-Side Data Fetching (MEDIUM-HIGH)

5. Re-render Optimization (MEDIUM)

6. Rendering Performance (MEDIUM)

7. JavaScript Performance (LOW-MEDIUM)

8. Advanced Patterns (LOW)

자주 쓰는 규칙 예시

async-parallel (CRITICAL)
// BAD: 순차 실행
const users = await getUsers();
const posts = await getPosts();

// GOOD: 병렬 실행
const [users, posts] = await Promise.all([getUsers(), getPosts()]);
bundle-barrel-imports (CRITICAL)
// BAD: 배럴 파일에서 import (트리쉐이킹 실패)
import { Button } from '@/components';

// GOOD: 직접 import
import { Button } from '@/components/ui/button';
rerender-memo (MEDIUM)
// BAD: 부모 리렌더링 시 매번 재계산
function Parent() {
  const [count, setCount] = useState(0);
  return <><ExpensiveList /><button onClick={() => setCount(c+1)} /></>;
}

// GOOD: memo로 격리
const ExpensiveList = React.memo(function ExpensiveList() { ... });
server-cache-react (HIGH)
// React.cache()로 요청 단위 중복 제거
const getUser = React.cache(async (id: string) => {
  return await db.user.findUnique({ where: { id } });
});

코드 작성·리뷰 때는 위 Priority 표의 CRITICAL → HIGH 순서로 적용한다. 성능 개선을 주장할 때는 측정(번들 분석, React Profiler, Lighthouse 등)이나 코드 근거를 함께 보고한다.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.