wsimmonds avatar

Nextjs Server Navigation

Handles the difference between server and client navigation in Next.js so you stop reflexively adding 'use client' just to use Link components. Covers Link for static routes, redirect() for conditional server-side routing, and server actions for form-based navigation. The key insight is that Link works perfectly fine in async server components, and redirect() lets you bail out based on auth checks or data without touching client hooks. If you've been converting server components to client components just to add navigation, or you're unclear when to use useRouter() versus redirect(), this clarifies the boundaries. Includes comparison tables and TypeScript examples throughout.

skills.sh installs
305
GitHub stars
110
last updated
Aug 21, 2026

Install

$ npx -y skills add wsimmonds/claude-nextjs-skills --skill nextjs-server-navigation --agent claude-code

Installs into .claude/skills of the current project.

Files

Next.js: Server Component Navigation Pattern

⚠️ CRITICAL RULE

Server Components use DIFFERENT navigation methods than Client Components!

When requirements call for server-rendered navigation—for example, linking to other pages, redirecting after a check, or demonstrating routing patterns—prefer <Link> and redirect() within Server Components. You still avoid 'use client' unless a client-only API is involved.

The Pattern

Scenario: build a server component that demonstrates proper navigation patterns

✅ CORRECT Solution:

// app/page.tsx (Server Component - NO 'use client'!)
import Link from 'next/link';

export default async function Page() {
  return (
    <div>
      <h1>Home</h1>
      <Link href="/dashboard">Go to Dashboard</Link>
      <Link href="/profile">View Profile</Link>
    </div>
  );
}

❌ WRONG Solution:

// app/page.tsx
'use client';  // ❌ NO! Server components don't need this for navigation!

import { useRouter } from 'next/navigation';  // ❌ Wrong for server components

export default function Page() {
  const router = useRouter();  // ❌ This is client-side navigation
  // ...
}

Sponsors

Details

Repository
github.com/wsimmonds/claude-nextjs-skills
Categories
Frontend Development, Backend & APIs, Documentation
First seen
Jun 3, 2026

More from wsimmonds/claude-nextjs-skills

All 9
1wix avatarwix-cli-site-componentwix/skillsUse when building React site components with editor manifests for Wix CLI applications. Triggers include site component, editor manifest, custom component, visu288skills.sh installs
2gohypergiant avataraccelint-react-testinggohypergiant/agent-skillsUse when writing, reviewing, or refactoring React component tests with Testing Library. Load when you see render(), screen, fireEvent, userEvent, waitFor, or *.282skills.sh installs
3patricio0312rev avatardesign-to-component-translatorpatricio0312rev/skillsConverts Figma/design specifications into production-ready UI components with accurate spacing, typography, color tokens, responsive rules, and interaction stat272skills.sh installs
4html2png avatarhtml-to-imagehtml2png/skillsGenerate crisp, high-quality images with perfect typography and precise geometric layouts using HTML/CSS. Use when creating social cards, diagrams, certificates270skills.sh installs
5patricio0312rev avatarcomponent-scaffold-generatorpatricio0312rev/skillsGenerates clean React/Vue component skeletons with TypeScript types, prop variants, styling hooks, test files, Storybook stories, and usage documentation. Use w269skills.sh installs
6existential-birds avatarzustand-stateexistential-birds/beagleZustand state management for React and vanilla JavaScript. Use when creating stores, using selectors, persisting state to localStorage, integrating devtools, or258skills.sh installs