본문으로 건너뛰기
cccskills
무료GitHub에 공개한국어 소개

react-performance

React와 Next.js의 로딩과 조작 반응 속도를 점검하는 지침입니다. 데이터 요청 대기, 초기 JavaScript 용량, 반복 렌더링 등을 우선순위에 따라 살펴봅니다.

원문원문 설명 보기

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.

연동 도구Vercel
AI 평가100점/ 100설치 방법 보기

이럴 때 유용합니다

  • 페이지 로딩 지연 조사
  • 브라우저에 전달하는 JavaScript 용량 점검
  • 반복 렌더링과 조작 지연 줄이기
  • 성능에 영향을 주는 코드 변경 검토

한국어 소개

할 수 있는 일

react-performance는 화면 표시 속도와 조작 응답을 기준으로 React와 Next.js 코드를 점검하고 개선하는 지침을 제공합니다. 독립적인 데이터 요청을 차례로 기다리는 처리와 첫 화면에 전달하는 JavaScript 용량을 우선적으로 다룹니다. 서버 처리, 브라우저의 데이터 가져오기, 반복 렌더링, 긴 목록 표시 등 여덟 분야로 개선 패턴을 정리합니다.

이럴 때 유용합니다

페이지 로딩이 느리거나 입력과 클릭에 대한 반응이 무거운 문제를 조사할 때 적합합니다. 새 코드 작성, 기존 코드 수정, PR 검토에 사용할 수 있습니다. Lighthouse와 Web Vitals 지표에 따라 살펴볼 분야도 제시합니다.

사용 예시

  • “이 페이지에서 데이터 요청을 차례로 기다리는 부분을 검토해 주세요.”
  • “초기 로딩의 JavaScript 용량을 줄일 곳을 확인해 주세요.”
  • “불필요한 반복 렌더링을 조사하고 조작이 느린 부분을 개선해 주세요.”

주의 사항

React 18/19와 Next.js를 대상으로 하며 기능마다 지원 버전이 다릅니다. React Compiler 사용 시 계산 결과나 함수를 수동으로 재사용하는 최적화 규칙은 검토 중심으로 다룹니다. Vercel Labs의 MIT License 자료를 바탕으로 구성되었습니다.

이 소개문은 공개된 SKILL.md를 바탕으로 AI(OpenAI Codex)가 작성했습니다. 정확한 사양은 아래 원문을 확인하세요.

객관 평가

AI가 SKILL.md의 내용만을 근거로 4가지 관점에서 판정했습니다. 스타 수나 인기도는 판정에 넣지 않았습니다.

지시의 명확성언제 쓰고 무엇을 하는지 알 수 있는가
A양호로딩 지연과 반복 렌더링 조사 등의 사용 상황과 여덟 분야의 우선순위를 명시합니다.
절차의 구체성절차·입출력·예시가 구체적으로 적혀 있는가
A양호Promise.all, 동적 가져오기 등의 패턴에 코드 예제와 적용 조건이 있습니다.
안전성전송·삭제·명령 실행 등을 명시하고 있는가
A양호삭제를 수행하는 Server Actions 예제에서 실행 전 인증과 권한 확인을 명시합니다.
도입의 용이성필요한 도구나 API 키가 적고 적혀 있는가
A양호React 18/19와 Next.js를 대상으로 명시하며 추가 API 키나 유료 서비스를 요구하지 않습니다.

총점은 각 항목을 A=25점, B=15점, C=5점으로 더한 값입니다. 2026년 10월 19일 기준으로 AI(OpenAI Codex)가 판정했습니다. 참고용이므로 설치 전에 원문도 확인해 주세요.

평가가 다르다고 생각되면 재검토를 요청하기

어느 항목이 왜 다르다고 생각하는지 적어 주세요. 로그인은 필요 없습니다. SKILL.md와 대조해 평가를 다시 만들고 이곳에 반영합니다.

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

포함된 파일(1)

  • SKILL.md17.8 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

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

PriorityCategoryPrefixWhen it matters
1 — CRITICALEliminating Waterfallsasync-Anytime await is followed by independent await
2 — CRITICALBundle Size Optimizationbundle-First-load JS, route-level imports, third-party libs
3 — HIGHServer-Side Performanceserver-RSC, Server Actions, API routes, SSR
4 — MEDIUM-HIGHClient-Side Data Fetchingclient-SWR / TanStack Query / raw fetch in hooks
5 — MEDIUMRe-render Optimizationrerender-High-frequency state updates, parent-child fan-out
6 — MEDIUMRendering Performancerendering-Long lists, animations, hydration
7 — LOW-MEDIUMJavaScript Performancejs-Hot loops, frequent allocations
8 — LOWAdvanced Patternsadvanced-Effect-event integration, stable refs

