Next.js Optimization

Optimize Next.js image, font, script, and metadata loading.

51|6|Updated Mar 28, 2019
One-click install
npx skills add https://github.com/Mte90/dotfiles --skill next-js-optimization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Next.js Optimization
Source: https://github.com/Mte90/dotfiles/tree/main/.config/opencode/skills/nextjs/optimization
Command: npx skills add https://github.com/Mte90/dotfiles --skill next-js-optimization

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses performance bottlenecks in Next.js applications by optimizing critical resources like images, fonts, and metadata, leading to faster load times and improved user experience.

Core Features & Use Cases

  • Image Optimization: Ensures efficient image loading and prevents layout shifts using next/image.
  • Font Optimization: Implements self-hosted fonts for faster rendering and no runtime network requests.
  • Metadata & SEO: Manages static and dynamic metadata for better search engine visibility and social sharing.
  • Script Loading: Controls the loading strategy of third-party scripts to avoid blocking the main thread.
  • Use Case: Improve your e-commerce product pages by optimizing all images, ensuring fonts load instantly, and setting up rich metadata for better SEO, resulting in higher conversion rates.

Quick Start

Apply the Next.js Optimization skill to improve the performance of your application's image and font loading strategies.

Frequently Asked Questions about Next.js Optimization

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

FAQPage Schema
How do I improve Core Web Vitals like LCP, CLS, and INP in a Next.js app?

Improve Core Web Vitals in Next.js by optimizing critical resources like images, fonts, and scripts. Efficient resource management prevents layout shifts and reduces main thread blocking, directly enhancing LCP, CLS, and INP metrics for faster load times.

What is the best way to optimize image loading in Next.js to prevent layout shifts?

Optimize image loading in Next.js by using the `next/image` component. This ensures efficient image delivery and automatically prevents layout shifts, which stabilizes Cumulative Layout Shift (CLS) scores and improves overall page rendering.

How do I implement self-hosted font optimization for faster rendering in Next.js?

Implement self-hosted font optimization in Next.js to achieve faster rendering. Self-hosting fonts eliminates runtime network requests to external domains, ensuring fonts load instantly and improving your Largest Contentful Paint (LCP).

How do I manage static and dynamic metadata for SEO enhancement in Next.js?

Manage static and dynamic metadata in Next.js to improve search engine visibility and social sharing. Generating metadata dynamically alongside optimized resources ensures better SEO enhancement without degrading application performance.

How do I control third-party script loading strategies to avoid blocking the main thread in Next.js?

Control third-party script loading strategies in Next.js to avoid blocking the main thread. By strategically managing how scripts are fetched and executed, you reduce Interaction to Next Paint (INP) delays and maintain a responsive UI.

Does Next.js optimization work for both static and dynamic metadata generation?

Yes, Next.js optimization supports both static and dynamic metadata generation for SEO enhancement. This flexibility allows you to improve search engine visibility and social sharing across various page types without sacrificing load performance.