Web · Claude Skill

Next.js Full Stack Skill

App router patterns, server components, API routes, and Next.js 14+ conventions baked into every response.

Next.js · React

What it does

The Next.js Full Stack Skill teaches Claude Code the App Router mental model and the dozens of small conventions that separate shipped Next.js apps from tutorial code. Without it, Claude defaults to pages/ patterns, sprinkles 'use client' over every component, writes API routes for every form, and generates untyped fetches. With it, Claude defaults to the right layer on the first try — Server Components for data, Server Actions for mutations, client boundaries only where they are actually needed.

What Claude does once this skill is installed

When you ask Claude to build a new feature, it creates a Server Component page, places the data fetch at the top of the component, adds a loading.tsx and error.tsx next to the route, and puts form submissions in a Server Action colocated with the component that calls it. TypeScript stays strict: no any, no untyped fetches, no hidden inference. Styling defaults to Tailwind plus shadcn/ui primitives, with className composition via the cn() helper. The skill covers App Router structure, data fetching patterns, TypeScript conventions, file organization, and styling in one document.

Who should use it

Anyone who has migrated a codebase from pages/ to app/ and is tired of explaining the difference on every prompt. Teams onboarding developers new to App Router get a consistent answer to every 'should this be server or client?' question. Solo developers building SaaS or internal tools get a Claude that matches how modern Next.js is actually deployed in production.

What it solves

If you have ever had to rewrite a Claude-generated component because it was a client component that fetched in useEffect, or because it wrote an API route when a Server Action would have been a single function, this skill removes that entire class of correction. The conventions live in one file. Claude reads it at the start of every relevant session and applies it automatically.

How to install

Which tool are you using?

Not sure? Claude.ai is the website. Claude Code is the command-line tool you install separately. Cursor is a code editor that reads .cursorrules.

  1. 01

    Open your terminal

    Open Terminal on Mac (Applications → Utilities → Terminal) or Command Prompt / PowerShell on Windows.

    Claude Code is a terminal-based tool. If you have never used Claude Code before, install it first with: npm install -g @anthropic-ai/claude-code

  2. 02

    Navigate to your Next.js project

    Change directory to your Next.js project folder. Replace the placeholder with your actual path:

    terminal
    cd ~/your-nextjs-project

    Not sure where your project is? In Finder (Mac) or File Explorer (Windows), right-click your project folder → 'Copy as path' and paste after 'cd '.

  3. 03

    Start Claude Code

    Launch Claude Code in this project folder:

    terminal
    claude

    If you see 'command not found', install Claude Code first: npm install -g @anthropic-ai/claude-code

  4. 04

    Download the skill file

    Click the 'Download Skill' button in the file section below to save nextjs.md to your computer. Most browsers save to the Downloads folder by default.

  5. 05

    Install the skill

    Back in your terminal, add the skill to Claude Code (replace the path if your Downloads folder is different):

    terminal
    claude skills add ~/Downloads/nextjs.md

    On Windows the path looks like: C:\Users\YourName\Downloads\nextjs.md

  6. 06

    Verify the skill is active

    List installed skills — you should see 'nextjs-fullstack' in the output.

    terminal
    claude skills list

    Now ask Claude to build a new route or feature — it will default to Server Components, Server Actions, and strict TypeScript automatically.

The claude skill file

Copy the full contents below, or download the file directly.