1. Eliminating Waterfalls (CRITICAL)

"Waterfalls are the #1 performance killer" — every sequential await adds 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";
import { Modal } from "@/components/Modal";

Next.js 13.5+ has Optimize Package Imports that automates this for listed packages — use it; manual direct imports still required for non-listed libs.

Statically analyzable paths

// INCORRECT — defeats bundler/trace analysis
const mod = await import(`./pages/${name}`);

// CORRECT — explicit per branch
const mod = name === "home" ? await import("./pages/home") : await import("./pages/about");

Dynamic imports for heavy components

import dynamic from "next/dynamic";

const HeavyChart = dynamic(() => import("./HeavyChart"), {
  loading: () => <Skeleton />,
  ssr: false, // when client-only
});

Defer third-party scripts

Load analytics, logging, support widgets AFTER hydration. Use next/script with strategy="afterInteractive" (default) or "lazyOnload".

Conditional module loading

if (user.role === "admin") {
  const { AdminPanel } = await import("./admin/AdminPanel");
  // ...
}

Preload on hover/focus

Trigger <link rel="preload"> or import() on hover so the bundle is in cache by the time the user clicks.

3. Server-Side Performance (HIGH)

Authenticate Server Actions like API routes

Every "use server" function is a public endpoint. Authenticate AND authorize inside the action — never rely on the calling Client Component's gating.

"use server";
export async function deleteUser(formData: FormData) {
  const session = await getSession();
  if (!session?.user) throw new Error("Unauthorized");
  const targetId = String(formData.get("id"));
  if (session.user.role !== "admin" && session.user.id !== targetId) {
    throw new Error("Forbidden");
  }
  await db.user.delete({ where: { id: targetId } });
}

React.cache() for per-request deduplication

import { cache } from "react";

export const getUser = cache(async (id: string) => {
  return db.user.findUnique({ where: { id } });
});

React.cache dedupes within a single request. Calling getUser("1") from three Server Components in the same render = one DB query.

LRU cache for cross-request data

For data that does NOT change per request (config, lookup tables), cache outside React with an LRU cache or unstable_cache.

Avoid duplicate serialization in RSC props

When a Server Component renders the same data into multiple Client Components, the data is serialized once per consumer. Lift the Client Component up and pass children.

Hoist static I/O to module scope

// CORRECT — runs once at module load
const fontData = readFileSync(fontPath);

export async function Page() {
  return <Banner font={fontData} />;
}

No mutable module-level state in RSC/SSR

Module state on the server is shared across all requests — a race condition between users. Use request-scoped storage (headers(), cookies(), async context) instead.

Minimize data passed to Client Components

Only serialize what the Client needs. Strip fields, paginate, project columns at the DB layer.

Parallelize nested fetches with Promise.all per item

const users = await getUsers();
const enriched = await Promise.all(
  users.map(async (u) => ({ ...u, posts: await getPostsFor(u.id) })),
);

Use after() for non-blocking work

Next.js 15 after() runs work after the response is sent — logging, cache warming, analytics.

import { after } from "next/server";
export async function GET() {
  const data = await getData();
  after(() => logAnalytics(data));
  return Response.json(data);
}

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

SWR / TanStack Query for deduplication

Multiple components calling useUser(id) should share one network request and one cache entry. Use SWR or TanStack Query — never roll your own useEffect + fetch for shared data.

Deduplicate global event listeners

// INCORRECT — every component adds its own
useEffect(() => {
  window.addEventListener("scroll", handler);
  return () => window.removeEventListener("scroll", handler);
}, []);

// CORRECT — single shared listener via a hook + global subject
const useScroll = createScrollHook(); // singleton subject under the hood

Passive listeners for scroll

window.addEventListener("scroll", handler, { passive: true });

Improves scrolling smoothness; the listener cannot preventDefault().

localStorage: version + minimize

  • Always store a version field; bump on schema change and migrate or discard old data
  • Keep payloads small — localStorage is synchronous and blocks main thread

5. Re-render Optimization (MEDIUM)

Don't subscribe to state used only in callbacks

// INCORRECT — re-renders every time count changes
const count = useStore((s) => s.count);
const handler = () => doSomething(count);

// CORRECT — read once on call
const handler = () => {
  const count = useStore.getState().count;
  doSomething(count);
};

Extract expensive work into memoized components

// CORRECT — child re-renders only when `items` changes
const Heavy = memo(function Heavy({ items }: { items: Item[] }) {
  return <Chart data={transform(items)} />;
});

Hoist default non-primitive props

