nextjs-patterns

Implements production-grade Next.js App Router patterns for rendering, data fetching, authentication, and deployment.

1|Updated Aug 10, 2026
One-click install
npx skills add https://github.com/TheViziusGroup/vibe-engineering-skills --skill nextjs-patterns-theviziusgroup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-patterns
Source: https://github.com/TheViziusGroup/vibe-engineering-skills/tree/main/plugins/frontend-design/skills/nextjs-patterns
Command: npx skills add https://github.com/TheViziusGroup/vibe-engineering-skills --skill nextjs-patterns-theviziusgroup

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Next.js App Router development involves subtle decisions around server vs. client components, caching behavior that changed across versions, and security pitfalls like treating middleware as an auth boundary. This Skill provides a field guide of proven patterns so you avoid common bugs and architectural mistakes. ## Core Features & Use Cases - Rendering & Data Fetching: Guidance on Server vs. Client Components, parallelized fetching with Promise.all, React cache() deduplication, Suspense streaming, and PPR/Cache Components. - Mutations & Security: Server Action hardening with Zod validation, next-safe-action, Auth.js v5 setup, rate limiting, and defenses against CVE-2025-29927. - Use Case: When building a dashboard with mixed static and per-user data, use this Skill to structure a PPR page with a static shell, stream dynamic regions through Suspense, and verify auth in the DAL and every Server Action. ## Quick Start Ask the AI to review your Next.js App Router page for caching, data fetching, and security issues using the nextjs-patterns guidance.

Frequently Asked Questions about nextjs-patterns

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

FAQPage Schema
How do I avoid data fetching waterfalls in Next.js App Router?

Parallelize independent fetches with Promise.all or Promise.allSettled instead of awaiting sequentially. Use the preload pattern to fire fetches early, and wrap distinct data-loading subtrees in Suspense boundaries so they stream independently.

When should I use Server Components vs Client Components in Next.js?

Use Server Components by default for data fetching, secret-bearing dependencies, and non-interactive content. Add 'use client' only at the smallest interactive leaves needing event handlers, browser APIs, or hooks, and pass Server Components as children to avoid promoting subtrees.

Does Next.js middleware protect my routes from unauthorized access?

No, middleware is not a security boundary, as shown by CVE-2025-29927 which allowed bypassing middleware authorization. Verify auth in the Data Access Layer and re-check authorization inside every Server Action and Route Handler.

Why is my Next.js fetch not caching after upgrading to v15?

In Next.js v15 and later, fetch is uncached by default, unlike v14. Opt in with cache: 'force-cache' or next: { revalidate: seconds }, or use v16 Cache Components with the 'use cache' directive, cacheLife(), and cacheTag().

Should I deploy Next.js on Vercel or self-host with Docker?

Vercel offers zero-config ISR, image optimization, and version skew protection but costs grow above roughly 10M requests per month. Self-hosting with output: 'standalone' gives predictable costs but requires managing cache handlers, sharp, proxy buffering, and encryption keys.

How do I validate Server Action inputs in Next.js?

Validate every Server Action input with Zod using safeParse, since Server Actions compile to public POST endpoints. The next-safe-action library adds composable middleware for auth and rate limiting plus typed hooks like useAction.