
Nextjs Best Practices
- 6.8k installs
- 44.4k repo stars
- Updated August 4, 2026
- sickn33/antigravity-awesome-skills
nextjs-best-practices is an agent skill for Next.js App Router principles. Server Components, data fetching, routing patterns.
About
Next js App Router principles Server Components data fetching routing patterns name nextjs-best-practices description Next js App Router principles Server Components data fetching routing patterns risk unknown source community date_added 2026-02-27 Next js Best Practices Principles for Next js App Router development 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 Type Use Server Data fetching layout static content Client Forms buttons interactive UI 2 Data Fetching Patterns Fetch Strategy Pattern Use Default Static cached at build Revalidate ISR time-based refresh No-store Dynamic every request Data Flow Source Pattern Database Server Component fetch API fetch with caching User input Client state server action 3 Routing Principles File Conventions File Purpose page tsx Route UI layout tsx Shared layout loading tsx Loading state error tsx Error boundary not-found tsx 404 page Route Organization Pattern Use Route groups name Organize without URL Parallel routes slot Multiple same-level pages
- Next.js Best Practices
- Validate input with Zod
- Return proper status codes
- Handle errors gracefully
- Use Edge runtime when possible
Nextjs Best Practices by the numbers
- 6,833 all-time installs (skills.sh)
- +56 installs in the week ending Aug 5, 2026 (Skillselion tracking)
- Ranked #234 of 2,153 Testing & QA skills by installs in the Skillselion catalog
- Security screen: LOW risk (skills.sh audit)
- Data as of Aug 5, 2026 (Skillselion catalog sync)
nextjs-best-practices capabilities & compatibility
- Capabilities
- next.js best practices · validate input with zod · return proper status codes · handle errors gracefully · use edge runtime when possible
- Use cases
- documentation
What nextjs-best-practices says it does
--- name: nextjs-best-practices description: "Next.js App Router principles.
Server Components, data fetching, routing patterns." risk: unknown source: community date_added: "2026-02-27" --- # Next.js Best Practices > Principles for Next.js App Router development.
Server vs Client Components ### Decision Tree ``` Does it need...?
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill nextjs-best-practicesAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 6.8k |
|---|---|
| repo stars | ★ 44.4k |
| Security audit | 3 / 3 scanners passed |
| Last updated | August 4, 2026 |
| Repository | sickn33/antigravity-awesome-skills ↗ |
When should developers use nextjs-best-practices and what problem does it solve?
Next.js App Router principles. Server Components, data fetching, routing patterns.
Who is it for?
Developers working with nextjs-best-practices patterns described in the skill documentation.
Skip if: Skip when cached docs are empty or the task is outside the skill's documented scope.
When should I use this skill?
Next.js App Router principles. Server Components, data fetching, routing patterns.
What you get
Grounded guidance and workflows from SKILL.md for nextjs-best-practices.
- Server and Client Component architecture
- App Router file structure
By the numbers
- Community skill date_added 2026-02-27
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 childBy Default
| Type | Use |
|---|---|
| Server | Data fetching, layout, static content |
| Client | Forms, buttons, interactive UI |
---
2. Data Fetching Patterns
Fetch Strategy
| Pattern | Use |
|---|---|
| Default | Static (cached at build) |
| Revalidate | ISR (time-based refresh) |
| No-store | Dynamic (every request) |
Data Flow
| Source | Pattern |
|---|---|
| Database | Server Component fetch |
| API | fetch with caching |
| User input | Client state + server action |
---
3. Routing Principles
File Conventions
| File | Purpose |
|---|---|
page.tsx | Route UI |
layout.tsx | Shared layout |
loading.tsx | Loading state |
error.tsx | Error boundary |
not-found.tsx | 404 page |
Route Organization
| Pattern | Use |
|---|---|
Route groups (name) | Organize without URL |
Parallel routes @slot | Multiple same-level pages |
Intercepting (.) | Modal overlays |
---
4. API Routes
Route Handlers
| Method | Use |
|---|---|
| GET | Read data |
| POST | Create data |
| PUT/PATCH | Update data |
| DELETE | Remove 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
| Type | Use |
|---|---|
| Static export | Fixed metadata |
| generateMetadata | Dynamic per-route |
Essential Tags
- title (50-60 chars)
- description (150-160 chars)
- Open Graph images
- Canonical URL
---
7. Caching Strategy
Cache Layers
| Layer | Control |
|---|---|
| Request | fetch options |
| Data | revalidate/tags |
| Full route | route config |
Revalidation
| Method | Use |
|---|---|
| Time-based | revalidate: 60 |
| On-demand | revalidatePath/Tag |
| No cache | no-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' everywhere | Server by default |
| Fetch in client components | Fetch in server |
| Skip loading states | Use loading.tsx |
| Ignore error boundaries | Use error.tsx |
| Large client bundles | Dynamic 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.
When to Use
This skill is applicable to execute the workflow or actions described in the overview.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Related skills
How it compares
Pick nextjs-best-practices over generic React skills when work specifically involves Next.js App Router Server Component boundaries and file-based routing.
FAQ
What does nextjs-best-practices do?
Next.js App Router principles. Server Components, data fetching, routing patterns.
When should I invoke nextjs-best-practices?
Next.js App Router principles. Server Components, data fetching, routing patterns.
Where is the source documentation?
Ground claims in SKILL.md excerpts and linked reference files from the cached docs.
Is Nextjs Best Practices safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.