KS
Killer-Skills

nextjs-best-practices — nextjs-best-practices tutorial nextjs-best-practices tutorial, how to use nextjs-best-practices, nextjs-best-practices vs create-react-app, nextjs-best-practices setup guide, what is nextjs-best-practices, nextjs-best-practices alternative, nextjs-best-practices install, nextjs server component best practices, nextjs client component best practices, nextjs app router development

v1.0.0
GitHub

About this Skill

Perfect for Frontend Agents needing efficient Next.js application development with optimized server and client component principles nextjs-best-practices is a set of principles for Next.js App Router development, outlining the use of server and client components for optimal performance

Features

Decision tree for choosing between server and client components
Support for direct data fetching with server components
Ability to split components into server parent and client child for better interactivity
Use of 'use client' directive for client components
Default server component usage for data fetching and layout
Client component usage for form handling and event handlers

# Core Topics

mjannino mjannino
[0]
[0]
Updated: 3/7/2026

Quality Score

Top 5%
42
Excellent
Based on code quality & docs
Installation
SYS Universal Install (Auto-Detect)
Cursor IDE Windsurf IDE VS Code IDE
> npx killer-skills add mjannino/travel-photos/nextjs-best-practices

Agent Capability Analysis

The nextjs-best-practices MCP Server by mjannino is an open-source Categories.community integration for Claude and other AI agents, enabling seamless task automation and capability expansion. Optimized for nextjs-best-practices tutorial, how to use nextjs-best-practices, nextjs-best-practices vs create-react-app.

Ideal Agent Persona

Perfect for Frontend Agents needing efficient Next.js application development with optimized server and client component principles

Core Value

Empowers agents to develop high-performance Next.js applications by applying best practices for server and client components, utilizing techniques like direct data fetching and interactivity with 'use client' and server components for layout and static content

Capabilities Granted for nextjs-best-practices MCP Server

Optimizing data fetching for Next.js applications
Implementing efficient server and client component architecture
Improving application interactivity with 'use client' and event handlers

! Prerequisites & Limits

  • Requires understanding of Next.js framework
  • Limited to Next.js application development
Project
SKILL.md
3.5 KB
.cursorrules
1.2 KB
package.json
240 B
Ready
UTF-8

# Tags

[No tags]
SKILL.md
Readonly

Next.js Best Practices

Principles for Next.js App Router development.


1. Server vs Client Components

Decision Tree

Does it need...?
│
├── useState, useEffect, event handlers
│   └── Client Component ('use client')
│
├── Direct data fetching, no interactivity
│   └── Server Component (default)
│
└── Both? 
    └── Split: Server parent + Client child

By Default

TypeUse
ServerData fetching, layout, static content
ClientForms, buttons, interactive UI

2. Data Fetching Patterns

Fetch Strategy

PatternUse
DefaultStatic (cached at build)
RevalidateISR (time-based refresh)
No-storeDynamic (every request)

Data Flow

SourcePattern
DatabaseServer Component fetch
APIfetch with caching
User inputClient state + server action

3. Routing Principles

File Conventions

FilePurpose
page.tsxRoute UI
layout.tsxShared layout
loading.tsxLoading state
error.tsxError boundary
not-found.tsx404 page

Route Organization

PatternUse
Route groups (name)Organize without URL
Parallel routes @slotMultiple same-level pages
Intercepting (.)Modal overlays

4. API Routes

Route Handlers

MethodUse
GETRead data
POSTCreate data
PUT/PATCHUpdate data
DELETERemove data

Best Practices

  • Validate input with Zod
  • Return proper status codes
  • Handle errors gracefully
  • Use Edge runtime when possible

5. Performance Principles

Image Optimization

  • Use next/image component
  • Set priority for above-fold
  • Provide blur placeholder
  • Use responsive sizes

Bundle Optimization

  • Dynamic imports for heavy components
  • Route-based code splitting (automatic)
  • Analyze with bundle analyzer

6. Metadata

Static vs Dynamic

TypeUse
Static exportFixed metadata
generateMetadataDynamic per-route

Essential Tags

  • title (50-60 chars)
  • description (150-160 chars)
  • Open Graph images
  • Canonical URL

7. Caching Strategy

Cache Layers

LayerControl
Requestfetch options
Datarevalidate/tags
Full routeroute config

Revalidation

MethodUse
Time-basedrevalidate: 60
On-demandrevalidatePath/Tag
No cacheno-store

8. Server Actions

Use Cases

  • Form submissions
  • Data mutations
  • Revalidation triggers

Best Practices

  • Mark with 'use server'
  • Validate all inputs
  • Return typed responses
  • Handle errors

9. Anti-Patterns

❌ Don't✅ Do
'use client' everywhereServer by default
Fetch in client componentsFetch in server
Skip loading statesUse loading.tsx
Ignore error boundariesUse error.tsx
Large client bundlesDynamic imports

10. Project Structure

app/
├── (marketing)/     # Route group
│   └── page.tsx
├── (dashboard)/
│   ├── layout.tsx   # Dashboard layout
│   └── page.tsx
├── api/
│   └── [resource]/
│       └── route.ts
└── components/
    └── ui/

Remember: Server Components are the default for a reason. Start there, add client only when needed.

Related Skills

Looking for an alternative to nextjs-best-practices or building a Categories.community AI Agent? Explore these related open-source MCP Servers.

View All

widget-generator

Logo of f
f

widget-generator is an open-source AI agent skill for creating widget plugins that are injected into prompt feeds on prompts.chat. It supports two rendering modes: standard prompt widgets using default PromptCard styling and custom render widgets built as full React components.

149.6k
0
Design

chat-sdk

Logo of lobehub
lobehub

chat-sdk is a unified TypeScript SDK for building chat bots across multiple platforms, providing a single interface for deploying bot logic.

73.0k
0
Communication

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
Communication

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
Communication