agentleFS
Leo-AtienzaLeo-Atienza/atlas-claude/skills/next-upgrade/SKILL.md

next-upgrade

Skill4 starsChanged 4 months agoMITView on GitHub

Upgrade Next.js to the current stable 16.x (security floor 16.2.6 — May 2026 release; head 16.2.10 as of Jul 2026) following the official migration guide and codemods. Surfaces the May 2026 security advisory automatically — any project on next < 16.2.6 has unpatched CVEs.

  • Installs packages

7 other projects use a version of this, 7 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use frontend-design.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • VercelSkill

    frontend-design

    Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 1 is distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read package.json. If current next version is < 16.2.6:

    line 25
  2. Very specific:

    Read package.json for the current next, react, react-dom, and @types/react* versions.

    line 35
  3. Very specific:

    Use WebFetch on https://nextjs.org/docs/app/guides/upgrading/codemods to confirm the codemod list hasn't changed since this skill was …

    line 39
  4. Very specific:

    Run each codemod on the relevant directory (typically ./src or ./app).

    line 61
  5. Very specific:

    If on yarn / pnpm / bun, swap the install command.

    line 70
  6. Very specific:

    If you have a middleware.ts file at the project root and the codemod missed it, rename to proxy.ts and update the export.

    line 80
  7. Very specific:

    If npm audit flags transitive deps with CVEs (especially in webpack, postcss, @swc/*), open the audit report and decide whether npm audit …

    line 101
  8. Distinctive:

    Commit as a single atomic upgrade (don't bundle feature work):

    line 105

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Upgrade Next.js

Upgrade the current project to the current stable Next.js 16.x (16.2.10 as of 2026-07-04 — verify with npm view next dist-tags.latest). The May 2026 release closed 13 security advisories and set the floor: never leave a production project below 16.2.6 (15.x floor 15.5.18; 15.x backport head 15.5.20). The floor is the minimum, not the target — install the head.

Current target (verify at execute time)

PackageTargetReason
next^16.2.6 (floor) — install latest 16.xSecurity floor from the May 2026 release; head is 16.2.10 (Jul 2026)
react^19.2.7Latest stable, paired with Next 16
react-dom^19.2.7Same
@types/react / @types/react-domlatestAlways pin to latest types

16.2.6 is the floor, not the target — run npm view next dist-tags.latest first and install that. (Also current as of Jul 2026: Node 20 is EOL upstream even though Next's minimum is still 20.9+ — prefer Node 22/24; 16.3 is in preview via next@preview.)

Step 0 — Security advisory check (DO THIS FIRST)

Read package.json. If current next version is < 16.2.6:

This upgrade is security-driven. The May 2026 release patches CVE-2026-29057 (HTTP-proxy request smuggling in rewrites), middleware/proxy bypass via segment-prefetch routes, dynamic-route parameter injection bypass, DoS via Cache Components connection exhaustion, SSRF, cache poisoning, and XSS — 13 advisories total. Patching is the only complete mitigation; there are no workarounds for several of them.

See Vercel May 2026 security release notes.

State this risk explicitly to the user before proceeding so they understand the upgrade is non-optional.

Step 1 — Detect current state

Read package.json for the current next, react, react-dom, and @types/react* versions. Note the gap between current and target. If skipping a major version (e.g. 14 → 16), upgrade incrementally — 14 → 15 → 16 — running codemods between each step. The tooling assumes one major hop at a time.

Step 2 — Fetch the current upgrade guide

Use WebFetch on https://nextjs.org/docs/app/guides/upgrading/codemods to confirm the codemod list hasn't changed since this skill was written. Also pull the version-specific guides for the upgrade path:

Step 3 — Run codemods

npx @next/codemod@latest <transform> <path>

Common transforms (verify list at execute time — Next ships new codemods regularly):

TransformPurposeIntroduced
next-async-request-apiUpdates params/searchParams/cookies()/headers() to asyncv15
next-request-geo-ipMigrates request.geo and request.ip to geolocation() / ipAddress()v15
next-dynamic-access-named-exportTransforms next/dynamic imports for named exportsv15
next-middleware-to-proxyRenames middleware.ts → proxy.ts and updates exportsv16
next-cache-components-migrationConverts unstable_cache → 'use cache' directive (run only if enabling Cache Components)v16

Run each codemod on the relevant directory (typically ./src or ./app). Review the diff per codemod — they're not always 100% accurate on edge cases like ternary destructuring of params.

Step 4 — Bump dependencies

npm install next@latest react@latest react-dom@latest
npm install -D @types/react@latest @types/react-dom@latest

If on yarn / pnpm / bun, swap the install command. Don't pin to a single patch version unless the project requires it — ^16.2.6 keeps you on the LTS line.

Step 5 — Manual config review

Open next.config.{js,ts} and check for:

  • experimental.ppr: true → replace with top-level cacheComponents: true (if migrating to Cache Components — this is opt-in)
  • Any deprecated experimental.* flags called out in the v16 upgrade guide
  • images.domains (deprecated since v15) → confirm migrated to images.remotePatterns

If you have a middleware.ts file at the project root and the codemod missed it, rename to proxy.ts and update the export. The runtime alias still resolves middleware.ts for one major version, but new docs reference proxy.

Step 6 — Build + test

npm run build
npm run dev   # smoke-test routing, RSC boundaries, dynamic routes

Watch for:

  • Hydration mismatch warnings (often surface async API misuse the codemod missed)
  • "Cannot read properties of undefined" in app/**/page.tsx — usually params not awaited
  • Build errors mentioning route.ts exports — runtime/edge config moved in v15+

Step 7 — Post-upgrade audit

npm audit
npm audit fix   # only if changes are limited to dev dependencies

If npm audit flags transitive deps with CVEs (especially in webpack, postcss, @swc/*), open the audit report and decide whether npm audit fix --force is safe — it can downgrade major versions.

Step 8 — Commit and verify deploy

Commit as a single atomic upgrade (don't bundle feature work):

chore(deps): upgrade Next.js to 16.2.6 LTS (May 2026 security release)

- next 14.x → 16.2.6
- react 18.x → 19.2.6
- ran codemods: next-async-request-api, next-middleware-to-proxy
- closed 13 advisories incl. CVE-2026-29057

Then deploy to a preview environment first. The Cache Components and middleware/proxy changes can surface as 5xx in production if the build looked clean but a runtime path was missed — verify against the live preview URL before promoting.

Sources

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.