One-click install
npx skills add https://github.com/SouleymaneSy7/dots-files --skill next-best-practices-souleymanesy7
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-best-practices
Source: https://github.com/SouleymaneSy7/dots-files/tree/main/opencode/skills/next-best-practices
Command: npx skills add https://github.com/SouleymaneSy7/dots-files --skill next-best-practices-souleymanesy7

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill ensures that you apply best practices in Next.js development, leading to more efficient, maintainable, and optimized web applications.

Core Features & Use Cases

  • File Conventions: Adhere to established file naming and structure conventions for clarity and consistency.
  • RSC Boundaries: Identify and prevent invalid React Server Component patterns to avoid common pitfalls.
  • Async Patterns: Optimize Next.js 15+ async API usage for better performance and reliability.
  • Runtime Selection: Choose the appropriate runtime (Node.js or Edge) based on your project's needs.
  • Directives: Utilize React and Next.js directives for efficient code organization and execution.
  • Error Handling: Implement robust error handling to improve user experience and debug more effectively.
  • Data Patterns: Select the right data fetching patterns for different use cases.
  • Route Handlers: Create efficient API endpoints using Next.js Route Handlers.
  • RSC Boundaries: Detect and prevent invalid React Server/Client component patterns.
  • Hydration Errors: Diagnose and fix React hydration mismatch errors for smoother rendering.
  • Suspense Boundaries: Use Suspense boundaries to manage client-side rendering and improve performance.
  • Parallel & Intercepting Routes: Implement modal patterns with parallel and intercepting routes.
  • Self-Hosting: Deploy Next.js outside of Vercel, optimizing for production environments.
  • Debug Tricks: Utilize advanced debugging techniques for Next.js applications.
  • Metadata & OG Images: Generate metadata and Open Graph images for improved SEO.
  • Image Optimization: Optimize images for the web using Next.js and third-party services.
  • Font Optimization: Optimize font delivery and performance with next/font.
  • Bundling: Manage and optimize the bundling process for efficient builds.
  • Migrating from Webpack to Turbopack: Migrate from Webpack to the new Turbopack bundler for improved performance.

Quick Start

To apply Next.js best practices, begin by reviewing the file-conventions.md for guidelines on project structure and special files.

Frequently Asked Questions about next-best-practices

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

FAQPage Schema
How do I fix React hydration mismatch errors in Next.js?

To fix React hydration errors in Next.js, you diagnose rendering mismatches between server and client using specific debug tricks, and manage client-side rendering with Suspense boundaries to ensure smoother output.

What are the best practices for Next.js async API usage and data fetching?

Next.js async API best practices involve optimizing Next.js 15+ async usage for reliability and selecting the right data fetching patterns for different use cases to enhance overall application performance.

How do I prevent invalid React Server Component patterns in Next.js?

To prevent invalid React Server Component patterns in Next.js, you identify and detect invalid React Server/Client component boundaries, ensuring correct component separation and avoiding common structural pitfalls.

Can I self-host a Next.js application outside of Vercel?

Yes, you can self-host Next.js applications outside of Vercel by following specific guidelines to optimize your application for production environments and ensure efficient deployment.

How do I migrate from Webpack to Turbopack in Next.js?

To migrate from Webpack to Turbopack in Next.js, you utilize provided guidelines to transition bundlers, managing and optimizing the bundling process to achieve improved build performance.

What is the best way to optimize images and fonts in Next.js?

The best way to optimize images and fonts in Next.js is using next/font for font delivery and third-party services for image optimization, alongside generating metadata and Open Graph images for improved SEO.