Agent-skills-standard nextjs-upgrade
Next.js version migrations using official guides and codemods. Use when migrating a Next.js project to a new major version using codemods. (triggers: package.json, next upgrade, migration guide, codemod)
install
source · Clone the upstream repo
git clone https://github.com/HoangNguyen0403/agent-skills-standard
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/HoangNguyen0403/agent-skills-standard "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/nextjs/nextjs-upgrade" ~/.claude/skills/hoangnguyen0403-agent-skills-standard-nextjs-upgrade && rm -rf "$T"
manifest:
skills/nextjs/nextjs-upgrade/SKILL.mdsource content
Next.js Upgrade Protocol
Automated and manual migration steps for Next.js version upgrades (e.g., v14 to v15).
Priority: P1 (OPERATIONAL)
Workflow: Upgrade Next.js to New Major Version
- Check current versions of
,next
,react
inreact-dompackage.json - Plan incremental path (e.g., v13 -> v14 -> v15; never skip majors)
- Run codemods:
npx @next/codemod@latest <transform> <path> - Update dependencies: See implementation examples
- Verify async APIs: ensure
,cookies()
,headers()
awaited (v15+)params - Audit
caching: v15 defaults tofetch
; addno-store
where neededforce-cache - Run
and fix hydration or Turbopack errorsnext build - Report codemod failures or manual fixes to team
Implementation Guidelines
- Upgrade Detection: Always check
for versions ofpackage.json
,next
, andreact
.react-dom - Planning: For major version jumps (v13 to v15), perform incremental upgrade (v13 -> v14, then v14 -> v15). Follow official Next.js Migration Guides.
- Automated Codemods: Use
to automate syntax migration.npx @next/codemod@latest <transform> <path> - Breaking Changes (v15): Respond to
transform by ensuringnext-async-request-api
,params
,searchParams
, andcookies()
awaited.headers() - React Parity: Upgrade
andreact
to match Next.js peer dependencies (e.g., React 19 for Next.js 15).react-dom - Validation: Run
andnext dev
after each incremental step. Check console errors for hydration warnings.next build
Anti-Patterns
- No major version skipping: Upgrade one major version at time (13 -> 14, then 14 -> 15).
- No manual breaking-change fixes: Always run
transforms first.npx @next/codemod@latest - No assumed caching behavior post-upgrade: v15 defaults to
; audit allno-store
calls.fetch - No async page functions in Pages Router:
fatal.export default async function Page()