nextjs-optimizer

Audits and optimizes Next.js App Router projects across five performance areas.

Updated Apr 5, 2026
One-click install
npx skills add https://github.com/Simon-YHKim/eject-button --skill nextjs-optimizer-simon-yhkim
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nextjs-optimizer
Source: https://github.com/Simon-YHKim/eject-button/tree/main/.claude/skills/nextjs-optimizer
Command: npx skills add https://github.com/Simon-YHKim/eject-button --skill nextjs-optimizer-simon-yhkim

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Next.js applications often suffer from poor Core Web Vitals scores due to unoptimized images, oversized bundles, misconfigured rendering strategies, and uncontrolled third-party scripts. This Skill systematically audits a Next.js 13+ App Router project and produces actionable fixes with specific file paths and replacement code snippets. ## Core Features & Use Cases - Five-Area Performance Audit: Covers image optimization (next/image, CLS prevention), render strategy labeling (SSG/ISR/SSR/CSR), code splitting (dynamic imports, bundle under 200KB), script loading (next/script strategies), and data caching (unstable_cache with revalidateTag). - Automated img Tag Scanner: Ships a bash script that scans src/, app/, pages/, and components/ for raw <img> tags, counts occurrences per file, and prints replacement guidance. - Verification Workflow: Runs bundle analysis and Lighthouse checks against Core Web Vitals targets (LCP < 2.5s, CLS < 0.1, INP < 200ms). - Use Case: A developer notices their Next.js landing page has an LCP of 3.8 seconds. The Skill detects raw <img> tags, missing render strategy labels, and a 450KB initial bundle, then provides concrete next/image conversions and dynamic import snippets to fix each issue. ## Quick Start Ask the assistant to audit my Next.js project for performance issues and fix the slow LCP and large bundle size.

Frequently Asked Questions about nextjs-optimizer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize Next.js images for better LCP?

Replace all raw <img> tags with next/image, specifying width and height to prevent CLS. Add priority only to above-the-fold images, set sizes for responsive loading, and use placeholder="blur" with blurDataURL for low-quality placeholders.

How to reduce Next.js bundle size with dynamic imports?

Use next/dynamic to lazy-load heavy components like editors, charts, and PDF viewers with ssr: false and a loading skeleton. Target an initial bundle under 200KB gzipped and verify with @next/bundle-analyzer using ANALYZE=true npm run build.

When should I use SSG vs ISR vs SSR in Next.js App Router?

Use SSG for static content like landing pages, ISR with export const revalidate for periodically updated content like blogs or catalogs, and SSR with force-dynamic for per-request pages like dashboards. Label every page explicitly with its strategy.

Does this optimizer work with Pages Router or non-Next.js React apps?

No, it targets Next.js 13+ App Router specifically and exits immediately if package.json lacks the next dependency. It does not apply to plain React apps, Next.js tutorials, or project setup tasks.

Why does unstable_cache serve stale data in Next.js?

Stale data occurs when cached functions are not invalidated after mutations. Call revalidateTag with the matching cache tag inside every mutation that changes the underlying data, and document cached functions with a CACHED comment.