Nextjs upgrade assistant

From frankxai/claude-skills-library · View interactive version

Nextjs upgrade assistant is an AI agent skill from the GitHub repository frankxai/claude-skills-library. Guided Next.js upgrade workflow — version migration, compatibility checks, and safe rollout. Use when upgrading Next.js across major versions, resolving breaking changes, or planning a staged migration.

How to use this skill

Skill file

Next.js Upgrade Assistant

Version: 1.0 (Next.js 15 → 16)

Author: FrankX AI Systems

Last Updated: 2025-10-24

Overview

Automated assistant for upgrading Next.js projects to version 16, with comprehensive migration support and MCP-powered guidance.

Pre-Upgrade Checklist

Before starting the upgrade, verify:

Reference

The full detail lives in references/ and loads only when needed:


Automated Migration with Codemods

Next.js provides codemods for automated migration:

# Run Next.js codemods via next-devtools-mcp
npx @next/codemod upgrade

# Specific transformations
npx @next/codemod built-in-next-font .
npx @next/codemod new-link .
npx @next/codemod next-image-to-legacy-image .

Query next-devtools-mcp for migration help:

Breaking Changes in Next.js 16

1. Removed Features

2. Changed Defaults

3. API Changes

Common Issues & Solutions

Issue 1: Build Errors After Upgrade

Problem: Module not found or Type errors

Solution:

# Clear Next.js cache
rm -rf .next

# Reinstall dependencies
rm -rf node_modules package-lock.json
npm install

# Rebuild
npm run build

Issue 2: Hydration Errors

Problem: Hydration mismatch warnings

Solution:

// Ensure consistent rendering
// Bad
<time>{new Date().toString()}</time>

// Good
'use client'
import { useEffect, useState } from 'react'

function ClientTime() {
  const [time, setTime] = useState('')

  useEffect(() => {
    setTime(new Date().toString())
  }, [])

  return <time suppressHydrationWarning>{time}</time>
}

Issue 3: Server Actions Not Working

Problem: Server Actions return undefined or errors

Solution:

// Ensure 'use server' is at the top
'use server'

// Return serializable data only
export async function myAction() {
  // Bad - can't serialize Date objects
  return { date: new Date() }

  // Good - serialize first
  return { date: new Date().toISOString() }
}

Issue 4: Cache Not Invalidating

Problem: Data not updating after mutations

Solution:

'use server'

import { revalidatePath, revalidateTag } from 'next/cache'

export async function updatePost(id: string, data: any) {
  await db.post.update({ where: { id }, data })

  // Revalidate specific paths
  revalidatePath(`/posts/${id}`)
  revalidatePath('/posts')

  // Or use tags
  revalidateTag('posts')
}

MCP Integration for Upgrades

Use next-devtools-mcp for:

Use built-in MCP (after upgrade) for:

Post-Upgrade Optimization

After successful upgrade:

  1. Enable New Features
  1. Refactor Old Patterns
  1. Optimize Performance
  1. Update Documentation

Rollback Plan

If upgrade fails:

# Revert via Git
git reset --hard HEAD~1

# Or checkout previous commit
git checkout <previous-commit-hash>

# Reinstall dependencies
rm -rf node_modules package-lock.json
npm install

# Test
npm run dev

Upgrade Checklist

Success Criteria

Upgrade is successful when:

Resources


This assistant provides a comprehensive upgrade path from Next.js 15 to 16 with minimal downtime and maximum reliability.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.