RE

reviewing-nextjs-16-patterns

Audits Next.js 16 projects for breaking changes, Server Action authentication, and middleware security.

Install

mkdir -p .claude/skills/reviewing-nextjs-16-patterns && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/317" && unzip -o skill.zip -d .claude/skills/reviewing-nextjs-16-patterns && rm skill.zip

Installs to .claude/skills/reviewing-nextjs-16-patterns

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Review code for Next.js 16 compliance - security patterns, caching, breaking changes. Use when reviewing Next.js code, preparing for migration, or auditing for violations.
171 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Audit Server Actions for CVE-2025-29927 authentication compliance
  • Verify middleware security patterns and protected route configurations
  • Validate adoption of use cache directives and cacheLife profiles
  • Identify synchronous API usage requiring async migration
  • Check route handler and generateStaticParams compatibility
  • Verify package.json dependencies for Next.js 16 and React 19

How it works

The skill uses grep and find commands to locate specific code patterns, such as Server Actions or synchronous API calls, and compares them against Next.js 16 requirements. It then flags non-compliant code for manual review and remediation.

Inputs & outputs

You give it
Next.js codebase directory
You get back
List of compliance violations categorized by severity

When to use reviewing-nextjs-16-patterns

  • Audit code for Next.js 16 migration
  • Check Server Actions for security flaws
  • Review middleware for protected routes

About this skill

Next.js 16 Patterns Review

Comprehensive review for Next.js 16 compliance covering security vulnerabilities, caching patterns, breaking changes, and migration readiness.

Review Process

For comprehensive security review patterns, use the reviewing-security skill from the review plugin. For dependency auditing, use the reviewing-dependencies skill from the review plugin.

1. Security Audit

CVE-2025-29927 - Server Action Authentication

Check all Server Actions for proper authentication:

# Find all Server Actions
grep -r "use server" --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx"

For each Server Action verify:

  • Authentication check at function start
  • Authorization validation before data access
  • No reliance on client-side validation only
  • Proper error handling without leaking sensitive data

Middleware Security

# Find middleware files
find . -name "middleware.ts" -o -name "middleware.js"

Verify:

  • Authentication logic present in middleware
  • Protected routes defined in config.matcher
  • No authentication logic removed in Next.js 16 migration
  • Proper redirect handling for unauthorized access

Server Component Data Access

# Find async Server Components
grep -r "export default async function" app/

Check each Server Component:

  • Session validation before data queries
  • User context verified before personalized data
  • No direct database queries without auth checks
  • Proper error boundaries for auth failures

2. Caching Patterns

use cache Adoption

# Find fetch calls that should use cache
grep -r "fetch(" --include="*.ts" --include="*.tsx"
# Find functions that should be cached
grep -r "export async function" --include="*.ts"

Verify:

  • use cache directive for cacheable functions
  • Proper cache tags with cacheTag() for revalidation
  • Cache lifecycle control with cacheLife()
  • No unstable_cache in new code
  • fetch() caching replaced with use cache

Cache Lifecycle Configuration

Check for proper cache profiles:

  • cacheLife('seconds') for rapidly changing data
  • cacheLife('minutes') for moderate update frequency
  • cacheLife('hours') for stable content
  • cacheLife('days') for rarely changing data
  • cacheLife('weeks') for static content
  • Custom profiles defined in next.config.js if needed

Revalidation Strategy

# Find revalidation calls
grep -r "revalidateTag\|revalidatePath" --include="*.ts" --include="*.tsx"

Verify:

  • revalidateTag() matches cacheTag() definitions
  • revalidatePath() used for page-level invalidation
  • No orphaned cache tags
  • Proper error handling in revalidation

3. Breaking Changes

Async Request APIs

# Find synchronous API usage
grep -r "cookies()\|headers()\|params\|searchParams" --include="*.ts" --include="*.tsx"

Check for required async usage:

  • await cookies() in Server Components/Actions
  • await headers() in Server Components/Actions
  • await params in page/layout/route components
  • await searchParams in page components
  • React.use() wrapper in Client Components if needed

Middleware to Proxy Migration

# Check for removed middleware patterns
grep -r "NextResponse.rewrite\|NextResponse.redirect" middleware.ts

Verify migration:

  • Simple rewrites moved to next.config.js redirects/rewrites
  • Complex logic converted to Middleware Proxies
  • Authentication logic preserved
  • Header manipulation handled correctly

Route Handler Changes

# Find route handlers
find app -name "route.ts" -o -name "route.js"

