GitHub CopilotNext.jsArchitecture

Next.js GitHub Copilot Instructions

GitHub Copilot custom instructions for Next.js App Router projects.

.github/copilot-instructions.md
- Default to Server Components; mark as 'use client' only when state or browser APIs are needed
- Use server actions for mutations; validate with zod before processing
- Generate proper TypeScript types for route params and searchParams
- Add generateMetadata export to all route segments with dynamic data
- Use Image component from next/image with explicit dimensions always
- Apply next-safe-action for type-safe, validated server actions
- Generate loading.tsx and error.tsx siblings for all layout segments
- Use the new cookies() and headers() APIs from next/headers in Server Components

How to use with GitHub Copilot

Create `.github/copilot-instructions.md` in your repository. GitHub Copilot uses these to customize suggestions across your whole repo.

#nextjs#copilot#github#app-router#coding-rules

Related Rules