Communitygithub.com

Anhvu1107/all-agent-skill

ユーザーがNext.jsのベストプラクティスについて言及した場合、またはこのドメインにおけるビルド、デバッグ、レビュー、ドキュメント作成、自動化、テスト、設定、移行、意思決定のタスクを依頼した場合に常に使用します。スコープはNext.js App Routerの原則です。最終出力前に、バンドルされたワークフロー、リファレンス、スクリプト、シニアマスタースタンダード、Codexの厳格なレビューゲートを適用します。

all-agent-skill とは?

このスキルは、Next.js App Routerを利用した開発において、一貫性と高品質を保つためのベストプラクティス集です。開発者はプロジェクトのビルド、デバッグ、レビュー、テスト、設定、移行など、あらゆるタスクにおいてこのスキルを参照することで、Server ComponentsとClient Componentsの適切な使い分け、効率的なデータフェッチ、最適なルーティング設計、パフォーマンス改善、堅牢なエラーハンドリングといった重要な原則を適用できます。サポートするプラットフォームは特に限定されず、Next.jsプロジェクト全般で利用可能です。このスキルは、タスクの内容に応じて必要なドキュメント(シニアマスタースタンダード、ルーティング、品質チェックリストなど)を選択的に読み込む「選択的読み取りルール」を採用しており、過不足なく効率的に知識を活用できます。最終的には、バンドルされたワークフローと厳格なレビューゲートを通じて、プロフェッショナルな水準のアウトプットを保証します。

対応~Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/Anhvu1107/all-agent-skill/tree/HEAD/.agent/skills/nextjs-best-practices

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

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

ドキュメント

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

選択的読み取りルール

まずは以下から始めます:

  • references/senior-master-standard.md
  • references/usage-routing.md
  • references/quality-checklist.md

その後、ユーザーの実際のタスクに合致する継承ドキュメント、スクリプト、アセット、または例のみを読み込みます。

Next.js App Router 開発のための原則。


1. サーバーコンポーネントとクライアントコンポーネント

判断ツリー

何が必要か?
│
├── useState, useEffect, イベントハンドラ
│   └── クライアントコンポーネント ('use client')
│
├── データフェッチ、インタラクティブ不要
│   └── サーバーコンポーネント (デフォルト)
│
└── 両方?
    └── 分割: サーバー親 + クライアント子

デフォルト

タイプ用途
サーバーデータフェッチ、レイアウト、静的コンテンツ
クライアントフォーム、ボタン、インタラクティブUI

2. データフェッチパターン

フェッチ戦略

パターン用途
デフォルト静的 (ビルド時にキャッシュ)
RevalidateISR (時間ベースの更新)
No-store動的 (リクエストごと)

データフロー

ソースパターン
データベースサーバーコンポーネントでのfetch
APIキャッシュ付きのfetch
ユーザー入力クライアントステート + サーバーアクション

3. ルーティングの原則

ファイル規約

ファイル目的
page.tsxルートのUI
layout.tsx共有レイアウト
loading.tsxローディング状態
error.tsxエラーバウンダリ
not-found.tsx404ページ

ルートの構成

パターン用途
ルートグループ (名前)URLに影響なく整理
パラレルルート @スロット同一階層に複数ページ
インターセプト (.)モーダルオーバーレイ

4. APIルート

ルートハンドラ

メソッド用途
GETデータ取得
POSTデータ作成
PUT/PATCHデータ更新
DELETEデータ削除

ベストプラクティス

  • Zodで入力を検証する
  • 適切なステータスコードを返す
  • エラーを適切に処理する
  • 可能な場合はEdgeランタイムを使用する

5. パフォーマンスの原則

画像最適化

  • next/image コンポーネントを使用する
  • ファーストビューには priority を設定する
  • ブラーフォールバックを提供する
  • レスポンシブサイズを使用する

バンドル最適化

  • 重いコンポーネントには動的インポートを使用する
  • ルートベースのコード分割(自動)
  • バンドルアナライザーで分析する

