Communitygithub.com

Geruyang/agent-skills-library

Next.js App Router 専門知識ガイド。Next.js アプリケーションの構築、デバッグ、アーキテクチャ設計(ルーティング、Server Components、Server Actions、Cache Components、レイアウト、ミドルウェア/プロキシ、データフェッチ、レンダリング戦略、Vercel へのデプロイ)に使用します。

agent-skills-library とは?

このスキルは、Next.js App Router アプリケーションを開発するためのベストプラクティス集です。ルーティング、React Server Components (RSC) の境界特定、非同期パターン、ランタイム選択(Node.js または Edge)、ディレクティブ('use client', 'use server', 'use cache')、ナビゲーションフックやサーバー関数などの関数、エラーハンドリング、データフェッチパターン、ルートハンドラ、メタデータ、画像最適化、フォント最適化、バンドル、スクリプト、ハイドレーションエラー、Suspense 境界、パラレルルート、セルフホスティング、デバッグテクニックなど、Next.js 開発の主要なトピックを網羅しています。各トピックに対応する詳細なリファレンスドキュメントへのリンクが提供されており、開発者は必要な情報に素早くアクセスできます。このスキルは、Claude Code、Cursor、Codex などの AI エージェントと連携し、Next.js コードの作成、レビュー、デバッグを支援します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Geruyang/agent-skills-library/tree/HEAD/original-skills/x-openai-nextjs-0babc94

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Next.js ベストプラクティス

Next.js コードを作成またはレビューする際は、以下のルールを適用してください。

ファイル規約

file-conventions.md を参照:

  • プロジェクト構造と特殊ファイル
  • ルートセグメント(動的、キャッチオール、グループ)
  • パラレルルートとインターセプトルート
  • v16 でのミドルウェアの名称変更(middleware → proxy)

RSC 境界

無効な React Server Component パターンを検出します。

rsc-boundaries.md を参照:

  • 非同期クライアントコンポーネントの検出(無効)
  • シリアライズ不可なプロパティの検出
  • Server Action 例外

非同期パターン

Next.js 15+ の非同期 API 変更。

async-patterns.md を参照:

  • 非同期 params と searchParams
  • 非同期 cookies() と headers()
  • 移行用 codemod

ランタイム選択

runtime-selection.md を参照:

  • デフォルトは Node.js ランタイム
  • Edge ランタイムが適切な場合

ディレクティブ

directives.md を参照:

  • 'use client'、'use server'(React)
  • 'use cache'(Next.js)

関数

functions.md を参照:

  • ナビゲーションフック: useRouter、usePathname、useSearchParams、useParams
  • サーバー関数: cookies、headers、draftMode、after
  • 生成関数: generateStaticParams、generateMetadata

エラーハンドリング

error-handling.md を参照:

  • error.tsx、global-error.tsx、not-found.tsx
  • redirect、permanentRedirect、notFound
  • forbidden、unauthorized(認証エラー)
  • catch ブロックでの unstable_rethrow

データパターン

data-patterns.md を参照:

  • Server Components vs Server Actions vs Route Handlers
  • データウォーターフォールの回避(Promise.all、Suspense、preload)
  • クライアントコンポーネントのデータフェッチ

ルートハンドラ

route-handlers.md を参照:

  • route.ts の基本
  • GET ハンドラと page.tsx の競合
  • 環境動作(React DOM なし)
  • Server Actions との使い分け

メタデータと OG 画像

metadata.md を参照:

  • 静的および動的メタデータ
  • generateMetadata 関数
  • next/og を用いた OG 画像生成
  • ファイルベースのメタデータ規約

画像最適化

image.md を参照:

  • <img> の代わりに常に next/image を使用
  • リモート画像の設定
  • レスポンシブ sizes 属性
  • ブラー画像プレースホルダー
  • LCP のための優先読み込み

フォント最適化

font.md を参照:

  • next/font のセットアップ
  • Google Fonts、ローカルフォント
  • Tailwind CSS との統合
  • サブセットのプリロード

バンドル

bundling.md を参照:

  • サーバー非互換パッケージ
  • CSS インポート(link タグは不可)
  • ポリフィル(既に含まれています)
  • ESM/CommonJS の問題
  • バンドル分析

スクリプト

