sickn33/antigravity-awesome-skills/nextjs-best-practices

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Next.js App Router principles. Server Components, data fetching, routing patterns.

Install

npx vskill@latest install sickn33/antigravity-awesome-skills/nextjs-best-practices

SKILL.md

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
DefaultVersion/config dependent; current fetch defaults are uncached
Explicit cachefetch(url, { cache: "force-cache" }) when data may be shared
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
  • Choose Node.js or Edge runtime according to dependency and deployment support; do not assume Node APIs are available on Edge

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'
  • Authenticate and authorize each action/handler on the server; exported actions are callable endpoints
  • 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.

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Version scope

Check the installed Next.js version and whether Cache Components is enabled before applying caching advice. The official caching guide distinguishes these models. Test freshness and invalidation explicitly; never put user-specific secrets or authorization-dependent responses into a shared cache.

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.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationPassed, 75 of 100Effective. 1 run. Evaluated 7 months ago.

Source

Popularity

Repository stars
27,551
Repository forks
4,635
Repository npm downloads, 7 days
6,478
7-day trend score
72

Stars and forks are for the whole GitHub repository, not this skill alone. Downloads are for the repository's npm package. Refreshed 22 Mar 2026, 7 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/sickn33/antigravity-awesome-skills/nextjs-best-practices/badge)](https://verified-skill.com/skills/sickn33/antigravity-awesome-skills/nextjs-best-practices)

Something wrong with this skill or its page? Tell us.