スキル一覧に戻る
BenWork17

developing-nextjs-apps

by BenWork17

0🍴 0📅 2026年1月21日
GitHubで見るManusで実行

SKILL.md


name: developing-nextjs-apps description: Manages Next.js 14+ application development, including App Router, Server Components, rendering strategies (SSR, SSG, ISR), and performance optimization. Use when working on Next.js frontend tasks.

Developing Next.js Apps

This skill provides comprehensive guidance and standards for building production-grade Next.js 14+ applications using the App Router.

Core Architecture (App Router)

  • React Server Components (RSC): Used by default for all components in app/. Keep client-side JavaScript minimal.
  • Client Components: Use 'use client' only when interactivity (hooks like useState, useEffect) or browser APIs are required.
  • Layouts & Nesting: Use layout.tsx for shared UI across routes. Layouts do not re-render on navigation.
  • Streaming & Suspense: Implement loading.tsx or <Suspense> to stream UI sections as they become ready.

Rendering Strategies

StrategyImplementationUse Case
Static (SSG)Default behaviorMarketing pages, blogs, docs.
Dynamic (SSR)Use cookies(), headers(), or searchParamsUser dashboards, search results.
Incremental (ISR)fetch(url, { next: { revalidate: 60 } })E-commerce, news, content with periodic updates.

Data Fetching & Mutations

  • Server-side Fetching: Fetch data directly in async Server Components.
  • Caching: Next.js extends fetch to cache results. Use revalidatePath or revalidateTag to purge cache.
  • Server Actions: Define 'use server' functions for mutations (form submissions).
  • Parallel Fetching: Initiate multiple requests at once to avoid waterfalls:
    const [dataA, dataB] = await Promise.all([getDataA(), getDataB()]);
    

Optimization Standards

  • Images: Use next/image for automatic optimization, lazy loading, and preventing layout shifts.
  • Fonts: Use next/font for zero layout shift and local hosting of Google Fonts.
  • Links: Use next/link for prefetching and client-side navigation.
  • Middleware: Use middleware.ts for auth, redirects, and header manipulation at the edge.

File System Conventions

  • page.tsx: Unique UI of a route.
  • layout.tsx: Shared UI for a segment and its children.
  • loading.tsx: Loading UI for a segment.
  • error.tsx: Error UI for a segment.
  • not-found.tsx: UI for 404 pages within a segment.
  • route.ts: Custom request handlers (API endpoints).

Best Practices

  1. Keep Server Components Pure: Move interactivity to small, leaf-level Client Components.
  2. SEO: Use the Metadata API (export const metadata = {...}).
  3. Environment Variables: process.env for server, NEXT_PUBLIC_ for client.
  4. Error Boundaries: Always wrap dynamic sections in error.tsx to prevent full-page crashes.

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です