Upgrade a Next.js project to v16 with guided codemods
When to use: You've been putting off the Next 16 upgrade. You want an agent to drive codemods and fix async API migrations.
Prerequisites
- Next.js project on v14+ — Check package.json
- Clean git working tree —
git statusshows clean — so you can revert if needed
Flow
-
Run the upgrade toolRun upgrade_nextjs_16 on this project. Walk me through each codemod before applying.✓ Copied→ List of planned changes with diffs to preview
-
Fix async API call sitesAfter codemods, build the project. For any errors from now-async cookies()/headers(), fix the call sites to use await.✓ Copied→ Build passes
-
Enable Cache ComponentsRun enable_cache_components. Fix any boundary errors it reports.✓ Copied→ Cache components enabled, app runs
Outcome: A working Next 16 project with Cache Components, in one focused session instead of a scattered week.
Pitfalls
- Codemods can't fix custom-patterned async usage — Run the build after each codemod step; fix manually when the codemod tags 'REVIEW' comments
- Third-party libs may not be ready for Next 16 — Check package compatibility before upgrading; pin any lib that breaks and file an issue upstream