nextjs-bundle-optimizer
Installation
SKILL.md
Next.js Bundle & Build-Time Optimizer
Data-driven optimization loop for Next.js 16 applications. The skill orchestrates next experimental-analyze, builds, type checks, and tests to make verifiable improvements one change at a time.
When to Apply
Use this skill when:
- The user wants to reduce bundle size / First Load JS / route bundles in a Next.js 16 app.
- Production builds are slow and the user wants to diagnose and fix the bottleneck.
- The user shares analyzer output, a screenshot of the treemap, or asks "why is
<X>so big?" - A new dependency was added and bundles grew — they want to understand why and unwind it.
- The user wants to set a performance budget and enforce it iteratively.
Why iterative (not "apply all optimizations at once")
Bundle optimization is full of foot-guns. Examples:
- Moving a "client-only" dep behind
next/dynamiccan break SSR consumers that depended on its presence at first paint. experimental.optimizePackageImportswith the wrong package can mis-resolve subpath exports.- Aggressive
modularizeImportsregex rewrites can hit unintended modules. - Narrowing the polyfill target can break older mobile browsers in production.