nextjs

Guide Next.js v15+ app development with App Router and Server Components.

Updated Jul 23, 2025
One-click install
npx skills add https://github.com/levanminhduc/LuongHoaThoNew --skill nextjs-levanminhduc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs
Source: https://github.com/levanminhduc/LuongHoaThoNew/tree/main/.claude/skills/nextjs
Command: npx skills add https://github.com/levanminhduc/LuongHoaThoNew --skill nextjs-levanminhduc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides guidance for building modern Next.js applications, focusing on App Router, server components, data fetching, routing, and performance optimization.

Core Features & Use Cases

  • App Router guidance: Architecture and routing patterns for scalable apps.
  • Server Components: How to structure server vs client components for performance.
  • Production readiness: Data fetching, caching, and image optimization guidance.

Quick Start

Create a production-ready Next.js project with App Router structure and a basic page that fetches data from a route.

Frequently Asked Questions about nextjs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up routing in a Next.js app with App Router?

App Router uses file-based routing in the app directory. Create folders for routes and place page.tsx files inside them; Next.js automatically maps folder structure to URL paths. Nested folders create nested routes, and special files like layout.tsx define shared UI across routes.

What's the difference between Server Components and Client Components in Next.js?

Server Components run only on the server, reducing bundle size and enabling direct database access; they're the default in App Router. Client Components run in the browser and handle interactivity. Mark components with 'use client' to make them interactive; keep heavy logic on the server.

How do I fetch data in Next.js App Router applications?

In App Router, fetch data directly in Server Components using async/await, or use route handlers for API endpoints. Next.js caches fetch requests by default; use revalidateTag() or revalidatePath() to update stale data. This pattern combines SSR and SSG benefits without client-side waterfalls.

Can I migrate an existing Next.js project from Pages Router to App Router?

Yes, you can run Pages Router and App Router simultaneously during migration. Gradually move routes from pages/ to app/ directory. App Router coexists with Pages Router, letting you transition incrementally without rebuilding the entire project at once.

How do I optimize images and fonts in Next.js for production?

Use Next.js Image component for automatic responsive sizing, lazy loading, and format optimization. Import fonts from next/font to self-host them, eliminating external requests. Both reduce Cumulative Layout Shift and improve Core Web Vitals scores.

What metadata and SEO features does Next.js provide?

Define metadata in layout.tsx or page.tsx using the Metadata API; specify title, description, Open Graph tags, and canonical URLs. Next.js generates meta tags and injects them into the HTML head, improving search engine indexing and social sharing.