writing-skills
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
nextjsAssists with building production-grade React applications using Next.js. Use when working with the App Router, Server Components, Server Actions, Middleware, or deploying to Vercel or self-hosted environments. Trigger words: nextjs, next.js, app router, server components, server actions, react framework, ssr, isr.
Independent GitHub snapshot · Automated classification · Original documentation governs
Next.js is a full-stack React framework featuring the App Router with Server Components, Server Actions for mutations, and multiple rendering strategies (SSG, SSR, ISR, PPR). It provides automatic code splitting, image optimization, and deployment options from Vercel to self-hosted Docker.
app/ directory with page.tsx for pages, layout.tsx for persistent layouts, loading.tsx for streaming, and error.tsx for error boundaries."use client" only for components needing event handlers, hooks, or browser APIs.async/await, use fetch() with caching options (revalidate, force-cache), and co-locate data fetching with the component that needs it."use server" directive and <form action={...}> for progressive enhancement, then call revalidatePath() or revalidateTag() after mutations.revalidate for most pages, use generateStaticParams() for fully static pages, and dynamic = "force-dynamic" only when fresh data is required on every request.middleware.ts at the project root for auth redirects, geolocation, and A/B testing with matcher config to scope it to specific routes.next/image for all images (WebP/AVIF, lazy loading), next/font for zero layout shift fonts, and generateMetadata() for dynamic SEO.User request: "Create a Next.js dashboard with server-side data fetching and streaming"
Actions:
layout.tsx and parallel routes for widgetsloading.tsx for Suspense-based streaming of slow componentsrevalidate for ISR to balance freshness and performanceOutput: A fast dashboard that streams data progressively with zero client-side JavaScript for data fetching.
User request: "Implement login/signup with Server Actions and middleware protection"
Actions:
<form action={loginAction}> using Server Actions/dashboard/*useOptimistic() for instant form feedbackOutput: A progressively enhanced auth system with server-side validation and route protection.
"use client" only for interactivity (event handlers, hooks, browser APIs).loading.tsx at route boundaries for streaming; do not block the entire page on a slow query.generateMetadata() for dynamic pages; static metadata export for fixed pages.revalidate on fetch calls or at page level: ISR is almost always better than full SSR.next/image for all images; the optimization is significant (WebP/AVIF, lazy loading, responsive).