// INCORRECT — new array each render breaks memo
<List items={items ?? []} />

// CORRECT
const EMPTY: Item[] = [];
<List items={items ?? EMPTY} />

Primitive dependencies in effects

// INCORRECT — new object identity every render
useEffect(() => {}, [{ id, name }]);

// CORRECT — primitives
useEffect(() => {}, [id, name]);

Subscribe to derived booleans, not raw values

// INCORRECT — re-renders for any cart change
const cart = useStore((s) => s.cart);
const hasItems = cart.length > 0;

// CORRECT — re-renders only when emptiness flips
const hasItems = useStore((s) => s.cart.length > 0);

Derive during render, never via useEffect

// INCORRECT
const [full, setFull] = useState("");
useEffect(() => setFull(`${first} ${last}`), [first, last]);

// CORRECT
const full = `${first} ${last}`;

Functional setState for stable callbacks

// CORRECT
const increment = useCallback(() => setCount((c) => c + 1), []);

Lazy state initializer for expensive values

const [tree] = useState(() => parseTree(largeInput));

Avoid memo for simple primitives

useMemo(() => x + 1, [x]) is overhead. Memo earns its keep on object identity and expensive computation.

Split hooks with independent deps

// INCORRECT — both selectors re-run if either source changes
const { a, b } = useSomething(source1, source2);

// CORRECT
const a = useA(source1);
const b = useB(source2);

Move interaction logic into event handlers

Event handlers run only on the user action — useEffect re-runs whenever deps change.

startTransition for non-urgent updates

const [pending, startTransition] = useTransition();
startTransition(() => setFilters(newFilters));

useDeferredValue for expensive renders

const deferredQuery = useDeferredValue(query);
const results = useMemo(() => expensiveSearch(deferredQuery), [deferredQuery]);

useRef for transient frequent values

For values that change often but should not trigger re-render (timestamps, last-key, accumulators).

Don't define components inside components

// INCORRECT — Inner is a new component on every Outer render
function Outer() {
  const Inner = () => <span />;
  return <Inner />;
}

Each render makes a new Inner type, defeating reconciliation and unmounting children.

6. Rendering Performance (MEDIUM)

Animate the wrapper, not the SVG

Transforming a <div> wrapper around an SVG is GPU-accelerated; transforming the SVG itself triggers paint.

content-visibility: auto for long lists

.row { content-visibility: auto; contain-intrinsic-size: auto 80px; }

Browser skips offscreen rendering — major win for lists with hundreds of rows.

Hoist static JSX

const STATIC_HEADER = <h1>Title</h1>;
function Page() {
  return <>{STATIC_HEADER}<Body /></>;
}

SVG: reduce coordinate precision

d="M10.123456,20.654321" → d="M10.12,20.65". Each digit costs bytes; the visual difference is sub-pixel.

Hydration no-flicker via inline script

For values needed before hydration (theme, locale), inline a <script> that sets document.documentElement.dataset.* before React mounts.

Suppress expected hydration mismatches narrowly

<time suppressHydrationWarning>{new Date().toLocaleString()}</time>

Use ONLY for known-divergent leaf nodes — never on a tree containing other children.

<Activity> for show/hide instead of mount/unmount

React 19 <Activity mode="visible|hidden"> keeps tree state and effects mounted but hides — cheaper than unmount/remount for tabs and accordions.

Ternary over && for conditional render

// INCORRECT — `0` renders as text node
{count && <Badge>{count}</Badge>}

// CORRECT
{count > 0 ? <Badge>{count}</Badge> : null}

useTransition for loading states

Pair startTransition with the action; React shows the previous UI as isPending while the next state computes.

React DOM resource hints

import { preload, preconnect } from "react-dom";
preload("/api/critical", { as: "fetch" });
preconnect("https://api.example.com");

defer / async on <script> tags

defer for ordered execution after DOMContentLoaded; async for fire-and-forget.

7. JavaScript Performance (LOW-MEDIUM)

  • Batch DOM/CSS changes — apply via class swap or cssText, not property-by-property
  • Map for repeated lookups — O(1) vs O(n) linear scan
  • Cache property access in loops — const len = arr.length
  • Memoize pure functions — module-level Map<key, result>
  • Cache localStorage reads — sync API; one read per render
  • Combine filter().map() into one pass — flatMap or single for
  • Check array length first before expensive comparisons
  • Early return from functions
  • Hoist RegExp out of loops — compilation is not free
  • Loop for min/max instead of sort() — O(n) vs O(n log n)
  • Set/Map for membership — O(1) vs Array.includes O(n)
  • toSorted() over mutation when immutability matters
  • flatMap to map and filter in one pass
  • requestIdleCallback for non-critical work

