Next.js 16.4: AI agent skill and new tools to cut your JavaScript bundles
Brief
Next.js 16.4 lets your AI agent analyze and optimize app bundles via the new next-bundle-optimizer skill, and ships interactive Bundle Analyzer improvements.
Agent-driven optimization
- Install with: npx skills add vercel/next.js --skill next-bundle-optimizer, then run /next-bundle-optimizer in your agent.
- The skill reconstructs Turbopack's module and chunk graphs (exportable via next analyze export), finds large connected module groups, and uses minimum cut to suggest import boundaries that defer code.
- It also flags moves to React Server Components, duplicate dependency versions, and broken tree shaking. /next-bundle-optimizer fix applies changes; agents can open PRs. Requires Turbopack.
Results at Vercel
- Nearly 2 MB of compressed JavaScript saved across v0 and vercel.com.
- v0: eager experimental code editor (150 KB saved), dialog registry (40–650 KB), unused trace viewer (7–61 KB).
- vercel.com: agent panel assets (255 KB on dashboard), date parsing library (55 KB avg), shared utility pulling an observability engine (125 KB on deployments).
Bundle Analyzer for humans
- New route summary homepage highlights largest client routes; table views sort modules by estimated compressed size.
- Analyses are auto-saved as snapshots and can be diffed to measure optimization impact or bundle growth.
- New critical render path view filters to modules loading synchronously for initial render; run with next analyze.
Generated by AI from the original article. Check the source for full details.