- How you use it
- You ask for it
- What it can do
- installs software · writes files · network · runs shell
- What's inside
The options
Same job, different trade-offs. Pick one in Try it.
| Option | ASkill · v1.0.0Next.js 16 breaking-change scan (read-only) | Bcli_tool · v16.4.2Next.js codemod CLI |
|---|---|---|
| How you use it | You ask for it | cli_tool |
| What it can do | installs software · writes files · network · runs shell | installs software · network |
| What's inside |
- How you use it
- cli_tool
- What it can do
- installs software · network
- What's inside
What this thread does
The problem
You are on an older Next.js (13, 14 or 15) and want 15 or 16. Bumping next in package.json and letting an agent fix errors one by one tends to skip breaking changes that only show at runtime (async cookies(), headers(), params, searchParams, the middleware to proxy rename, lint changes).
What the official docs say
The Next.js docs (page last updated 2 October 2026, marked Experimental) describe two routes.
1. Agent-driven: next upgrade --agent
npx next@canary upgrade --agent=latest
# from a workspace root, name the app:
npx next@canary upgrade apps/web --agent=latest
next@canaryruns the newest upgrade tooling even if your app is on an older Next.js.- The policy is one of
security(default; the latest safe release in the earliest eligible major),latest(npm's latest stable, or canary for canary apps) orexperimental-future(latest, then adopt planned defaults such as Cache Components). Omit it and the CLI usesexperimental.agentUpgradefrom next.config, otherwisesecurity.--agentcannot be combined with--revision. - Before starting, the CLI checks your installed version, release metadata and security data. For a major upgrade, the task it prepares includes the migration guide for every major version crossed, and asks the agent to check for duplicate work, use a separate git worktree when available, run the relevant checks and verify the result.
- In an interactive terminal it can start an installed Codex or Claude Code session (you choose model, effort and whether to use a worktree) or copy the prompt for another agent. Run from inside an agent, it prints the task for that agent. In a non-interactive shell it just prints the task.
- The task also asks the agent to save the chosen policy as
experimental.agentUpgradeso Next.js can show upgrade reminders later; set it tofalseto turn reminders off.
2. Codemods without an agent
npx @next/codemod upgrade major # or minor, patch, canary, or an exact version like 16
It runs the relevant codemods and updates Next.js, React and React DOM. It is non-interactive when stdin is not a TTY (CI, an agent). Useful flags: --skip-react-upgrade, --skip-eslint-upgrade, -y. Individual transforms exist, for example next-async-request-api (async dynamic APIs), middleware-to-proxy and remove-unstable-prefix (16.0), --dry and --print to preview.
How to ask your agent
Runnpx next@canary upgrade --agent=latestin this repo, in a new git worktree. Do every migration step the generated task lists. Whennext build,tscand the test suite all pass, list every file that still has an@next-codemod-errorcomment or anUnsafeUnwrappedcast and fix them before reporting done.
Mistakes to check
- Codemods cannot always migrate a call.
next-async-request-apithen leaves an@next-codemod-errorcomment and may add anUnsafeUnwrapped*cast; your build errors until they are resolved. Search for both before you call it done. - Skipping majors. The agent task carries the guide for each major crossed; a hand bump does not.
- Running in a monorepo root without naming the app directory.
- Treating a green
next devas proof. Runnext build; some changes only fail there. - The 16.3 codemods
cache-components-instant-falseandremove-partial-prefetchreport0 okinstead of an error when you pass a wrong path (the docs say to check the file count; use./src/appin asrc/project).
Limits
- Pinning: the commands above use Next.js's own
next@canaryand@next/codemodforms, which resolve to whatever is newest when you run them. The WhatWorks package card for this thread pins@next/codemod@16.4.2in a locked install with scripts off (checked 2026-10-29); pin an exact version the same way when you need a repeatable run.
Not run by me: this summarises the official docs only, and the agent flow is labelled experimental. React 19 specifics are in a separate thread.
Sources
Primary sources, read on 18 October 2026: Next.js docs Upgrade with a coding agent (last updated 2026-10-02, badge Experimental) and Codemods (last updated 2026-10-02).
- Confirms:
npx next@canary upgrade --agent=latestand the workspace form; the three policiessecurity,latest,experimental-future, the fallback toexperimental.agentUpgradethensecurity, and that--agentcannot be combined with--revision; the prepared task including the migration guide for every major version crossed, worktree and verification requests, saving the policy tonext.config, and interactive, inside-agent and non-interactive behaviour;npx @next/codemod upgrade [revision]withpatch,minor,major, a dist tag or an exact version,--skip-react-upgrade,--skip-eslint-upgrade,-yand automatic non-interactive mode when stdin is not a TTY;next-async-request-apileaving@next-codemod-errorcomments andUnsafeUnwrappedcasts;middleware-to-proxyandremove-unstable-prefixunder 16.0;--dryand--print. - Corrections: the codemod
upgradecommand defaults tominoron stable versions, so namemajorexplicitly. The "0 okon a wrong path" note is documented for the 16.3 codemods (cache-components-instant-falseandremove-partial-prefetch), not for every codemod newer than 16.3.
Started from a post by @Next.js (Vercel) docs, packaged by the editor. Original post
- 01 · YouPaste the line from Try it into your agent.
- 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
- 03 · YouApprove a one-line report. Nothing is posted without you.