react-19-patterns
Comprehensive React 19 patterns including all hooks, Server/Client Components, Suspense, streaming, and transitions. Ensures correct React 19 usage with TypeScript.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o react-19-patterns.zip https://jpskill.com/download/17466.zip && unzip -o react-19-patterns.zip && rm react-19-patterns.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17466.zip -OutFile "$d\react-19-patterns.zip"; Expand-Archive "$d\react-19-patterns.zip" -DestinationPath $d -Force; ri "$d\react-19-patterns.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
react-19-patterns.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
react-19-patternsフォルダができる - 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-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
React 19 パターン - 包括的なガイド
この Skill を使用するタイミング
この Skill は、以下の場合に使用します。
- React コンポーネントの記述時(Server または Client)
- React hooks の使用時(標準または新しい React 19 hooks)
- Server Actions を使用したフォームの実装時
- Suspense およびストリーミングの操作時
- 状態とトランジションの管理時
- 楽観的な UI 更新
- React 18 から React 19 への移行時
この Skill でカバーする内容
コアパターン
- Server vs Client Components - 完全な決定木
- All React Hooks - TypeScript を使用した完全なリファレンス
- Suspense Patterns - Boundaries、ストリーミング、エラー処理
- Server Components - データフェッチ、キャッシュ、コンポジション
- Client Components - インタラクティビティ、状態、エフェクト
- Transitions - useTransition、startTransition、isPending
- Streaming - プログレッシブレンダリングパターン
- Migration Guide - React 18 → React 19
React 19 の新機能
use()- コンポーネント内の非同期データ用useOptimistic()- 楽観的な UI 更新用useFormStatus()- フォーム送信状態用useActionState()- Server Action 状態用- 強化された
useTransition()- パフォーマンスの向上 - 改善されたエラー boundaries
- より良い hydration
クイックリファレンス
Server Component Pattern
// ✅ Default - async data fetching
export default async function ProjectsPage() {
const projects = await db.project.findMany()
return <ProjectList projects={projects} />
}
Client Component Pattern
// ✅ Use 'use client' for interactivity
'use client'
import { useState } from 'react'
export function InteractiveComponent() {
const [count, setCount] = useState(0)
return <button onClick={() => setCount(count + 1)}>{count}</button>
}
New React 19 Hook Pattern
'use client'
import { useOptimistic } from 'react'
export function TodoList({ todos }: Props) {
const [optimisticTodos, addOptimisticTodo] = useOptimistic(
todos,
(state, newTodo: string) => [...state, { id: 'temp', text: newTodo, pending: true }]
)
return (
<form action={async (formData) => {
addOptimisticTodo(formData.get('todo'))
await createTodo(formData)
}}>
<input name="todo" />
<button type="submit">Add</button>
</form>
)
}
ファイル構造
この Skill は、詳細なガイドに整理されています。
- server-vs-client.md - コンポーネントタイプの決定木
- hooks-complete.md - TypeScript を使用したすべての React hooks
- suspense-patterns.md - Suspense boundaries とストリーミング
- server-components-complete.md - Server Component パターン
- client-components-complete.md - Client Component パターン
- transitions.md - useTransition と並行機能
- streaming-patterns.md - プログレッシブレンダリング
- migration-guide.md - React 18 → 19 移行
- validate-react.py - React ルールの検証ツール
決定フロー
START: Creating new component
│
├─ Does it need interactivity (onClick, onChange)?
│ ├─ YES → Read client-components-complete.md
│ └─ NO → Continue
│
├─ Does it need React hooks (useState, useEffect)?
│ ├─ YES → Read client-components-complete.md + hooks-complete.md
│ └─ NO → Continue
│
├─ Does it fetch data?
│ ├─ YES → Read server-components-complete.md
│ └─ NO → Continue
│
└─ Default → Server Component (read server-components-complete.md)
Need specific hook help?
└─ Read hooks-complete.md (complete reference)
Need Suspense/streaming?
└─ Read suspense-patterns.md + streaming-patterns.md
Need optimistic UI?
└─ Read hooks-complete.md (useOptimistic section)
Need form handling?
└─ Read hooks-complete.md (useFormStatus, useActionState)
Migrating from React 18?
└─ Read migration-guide.md
防止される一般的な間違い
❌ Async Client Component
'use client'
export default async function Bad() {} // ERROR!
✅ Use Server Component or useEffect
// Option 1: Server Component
export default async function Good() {} // ✅
// Option 2: Client with useEffect
'use client'
export default function Good() {
useEffect(() => {
fetchData()
}, [])
}
❌ Hooks in Conditions
if (condition) {
useState(0) // ERROR: Rules of Hooks violation
}
✅ Hooks at Top Level
const [value, setValue] = useState(0)
if (condition) {
// Use the hook result here
}
❌ Browser APIs in Server Component
export default function Bad() {
const data = localStorage.getItem('key') // ERROR!
return <div>{data}</div>
}
✅ Use Client Component
'use client'
export default function Good() {
const [data, setData] = useState(() =>
localStorage.getItem('key')
)
return <div>{data}</div>
}
バリデーション
validate-react.py を使用して React コードをチェックします。
# Validate single file
python .claude/skills/react-19-patterns/validate-react.py src/components/Button.tsx
# Validate directory
python .claude/skills/react-19-patterns/validate-react.py src/components/
# Auto-fix (where possible)
python .claude/skills/react-19-patterns/validate-react.py --fix src/components/
以下の項目をチェックします。
- Rules of Hooks の違反
- Server/Client コンポーネントの間違い
- 'use client' ディレクティブの欠落
- 無効な非同期 Client Components
- Server Components での Browser API の使用
- Client Components への非シリアライズ可能な props
ベストプラクティス
-
Server Components をデフォルトにする
- より良いパフォーマンス(クライアントへの JS なし)
- 直接的なデータアクセス
- SEO に優しい
-
Client Components は控えめに使用する
- インタラクティビティが必要な場合のみ
- 小さく保つ
- バンドルサイズを最小限に抑える
-
Server + Client を構成する
- Server Components でデータをフェッチする
- Client Components に props として渡す
- 両方の長所を生かす
-
新しい React 19 Hooks を使用する
use()で非同期データを扱うuseOptimistic()で即時のフィードバックを得るuseFormStatus()でフォームの状態を管理するuseActionState()で Server Actions を扱う
-
Suspense を活用する
- データを段階的にストリーミングする
- 知覚されるパフォーマンスの向上
- Par
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
React 19 Patterns - Comprehensive Guide
When to Use This Skill
Use this skill when:
- Writing React components (Server or Client)
- Using React hooks (standard or new React 19 hooks)
- Implementing forms with Server Actions
- Working with Suspense and streaming
- Managing state and transitions
- Optimistic UI updates
- Migrating from React 18 to React 19
What This Skill Covers
Core Patterns
- Server vs Client Components - Complete decision tree
- All React Hooks - Complete reference with TypeScript
- Suspense Patterns - Boundaries, streaming, error handling
- Server Components - Data fetching, caching, composition
- Client Components - Interactivity, state, effects
- Transitions - useTransition, startTransition, isPending
- Streaming - Progressive rendering patterns
- Migration Guide - React 18 → React 19
New in React 19
use()- For async data in componentsuseOptimistic()- For optimistic UI updatesuseFormStatus()- For form submission stateuseActionState()- For Server Action state- Enhanced
useTransition()- Better performance - Improved error boundaries
- Better hydration
Quick Reference
Server Component Pattern
// ✅ Default - async data fetching
export default async function ProjectsPage() {
const projects = await db.project.findMany()
return <ProjectList projects={projects} />
}
Client Component Pattern
// ✅ Use 'use client' for interactivity
'use client'
import { useState } from 'react'
export function InteractiveComponent() {
const [count, setCount] = useState(0)
return <button onClick={() => setCount(count + 1)}>{count}</button>
}
New React 19 Hook Pattern
'use client'
import { useOptimistic } from 'react'
export function TodoList({ todos }: Props) {
const [optimisticTodos, addOptimisticTodo] = useOptimistic(
todos,
(state, newTodo: string) => [...state, { id: 'temp', text: newTodo, pending: true }]
)
return (
<form action={async (formData) => {
addOptimisticTodo(formData.get('todo'))
await createTodo(formData)
}}>
<input name="todo" />
<button type="submit">Add</button>
</form>
)
}
File Structure
This skill is organized into detailed guides:
- server-vs-client.md - Decision tree for component type
- hooks-complete.md - All React hooks with TypeScript
- suspense-patterns.md - Suspense boundaries and streaming
- server-components-complete.md - Server Component patterns
- client-components-complete.md - Client Component patterns
- transitions.md - useTransition and concurrent features
- streaming-patterns.md - Progressive rendering
- migration-guide.md - React 18 → 19 migration
- validate-react.py - Validation tool for React rules
Decision Flow
START: Creating new component
│
├─ Does it need interactivity (onClick, onChange)?
│ ├─ YES → Read client-components-complete.md
│ └─ NO → Continue
│
├─ Does it need React hooks (useState, useEffect)?
│ ├─ YES → Read client-components-complete.md + hooks-complete.md
│ └─ NO → Continue
│
├─ Does it fetch data?
│ ├─ YES → Read server-components-complete.md
│ └─ NO → Continue
│
└─ Default → Server Component (read server-components-complete.md)
Need specific hook help?
└─ Read hooks-complete.md (complete reference)
Need Suspense/streaming?
└─ Read suspense-patterns.md + streaming-patterns.md
Need optimistic UI?
└─ Read hooks-complete.md (useOptimistic section)
Need form handling?
└─ Read hooks-complete.md (useFormStatus, useActionState)
Migrating from React 18?
└─ Read migration-guide.md
Common Mistakes Prevented
❌ Async Client Component
'use client'
export default async function Bad() {} // ERROR!
✅ Use Server Component or useEffect
// Option 1: Server Component
export default async function Good() {} // ✅
// Option 2: Client with useEffect
'use client'
export default function Good() {
useEffect(() => {
fetchData()
}, [])
}
❌ Hooks in Conditions
if (condition) {
useState(0) // ERROR: Rules of Hooks violation
}
✅ Hooks at Top Level
const [value, setValue] = useState(0)
if (condition) {
// Use the hook result here
}
❌ Browser APIs in Server Component
export default function Bad() {
const data = localStorage.getItem('key') // ERROR!
return <div>{data}</div>
}
✅ Use Client Component
'use client'
export default function Good() {
const [data, setData] = useState(() =>
localStorage.getItem('key')
)
return <div>{data}</div>
}
Validation
Use validate-react.py to check your React code:
# Validate single file
python .claude/skills/react-19-patterns/validate-react.py src/components/Button.tsx
# Validate directory
python .claude/skills/react-19-patterns/validate-react.py src/components/
# Auto-fix (where possible)
python .claude/skills/react-19-patterns/validate-react.py --fix src/components/
Checks for:
- Rules of Hooks violations
- Server/Client component mistakes
- Missing 'use client' directives
- Invalid async Client Components
- Browser API usage in Server Components
- Non-serializable props to Client Components
Best Practices
-
Default to Server Components
- Better performance (no JS to client)
- Direct data access
- SEO friendly
-
Use Client Components Sparingly
- Only when interactivity needed
- Keep them small
- Minimize bundle size
-
Compose Server + Client
- Fetch data in Server Components
- Pass as props to Client Components
- Best of both worlds
-
Use New React 19 Hooks
use()for async datauseOptimistic()for instant feedbackuseFormStatus()for form statesuseActionState()for Server Actions
-
Leverage Suspense
- Stream data progressively
- Better perceived performance
- Parallel data loading
Resources
- React 19 Docs: https://react.dev/
- Server Components: https://react.dev/reference/rsc/server-components
- React 19 Changelog: https://react.dev/blog/2024/12/05/react-19
- Hooks API: https://react.dev/reference/react/hooks
- Server Actions: https://react.dev/reference/rsc/server-actions
Quick Links
- Server vs Client Decision Tree
- All Hooks Reference
- Suspense Patterns
- Server Components Guide
- Client Components Guide
- Transitions Guide
- Streaming Patterns
- Migration Guide
- Validation Tool
Last Updated: 2025-11-23 React Version: 19.2.0 Next.js Version: 15.5