nextjs-expert
できること
このスキルは、App Router、サーバーコンポーネント、データ取得、キャッシュ、デプロイを含め、Next.jsでのWebアプリ構築を案内します。高速で検索に強いWebサイトやWebアプリを作る開発者向けです。
使う場面
- ✓新しいNext.jsアプリを始めるとき、またはApp Routerに移行するとき。
- ✓ページの読み込みが遅く、クライアント側のJavaScriptを減らしたいとき。
- ✓Next.jsプロジェクトでAPIルートやミドルウェアが必要なとき。
スキルのリンク
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/nextjs-expert/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“Next.jsのApp Routerのページを設定してください。商品データはサーバーで読み込み、取得中はローディング状態を表示してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このスキルは、デフォルトでサーバーコンポーネントを使うこと、フォルダーベースのルート、ローディングとエラーの境界、ルートハンドラーを推奨します。静的レンダリングとオンデマンドレンダリングの選択肢も扱います。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Next.js Expert
A seasoned Next.js architect with deep expertise in the App Router paradigm, server-side rendering strategies, and production deployment patterns. This skill provides guidance on building performant, SEO-friendly web applications using Next.js 14+ conventions, including Server Components, Streaming, and the full spectrum of data fetching and caching mechanisms.
Key Principles
- Prefer Server Components by default; only add "use client" when the component requires browser APIs, event handlers, or React state
- Leverage the app/ directory structure where each folder segment maps to a URL route, using layout.tsx for shared UI and page.tsx for unique content
- Design data fetching at the server layer using async Server Components and fetch with Next.js caching semantics
- Use generateStaticParams for static pre-rendering of dynamic routes at build time, falling back to on-demand ISR for long-tail pages
- Keep client bundles small by pushing logic into Server Components and using dynamic imports for heavy client-only libraries
Techniques
- Structure routes with app/[segment]/page.tsx, using route groups (parentheses) to organize without affecting URL paths
- Implement loading.tsx and error.tsx boundaries at each route segment to provide instant loading states and graceful error recovery
- Use Route Handlers (app/api/.../route.ts) with exported GET, POST, PUT, DELETE functions for API endpoints
- Configure middleware in middleware.ts at the project root with a matcher config to intercept requests for auth, redirects, or header injection
- Optimize images with next/image (automatic srcSet, lazy loading, AVIF/WebP) and fonts with next/font (zero layout shift, self-hosted subsets)
- Enable ISR by returning revalidate values from fetch calls or using revalidatePath/revalidateTag for on-demand cache invalidation
- Set up next.config.js with redirects, rewrites, headers, and the experimental options appropriate to your deployment target
Common Patterns
- Parallel Routes: Use @named slots in layouts to render multiple page-level components simultaneously, enabling dashboards and split views
- Intercepting Routes: Place (..) convention routes to show modals on navigation while preserving the direct URL as a full page
- Server Actions: Define async functions with "use server" for form submissions and mutations without building separate API routes
- Streaming with Suspense: Wrap slow data-fetching components in Suspense boundaries to stream HTML progressively and improve TTFB
Pitfalls to Avoid
- Do not use useEffect for data fetching in Server Components; fetch directly in the component body or use server-side utilities
- Do not place "use client" at the layout level unless every child truly requires client interactivity, as this opts out the entire subtree from server rendering
- Do not confuse the Pages Router (pages/ directory) patterns with App Router conventions; they have different data fetching and routing models
- Do not skip setting proper cache headers and revalidation times, as stale data and unnecessary re-renders degrade both performance and user experience
よくある質問
サーバーコンポーネントとは何ですか?
サーバー上で動くコンポーネントです。ブラウザーに余分なコードを送らずに、データを取得できます。
use clientはいつ追加すべきですか?
ブラウザーの機能、イベントハンドラー、Reactの状態が必要なコンポーネントに限るべきだとこのスキルは述べています。
loading.tsxとerror.tsxは何をしますか?
ルートの読み込み中にはローディング状態を、エラーが起きたときにはわかりやすいメッセージを表示します。
詳細
作者による元の説明
Next.js expert for App Router, SSR/SSG, API routes, middleware, and deployment
repo: RightNow-AI/openfang
人気
- GitHubのスター
- 18k
- ランキング
- #10692
- ライセンス
- Apache-2.0
- 更新日
- 2026/7/2
コメント
- …
このリポジトリの他のスキル
browser-automation
18kエージェントが、Playwrightを使ってWebブラウザーを操作するよう教えます。CSSセレクターでボタン、フォーム、リンクを見つけます。
clip-hand-skill
18kエージェントが、動画のクリップを作るのを助けます。動画をダウンロードし、音声を文字起こしし、字幕ファイルを作り、ffmpegでクリップを切り出します。
collector-hand-skill
18kエージェントが、トピックや企業に関する公開情報を集め、主要な実体を抽出し、変化を追い、感情を測るのを助けます。
infisical-sync-skill
18kエージェントが、APIを通じてInfisicalの保管庫の秘密情報を読み、更新するのを助けます。ログインの手順と明確なエラー処理を含みます。
似ているスキル
angular-developer
280kエージェントがAngularのコードを作成し、プロジェクト構成についてアドバイスできるようにします。新しいプロジェクトの開始、コード部品の作成、パフォーマンスやアクセシビリティの改善に役立ちます。
frontend-a11y
280kエージェントが Web インターフェースを誰にとっても使いやすくするよう支援します。スクリーンリーダーやキーボード操作に対応し、サイトやアプリが適切に動作するようにします。
frontend-patterns
280kエージェントがフロントエンド開発の最新パターンを適用できるようにします。React と Next.js において、パフォーマンスの最適化、状態管理、ベストプラクティスの遵守を行います。