davila7 avatar

Nextjs Best Practices

This one keeps you honest about Next.js App Router defaults. It pushes server components first, client components only when you need interactivity, which is the right instinct but easy to forget when you're used to older patterns. The decision trees are useful, especially the server vs client split and the caching layers breakdown. What I like is the anti-patterns section calling out "use client everywhere" because that's exactly what happens when teams migrate without rethinking their approach. The routing conventions table and server actions guidance are solid references when you're setting up new routes or forms. Good for teams transitioning from Pages Router or anyone who keeps reaching for client components out of habit.

skills.sh installs
632
GitHub stars
33.2K
last updated
Aug 21, 2026

Install

$ npx -y skills add davila7/claude-code-templates --skill nextjs-best-practices --agent claude-code

Installs into .claude/skills of the current project.

Files

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

Sponsors

Details

Repository
github.com/davila7/claude-code-templates
Categories
Frontend Development, Backend & APIs
First seen
May 16, 2026

More from davila7/claude-code-templates

All 618
1langgenius avatarvercel-react-best-practiceslanggenius/difyReact and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js c612skills.sh installs
2aj-geddes avatarfrontend-accessibilityaj-geddes/useful-ai-promptsImplement WCAG compliance using semantic HTML, ARIA, keyboard navigation, and screen reader support. Use when building inclusive applications for all users.604skills.sh installs
3spences10 avatarsvelte-componentsspences10/svelte-skills-kitSvelte component patterns. Use for web components, component libraries (Bits UI, Ark UI, Melt UI), form patterns, or third-party integration.566skills.sh installs
4davila7 avatartailwind-patternsdavila7/claude-code-templatesTailwind CSS v4 principles. CSS-first configuration, container queries, modern patterns, design token architecture.564skills.sh installs
5davila7 avatarreact-best-practicesdavila7/claude-code-templatesComprehensive React and Next.js performance optimization guide with 40+ rules for eliminating waterfalls, optimizing bundles, and improving rendering. Use when 550skills.sh installs
6heyman333 avatarios-glass-ui-designerheyman333/atelier-uiRedesign mobile app UI to feel unmistakably iOS-native with modern Apple-like glass materials (translucency, blur, depth). Use this skill when designing iOS-fir511skills.sh installs