nextjs.md
nextjs.md
---name: nextjs-fullstackdescription: Use this skill for any Next.js 14+ development task. Activates App Router patterns, server component defaults, Server Actions, strict TypeScript, and production conventions.--- # Next.js Full Stack Skill Use this skill whenever you are writing or modifying a Next.js 14+ project using the App Router. ## App Router Mental Model- App Router only — never suggest the pages/ directory for new code- Server Components are the default; add 'use client' ONLY when a component needs event handlers, browser APIs, or React state- Colocate loading.tsx, error.tsx, not-found.tsx next to the route they belong to- Use route groups (folder) to organize files without affecting URL structure- Prefer nested layouts over client-side layout shifts- Dynamic routes use [param] and catch-alls use [...param] or [[...param]] ## File Structure```app/  (marketing)/          # Route group, not in URL    page.tsx            # /    pricing/page.tsx    # /pricing  (app)/                # Authenticated app    layout.tsx          # Shared dashboard shell    dashboard/page.tsx  # /dashboard  api/                  # Route handlers (only when Server Actions cannot work)    webhook/route.tscomponents/             # Reusable UI  ui/                   # shadcn primitives  [feature]/            # Feature componentslib/                    # Pure logic, DB clients, server-only utilities  db.ts  auth.ts  utils.ts``` ## Data Fetching- Fetch in Server Components whenever possible — never via useEffect on first paint- Use async components with typed fetch calls- Use Server Actions ('use server') for mutations, not API routes- Tag fetches with { next: { tags: ['tag'] } } and revalidateTag for targeted invalidation- Use revalidatePath only when tag-based invalidation is not precise enough- For streaming, wrap slow children in Suspense with a meaningful fallback ## TypeScript- strict: true, noUncheckedIndexedAccess: true, noImplicitAny: true- Never use any — use unknown and narrow with type guards- Prefer type over interface except when you need declaration merging- Name component props as ComponentNameProps- Type Server Action signatures explicitly; do not rely on inference for public API ## Performance- next/image with explicit width/height for LCP images- next/font for custom fonts (never <link rel="stylesheet" href="google fonts">)- dynamic() with ssr:false only for truly client-only libraries- generateStaticParams for known dynamic routes at build time- Prefer streaming + Suspense over route-level loading spinners ## Styling- Tailwind CSS as the primary styling solution- shadcn/ui for UI primitives (Button, Dialog, Form, Input, etc.)- Compose classNames with the cn() helper from lib/utils- Avoid inline style except for truly dynamic values (e.g. background-image with runtime URL) ## Forms and Validation- Zod schemas for every form input, reused on client and server- Server Actions validate with schema.parse() at the top of the action- Surface field errors via useActionState or server-returned error objects- Never trust client-side validation alone ## Database- Drizzle or Prisma — pick one per project and stick with it- Initialize the client in lib/db.ts and import from there only on the server- Never import the DB client from a client component file- Migrations are committed; applied migrations are never edited ## Conventions- One Server Action per mutation, colocated with the component that calls it- No business logic in page.tsx — lift into lib/ or a feature folder- Error boundaries at meaningful unit boundaries (route, feature), not the whole app- Environment variables validated at boot with Zod (server.ts pattern)

Example output

What Claude does before and after you install this claude skill.

Without this claude skill

Claude writes a client component that fetches data with useEffect, puts business logic in the page file, and adds an API route for every form submission.

With this claude skill

Claude writes a server component with a typed fetch, puts mutations in a Server Action colocated with the form, and uses Suspense + loading.tsx for streaming.

Customization tips

Edit the Data Fetching section if you use tRPC or GraphQL — the defaults assume Server Actions. If you still need pages/ for legacy reasons, add a section explicitly allowing it for specific routes. The File Structure section is worth customizing per project: teams that use feature folders vs route-first folders should reflect their choice here.

Related resources

Frequently asked questions

Does this work with Next.js 13?

The skill targets Next.js 14+ App Router. Most patterns still work on 13 but Server Actions stability and parallel routes differ. Upgrade if you can.

What if my project still uses the pages/ directory?

The skill will nudge you toward App Router patterns. If you need to keep pages/ for specific legacy routes, add a paragraph to your CLAUDE.md explicitly allowing it for those paths.

Does it force Tailwind?

The default is Tailwind + shadcn/ui because that is what most Next.js teams use. Edit the Styling section of nextjs.md to switch to CSS modules, vanilla-extract, or styled-components.

Does it cover authentication?

It covers the structural patterns — where auth middleware lives, how Server Actions validate sessions — but not a specific auth provider. Pair it with the Supabase + Next.js cursor rules for Supabase auth.

Can I combine this skill with a project CLAUDE.md?

Yes, that is the recommended setup. The skill covers Next.js conventions. Your CLAUDE.md covers project-specific details like route map, DB schema, and feature flags. Claude reads both.

Want more like this?

Browse the full RohanKit library — free resources for Claude and Cursor.

Back to RohanKit