🛠️ React Best Practices
ReactやNext.jsを使ったウェブサイトやアプリケーションを、
📺 まず動画で見る(YouTube)
▶ 【衝撃】最強のAIエージェント「Claude Code」の最新機能・使い方・プログラミングをAIで効率化する超実践術を解説! ↗
※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。
📜 元の英語説明(参考)
Comprehensive performance optimization guide for React and Next.js applications, maintained by Vercel. Use when writing new React components or Next.js pages, implementing data fetching (client or server-side), or reviewing code for performance issues.
🇯🇵 日本人クリエイター向け解説
ReactやNext.jsを使ったウェブサイトやアプリケーションを、
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o react-best-practices.zip https://jpskill.com/download/3358.zip && unzip -o react-best-practices.zip && rm react-best-practices.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/3358.zip -OutFile "$d\react-best-practices.zip"; Expand-Archive "$d\react-best-practices.zip" -DestinationPath $d -Force; ri "$d\react-best-practices.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
react-best-practices.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
react-best-practicesフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-17
- 取得日時
- 2026-05-17
- 同梱ファイル
- 2
💬 こう話しかけるだけ — サンプルプロンプト
- › React Best Practices を使って、最小構成のサンプルコードを示して
- › React Best Practices の主な使い方と注意点を教えて
- › React Best Practices を既存プロジェクトに組み込む方法を教えて
これをClaude Code に貼るだけで、このSkillが自動発動します。
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Vercel React ベストプラクティス
Vercel が管理する、React および Next.js アプリケーション向けの包括的なパフォーマンス最適化ガイドです。自動リファクタリングとコード生成をガイドするために、影響度によって優先順位付けされた、8 つのカテゴリにわたる 45 のルールが含まれています。
使用する場面
以下の状況でこれらのガイドラインを参照してください。
- 新しい React コンポーネントまたは Next.js ページを作成する場合
- データフェッチ(クライアント側またはサーバー側)を実装する場合
- パフォーマンスの問題がないかコードをレビューする場合
- 既存の React/Next.js コードをリファクタリングする場合
- バンドルサイズまたはロード時間を最適化する場合
優先度別のルールカテゴリ
| 優先度 | カテゴリ | 影響度 | プレフィックス |
|---|---|---|---|
| 1 | ウォーターフォールの排除 | CRITICAL | async- |
| 2 | バンドルサイズの最適化 | CRITICAL | bundle- |
| 3 | サーバーサイドのパフォーマンス | HIGH | server- |
| 4 | クライアントサイドのデータフェッチ | MEDIUM-HIGH | client- |
| 5 | 再レンダリングの最適化 | MEDIUM | rerender- |
| 6 | レンダリングのパフォーマンス | MEDIUM | rendering- |
| 7 | JavaScript のパフォーマンス | LOW-MEDIUM | js- |
| 8 | 高度なパターン | LOW | advanced- |
クイックリファレンス
1. ウォーターフォールの排除 (CRITICAL)
async-defer-await-awaitを実際に使用されるブランチに移動するasync-parallel- 独立した操作にはPromise.all()を使用するasync-dependencies- 部分的な依存関係にはbetter-allを使用するasync-api-routes- API ルートではプロミスを早期に開始し、遅延してawaitするasync-suspense-boundaries-Suspenseを使用してコンテンツをストリーミングする
2. バンドルサイズの最適化 (CRITICAL)
bundle-barrel-imports- バレルファイルを避け、直接インポートするbundle-dynamic-imports- 重いコンポーネントにはnext/dynamicを使用するbundle-defer-third-party- ハイドレーション後にアナリティクス/ロギングをロードするbundle-conditional- 機能がアクティブ化された場合にのみモジュールをロードするbundle-preload- 知覚的な速度のためにホバー/フォーカス時にプリロードする
3. サーバーサイドのパフォーマンス (HIGH)
server-cache-react- リクエストごとの重複排除にはReact.cache()を使用するserver-cache-lru- リクエスト間のキャッシュには LRU キャッシュを使用するserver-serialization- クライアントコンポーネントに渡されるデータを最小限にするserver-parallel-fetching- フェッチを並列化するためにコンポーネントを再構築するserver-after-nonblocking- ノンブロッキング操作にはafter()を使用する
4. クライアントサイドのデータフェッチ (MEDIUM-HIGH)
client-swr-dedup- 自動リクエスト重複排除には SWR を使用するclient-event-listeners- グローバルイベントリスナーを重複排除する
5. 再レンダリングの最適化 (MEDIUM)
rerender-defer-reads- コールバックでのみ使用される状態を購読しないrerender-memo- 高コストな処理をメモ化されたコンポーネントに抽出するrerender-dependencies- エフェクトではプリミティブな依存関係を使用するrerender-derived-state- 生の値ではなく、派生したブール値を購読するrerender-functional-setstate- 安定したコールバックには関数型setStateを使用するrerender-lazy-state-init- 高コストな値にはuseStateに関数を渡すrerender-transitions- 緊急性の低い更新にはstartTransitionを使用する
6. レンダリングのパフォーマンス (MEDIUM)
rendering-animate-svg-wrapper- SVG 要素ではなく、div ラッパーをアニメーション化するrendering-content-visibility- 長いリストにはcontent-visibilityを使用するrendering-hoist-jsx- 静的な JSX をコンポーネントの外に抽出するrendering-svg-precision- SVG 座標の精度を減らすrendering-hydration-no-flicker- クライアント専用データにはインラインスクリプトを使用するrendering-activity- 表示/非表示には Activity コンポーネントを使用するrendering-conditional-render- 条件式には&&ではなく三項演算子を使用する
7. JavaScript のパフォーマンス (LOW-MEDIUM)
js-batch-dom-css- クラスまたはcssTextを介して CSS 変更をグループ化するjs-index-maps- 繰り返し検索のために Map を構築するjs-cache-property-access- ループ内でオブジェクトプロパティをキャッシュするjs-cache-function-results- モジュールレベルの Map で関数結果をキャッシュするjs-cache-storage-localStorage/sessionStorageの読み取りをキャッシュするjs-combine-iterations- 複数のfilter/mapを 1 つのループに結合するjs-length-check-first- 高コストな比較の前に配列の長さをチェックするjs-early-exit- 関数から早期にリターンするjs-hoist-regexp- ループの外で RegExp の作成をホイストするjs-min-max-loop-sortの代わりにループで最小/最大を求めるjs-set-map-lookups- O(1) 検索には Set/Map を使用するjs-tosorted-immutable- 不変性にはtoSorted()を使用する
8. 高度なパターン (LOW)
advanced-event-handler-refs- イベントハンドラーをrefsに保存するadvanced-use-latest- 安定したコールバックrefsにuseLatestを使用する
使用方法
詳細な説明とコード例については、個々のルールファイルを読んでください。
rules/async-parallel.md
rules/bundle-barrel-imports.md
rules/_sections.md
各ルールファイルには以下が含まれています。
- なぜそれが重要なのかについての簡単な説明
- 誤ったコード例とその説明
- 正しいコード例とその説明
- 追加のコンテキストと参照
完全なコンパイル済みドキュメント
すべてのルールが展開された完全なガイドについては、AGENTS.md を参照してください。
使用する場面
このスキルは、概要に記載されているワークフローまたはアクションを実行するのに適用できます。
制限事項
- このスキルは、タスクが上記の範囲と明確に一致する場合にのみ使用してください。
- 出力を、環境固有の検証、テスト、または専門家によるレビューの代わりとして扱わないでください。
- 必要な入力、権限、安全境界、または成功基準が不足している場合は、停止して明確化を求めてください。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Vercel React Best Practices
Comprehensive performance optimization guide for React and Next.js applications, maintained by Vercel. Contains 45 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
When to Use
Reference these guidelines when:
- Writing new React components or Next.js pages
- Implementing data fetching (client or server-side)
- Reviewing code for performance issues
- Refactoring existing React/Next.js code
- Optimizing bundle size or load times
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)
async-defer-await- Move await into branches where actually usedasync-parallel- Use Promise.all() for independent operationsasync-dependencies- Use better-all for partial dependenciesasync-api-routes- Start promises early, await late in API routesasync-suspense-boundaries- Use Suspense to stream content
2. Bundle Size Optimization (CRITICAL)
bundle-barrel-imports- Import directly, avoid barrel filesbundle-dynamic-imports- Use next/dynamic for heavy componentsbundle-defer-third-party- Load analytics/logging after hydrationbundle-conditional- Load modules only when feature is activatedbundle-preload- Preload on hover/focus for perceived speed
3. Server-Side Performance (HIGH)
server-cache-react- Use React.cache() for per-request deduplicationserver-cache-lru- Use LRU cache for cross-request cachingserver-serialization- Minimize data passed to client componentsserver-parallel-fetching- Restructure components to parallelize fetchesserver-after-nonblocking- Use after() for non-blocking operations
4. Client-Side Data Fetching (MEDIUM-HIGH)
client-swr-dedup- Use SWR for automatic request deduplicationclient-event-listeners- Deduplicate global event listeners
5. Re-render Optimization (MEDIUM)
rerender-defer-reads- Don't subscribe to state only used in callbacksrerender-memo- Extract expensive work into memoized componentsrerender-dependencies- Use primitive dependencies in effectsrerender-derived-state- Subscribe to derived booleans, not raw valuesrerender-functional-setstate- Use functional setState for stable callbacksrerender-lazy-state-init- Pass function to useState for expensive valuesrerender-transitions- Use startTransition for non-urgent updates
6. Rendering Performance (MEDIUM)
rendering-animate-svg-wrapper- Animate div wrapper, not SVG elementrendering-content-visibility- Use content-visibility for long listsrendering-hoist-jsx- Extract static JSX outside componentsrendering-svg-precision- Reduce SVG coordinate precisionrendering-hydration-no-flicker- Use inline script for client-only datarendering-activity- Use Activity component for show/hiderendering-conditional-render- Use ternary, not && for conditionals
7. JavaScript Performance (LOW-MEDIUM)
js-batch-dom-css- Group CSS changes via classes or cssTextjs-index-maps- Build Map for repeated lookupsjs-cache-property-access- Cache object properties in loopsjs-cache-function-results- Cache function results in module-level Mapjs-cache-storage- Cache localStorage/sessionStorage readsjs-combine-iterations- Combine multiple filter/map into one loopjs-length-check-first- Check array length before expensive comparisonjs-early-exit- Return early from functionsjs-hoist-regexp- Hoist RegExp creation outside loopsjs-min-max-loop- Use loop for min/max instead of sortjs-set-map-lookups- Use Set/Map for O(1) lookupsjs-tosorted-immutable- Use toSorted() for immutability
8. Advanced Patterns (LOW)
advanced-event-handler-refs- Store event handlers in refsadvanced-use-latest- useLatest for stable callback refs
How to Use
Read individual rule files for detailed explanations and code examples:
rules/async-parallel.md
rules/bundle-barrel-imports.md
rules/_sections.md
Each rule file contains:
- Brief explanation of why it matters
- Incorrect code example with explanation
- Correct code example with explanation
- Additional context and references
Full Compiled Document
For the complete guide with all rules expanded: AGENTS.md
When to Use
This skill is applicable to execute the workflow or actions described in the overview.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (5,649 bytes)
- 📎 README.md (3,360 bytes)