6. メタデータ

静的 vs 動的

タイプ用途
静的エクスポート固定メタデータ
generateMetadataルートごとに動的生成

必須タグ

  • title (50-60文字)
  • description (150-160文字)
  • Open Graph 画像
  • 正規URL (Canonical URL)

7. キャッシュ戦略

キャッシュレイヤー

レイヤー制御
リクエストfetchオプション
データrevalidate/tags
フルルートルート設定

再検証 (Revalidation)

方法用途
時間ベースrevalidate: 60
オンデマンドrevalidatePath/Tag
キャッシュなしno-store

8. サーバーアクション

ユースケース

  • フォーム送信
  • データ変更
  • 再検証トリガー

ベストプラクティス

  • use server でマークする
  • すべての入力を検証する
  • 型付きレスポンスを返す
  • エラーを処理する

9. アンチパターン

❌ してはいけないこと✅ 推奨されること
あらゆる場所で use clientデフォルトでサーバー
クライアントコンポーネントでフェッチサーバーでフェッチ
ローディング状態をスキップloading.tsx を使用
エラーバウンダリを無視error.tsx を使用
大きなクライアントバンドル動的インポート

10. プロジェクト構造

app/
├── (marketing)/     # ルートグループ
│   └── page.tsx
├── (dashboard)/
│   ├── layout.tsx   # ダッシュボードレイアウト
│   └── page.tsx
├── api/
│   └── [resource]/
│       └── route.ts
└── components/
    └── ui/

覚えておいてください: サーバーコンポーネントがデフォルトであるのには理由があります。まずはそこから始め、必要な場合にのみクライアントを追加してください。

使用タイミング

このスキルは、概要で説明されているワークフローやアクションを実行する際に適用されます。

制限事項

  • タスクが上記のスコープに明確に合致する場合にのみこのスキルを使用してください。
  • 出力を、環境固有の検証、テスト、または専門家によるレビューの代替として扱わないでください。
  • 必要な入力、権限、安全境界、または成功基準が不足している場合は、立ち止まって明確化を求めてください。

Individual skills in this repo

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

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches 007: Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Agentfolio: Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Animejs Animation: Advanced JavaScript animation library skill for creating complex, high-performance web animations.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Astropy: Astropy is the core Python package for astronomy, providing essential functionality for astronomical research and data analysis.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Astro: Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Emotional ARC Designer: One sentence - what this skill does and when to invoke it

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Fixing Motion Performance: Audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches I18n Localization: Internationalization and localization patterns.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Interactive Portfolio: Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches JQ: Expert jq usage for JSON querying, filtering, transformation, and pipeline integration.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Landing Page Generator: Generates high-converting Next.js/React landing pages with Tailwind CSS.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches LEX: Centralized ''Truth Engine'' for cross-jurisdictional legal context (US, EU, CA) and contract scaffolding.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Magic Animator: AI-powered animation tool for creating motion in logos, UI, icons, and social media assets.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Makepad Animation: CRITICAL: Use for Makepad animation system.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Nextjs APP Router Patterns: Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.

Anhvu1107/all-agent-skill

description: ALWAYS use this when the work is specifically about modern Next.js or React architecture, data flow, rendering strategy, routing, or performance-sensitive frontend behavior.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Nextjs Supabase Auth: Expert integration of Supabase Auth with Next.js App Router

Anhvu1107/all-agent-skill

ALWAYS use this when the task involves reading, extracting, splitting, merging, rotating, creating, validating, OCR-ing, form-filling, or otherwise producing or modifying PDF files.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches React Nextjs Development: React and Next.js 14+ application development with App Router, Server Components, TypeScript, Tailwind CSS, and modern frontend patterns.

Anhvu1107/all-agent-skill

ALWAYS use this when working with Remotion code, video compositions, rendering logic, timing, media assets, or React-based motion workflows.

関連スキル