Check each route handler:

  • Dynamic functions require dynamic = 'force-dynamic'
  • No synchronous cookies()/headers() calls
  • Proper TypeScript types for request/params
  • Error handling updated for new patterns

generateStaticParams Changes

# Find static param generation
grep -r "generateStaticParams" --include="*.ts" --include="*.tsx"

Verify:

  • Returns array of param objects (not nested)
  • Works with new async params
  • Proper TypeScript types
  • No deprecated patterns

4. Migration Verification

Dependency Updates

Check package.json:

  • next: ^16.0.0 or higher
  • react: ^19.0.0 or higher
  • react-dom: ^19.0.0 or higher
  • @types/react: ^19.0.0 (if using TypeScript)
  • @types/react-dom: ^19.0.0 (if using TypeScript)

Configuration Updates

Check next.config.js:

  • experimental.dynamicIO enabled if using dynamic APIs
  • staleTimes configured if controlling client-side cache
  • Custom cacheLife profiles defined if needed
  • TypeScript config updated for async params

Build Validation

Run and verify:

npm run build
  • No deprecation warnings
  • No type errors
  • No runtime errors in build
  • Static generation works correctly
  • Dynamic routes render properly

Runtime Testing

  • Authentication flows work correctly
  • Protected routes require login
  • Server Actions validate permissions
  • Cache invalidation triggers updates
  • Dynamic content updates appropriately
  • Static content serves from cache

Violation Severity

Critical

  • Missing authentication in Server Actions (CVE-2025-29927)
  • Synchronous cookies()/headers() calls
  • Security middleware removed or broken

High

  • Missing cache directives on expensive operations
  • Incorrect async params usage
  • Broken revalidation strategy

Medium

  • Using deprecated unstable_cache
  • Middleware patterns that should be proxies
  • Missing cache lifecycle configuration

Nitpick

  • Suboptimal cache profiles
  • Missing cache tags for fine-grained invalidation
  • Legacy fetch caching patterns

Best Practices

  1. Run security audit first - Critical vulnerabilities take priority
  2. Group related violations - Fix all async API issues together
  3. Test incrementally - Verify each category before moving on
  4. Document decisions - Record why certain patterns were chosen
  5. Update documentation - Keep project docs current with Next.js 16 patterns

When not to use it

  • Auditing general project dependencies
  • Performing broad security vulnerability scans outside of Next.js patterns

Prerequisites

Next.js 16 project structureRead, Glob, Grep, and TodoWrite tool access

Limitations

  • Requires manual verification of flagged code
  • Does not automatically refactor code to meet new patterns

How it compares

Unlike manual code reviews, this skill automates the identification of specific breaking changes and security patterns using targeted file system searches.

Compared to similar skills

reviewing-nextjs-16-patterns side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
reviewing-nextjs-16-patterns (this skill)118moReviewIntermediate
tech-debt12moReviewBeginner
codex-code-review17moReviewIntermediate
beforemerge-fullstack-architecture-review04moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

tech-debt

vm0-ai

Technical debt management - scan codebase for bad smells and create tracking issues

13

codex-code-review

tyrchen

Perform comprehensive code reviews using OpenAI Codex CLI. This skill should be used when users request code reviews, want to analyze diffs/PRs, need security audits, performance analysis, or want automated code quality feedback. Supports reviewing staged changes, specific files, entire directories, or git diffs.

16

beforemerge-fullstack-architecture-review

adrian-coronel

Code review rules for DRY/SOLID layered architecture in fullstack TypeScript applications. Covers dependency direction, service/repository patterns, factory injection, domain entities, security hardening, performance optimization, and code quality patterns. Use this skill when reviewing, writing, or

00

auth-patterns

davepoon

This skill should be used when the user asks about "authentication in Next.js", "NextAuth", "Auth.js", "middleware auth", "protected routes", "session management", "JWT", "login flow", or needs guidance on implementing authentication and authorization in Next.js applications.

720

hot-reload-optimizer

lichunboa

Optimizes hot module replacement and fast refresh for development speed with Vite, Next.js, and webpack configurations. Use when users request "hot reload", "HMR optimization", "fast refresh", "dev server speed", or "development performance".

00

vite-patterns

Fmarzochi

Vite build tool patterns including config, plugins, HMR, env variables, proxy setup, SSR, library mode, dependency pre-bundling, and build optimization. Activate when working with vite.config.ts, Vite plugins, or Vite-based projects.

00

Search skills

Search the agent skills registry