8. Advanced Patterns (LOW)

useEffectEvent deps

Values from useEffectEvent are stable — do NOT add them to effect deps.

Event handler refs

For stable callbacks passed to memoized children:

const handlerRef = useRef(handler);
useEffect(() => { handlerRef.current = handler; });
const stable = useCallback((arg) => handlerRef.current(arg), []);

Init once per app load

For module-level singletons (telemetry, logger), guard with a module-scope flag — not useEffect.

useLatest for stable callback refs

function useLatest<T>(value: T) {
  const ref = useRef(value);
  ref.current = value;
  return ref;
}

Automated Tools

Many of these rules are now automated:

  • Next.js 13.5+ Optimize Package Imports — barrel import optimization
  • React Compiler (RFC, in canary) — auto-memoization
  • Turbopack — faster builds, better tree-shaking
  • Bundle Analyzer (@next/bundle-analyzer) — visualize first-load JS

When the project ships React Compiler, demote rerender-* manual memoization rules to "review-only" — the compiler handles them. Manual useMemo/useCallback becomes unnecessary noise.

Lighthouse / Web Vitals Mapping

MetricMost relevant categories
LCP (Largest Contentful Paint)Waterfalls, Bundle Size, Resource Hints
INP (Interaction to Next Paint)Re-render, Rendering, JavaScript
CLS (Cumulative Layout Shift)Rendering (Suspense placement, image dimensions)
TBT (Total Blocking Time)Bundle Size, JavaScript, Defer Third-Party
FID (legacy)Bundle Size, Hydration

Related

Attribution

Adapted from Vercel Labs react-best-practices skill (MIT License, copyright Vercel Engineering, v1.0.0 January 2026). Source: https://github.com/vercel-labs/agent-skills/tree/main/skills/react-best-practices.

This skill restructures and adapts the original 70-rule catalog into a single navigable reference. For the full original ruleset with extended examples, see the upstream repository.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Design and audit interfaces for Web, iOS, and Android using WCAG 2.2 accessibility guidance. Check screen-reader labels, keyboard navigation, contrast, and control sizes to identify barriers and guide implementation for people using assistive technology.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Adding descriptive labels to icon-only buttons
  • Reviewing keyboard navigation and modal focus
  • Checking contrast and control sizes
affaan-m/ECC28.3만2026년 10월 16일 업데이트

Investigate unreliable AI agents across 12 layers, including instructions, memory, tool execution, and display. Use code and logs to trace failures, rank findings by severity, and produce an ordered repair plan that prioritizes code changes.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Investigating failures that appear only inside an agent application
  • Tracing old conversation content leaking into new sessions
  • Checking skipped or falsely claimed tool execution
affaan-m/ECC28.3만2026년 10월 16일 업데이트

agent-eval

무료요약 있음AI 평가 80점

실제 개발 과제로 여러 코딩 에이전트를 비교합니다. 성공률, 확인 가능한 API 비용, 소요 시간과 반복 실행의 안정성을 측정해 도입 결정과 업데이트 후 평가에 활용합니다.

  • 실제 개발 과제로 에이전트를 비교합니다
  • 새 도구나 모델을 도입하기 전에 평가합니다
  • 에이전트 업데이트 후 성능을 확인합니다
affaan-m/ECC28.3만2026년 10월 16일 업데이트

Design and refine an AI agent’s available actions, tool inputs, and result formats. Define recovery steps for errors, manage the information kept in context, and evaluate changes through completion rates, retries, and cost per successful task.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Define an AI agent’s tool set and input formats
  • Make tool results and next steps easier to interpret
  • Specify safe retries and stopping conditions
affaan-m/ECC28.3만2026년 10월 16일 업데이트

Diagnose AI agent runs that fail repeatedly, loop through tools, or lose track of the task. Capture errors and environment details, test a focused recovery action, and produce a report explaining the evidence and outcome.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Diagnosing repeated failures in an agent run
  • Investigating loops through the same tool calls
  • Reviewing output degradation as context grows
affaan-m/ECC28.3만2026년 10월 5일 업데이트

agent-introspection-debugging

무료요약 있음AI 평가 100점

AI 에이전트의 반복 실패와 도구 사용을 기록하고 원인을 좁힙니다. 영향이 제한된 복구 작업과 결과 보고를 통해 근거 있는 재시도를 돕습니다.

  • 같은 도구 작업을 반복하는 원인 조사
  • 대화 증가에 따른 출력 품질 저하 조사
  • 파일 경로와 환경 불일치 확인
affaan-m/ECC28.3만2026년 10월 16일 업데이트

affaan-m의 스킬 모두 보기

이 스킬의 문제 신고