scripts.md を参照:

  • next/script vs ネイティブ script タグ
  • インラインスクリプトには id が必要
  • 読み込み戦略
  • @next/third-parties を用いた Google Analytics

ハイドレーションエラー

hydration-error.md を参照:

  • 一般的な原因(ブラウザ API、日付、無効な HTML)
  • エラーオーバーレイによるデバッグ
  • 各原因に対する修正

Suspense 境界

suspense-boundaries.md を参照:

  • useSearchParams と usePathname による CSR ベイルアウト
  • Suspense 境界が必要なフック

パラレルルートとインターセプトルート

parallel-routes.md を参照:

  • @slot と (.) インターセプターを用いたモーダルパターン
  • フォールバック用 default.tsx
  • router.back() を用いた正しいモーダル閉じ操作

セルフホスティング

self-hosting.md を参照:

  • Docker 用 output: 'standalone'
  • マルチインスタンス ISR 用キャッシュハンドラ
  • 動作するものと追加設定が必要なもの

デバッグテクニック

debug-tricks.md を参照:

  • AI 支援デバッグ用 MCP エンドポイント
  • --debug-build-paths を用いた特定ルートの再構築

Individual skills in this repo

This repo contains 12 individual skills — each has its own dedicated page.

Geruyang/agent-skills-library

Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.

Geruyang/agent-skills-library

Set up Tailwind CSS v4 in Expo with react-native-css and NativeWind v5 for universal styling

Geruyang/agent-skills-library

Use for new frontend applications, dashboards, games, creative websites, hero sections, and visually driven UI from scratch, or when the user explicitly asks for a redesign/restyle/modernization. Builds from clean, airy, high-taste, readable image-generated concept design with section-specific references, faithful implementation, and browser testing.

Geruyang/agent-skills-library

Use when testing, debugging, or making targeted improvements to rendered frontend apps through the Build Web Apps or web dev plugin: local dev servers, UI regressions, interaction bugs, console errors, responsive layout, and visual QA. Check whether the Browser plugin is available and use it first when it is; otherwise use regular Playwright with the recorded reason.

Geruyang/agent-skills-library

Design UI surfaces for browser games. Use when the user asks for HUDs, menus, overlays, responsive layouts, or visual direction that must protect the playfield.

Geruyang/agent-skills-library

GSAP animation reference for HyperFrames. Covers gsap.to(), from(), fromTo(), easing, stagger, defaults, timelines (gsap.timeline(), position parameter, labels, nesting, playback), and performance (transforms, will-change, quickTo). Use when writing GSAP animations in HyperFrames compositions.

Geruyang/agent-skills-library

Guide for building, configuring, and deploying microfrontends on Vercel. Use this skill when the user mentions microfrontends, multi-zones, splitting an app across teams, independent deployments, cross-app routing, incremental migration, composing multiple frontends under one domain, microfrontends.json, @vercel/microfrontends, the microfrontends local proxy, or path-based routing between Vercel projects. Also use when the user asks about shared layouts across projects, navigation between microfrontends, fallback environments, asset prefixes, or feature flag controlled routing.

Geruyang/agent-skills-library

Use when sizing Public Equity Investing positions, finding equity hedges, or building an integrated position-and-hedge risk plan from a listed-equity thesis. Do not use for thesis construction, standalone event underwriting, trade execution, personal investment advice, or credit-instrument risk.

Geruyang/agent-skills-library

Integrate data visualizations into React and Next.js applications. Use when the user needs chart components, UML-like or architecture diagram components, React integration patterns, Next.js client or server boundaries, hydration-safe rendering, lazy loading, framework-aware performance, scroll-driven visual stories, or export guidance.

Geruyang/agent-skills-library

shadcn/ui expert guidance — CLI, component installation, composition patterns, custom registries, theming, Tailwind CSS integration, and high-quality interface design. Use when initializing shadcn, adding components, composing product UI, building custom registries, configuring themes, or troubleshooting component issues.

Geruyang/agent-skills-library

v0 by Vercel expert guidance. Use when discussing AI code generation, generating UI components from prompts, v0 CLI usage, v0 SDK/API integration, or integrating v0 into development workflows with GitHub and Vercel deployment.

Geruyang/agent-skills-library

Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI. Provides project context, component docs, and usage examples. Applies when working with shadcn/ui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for "shadcn init", "create an app with --preset", or "switch to --preset".

関連スキル