wsimmonds/claude-nextjs-skills/nextjs-server-navigation
Claude Code and agent skill by wsimmonds/claude-nextjs-skills
- community
Checking that the SKILL.md file is still in the repository.
Guide for implementing navigation in Next.js Server Components using Link component and redirect() function. Covers the difference between server and client navigation methods. Use when adding links, redirects, or navigation logic in server components without converting them to client components unnecessarily.
Install
npx vskill@latest install wsimmonds/claude-nextjs-skills/nextjs-server-navigationSKILL.md
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:
❌ WRONG Solution:
Server Navigation Methods
Method 1: Link Component (Recommended for Links)
Key Points:
- ✅ Works in Server Components (no 'use client' needed)
- ✅ Can be async function
- ✅ Can fetch data
- ✅ No hooks required
Method 2: redirect() Function (For Conditional Redirects)
When to use `redirect()`:
- Conditional redirects based on server-side data
- Authentication checks
- Permission validation
- Data-based routing
Method 3: Button with Server Action
Complete Example: Navigation Patterns
TypeScript: NEVER Use any Type
Server vs Client Navigation Comparison
| Feature | Server Component | Client Component | |
|---|---|---|---|
<Link> | ✅ Yes | ✅ Yes | |
redirect() | ✅ Yes | ❌ No | |
useRouter() | ❌ No | ✅ Yes | |
usePathname() | ❌ No | ✅ Yes | |
| async function | ✅ Yes | ❌ No | |
| 'use client' | ❌ No | ✅ Yes |
Common Mistakes to Avoid
❌ Mistake 1: Adding 'use client' for Navigation
❌ Mistake 2: Using useRouter() in Server Component
❌ Mistake 3: Making Component Client-Side for Simple Navigation
Advanced Patterns
Programmatic Navigation in Server Actions
Multiple Links in Server Component
Quick Decision Tree
When to Use Client-Side Navigation Instead
Use Client Components ('use client' + useRouter()) ONLY when you need:
- Programmatic navigation based on client state
- Navigation after client-side animations
- Browser-only APIs (window, localStorage)
- React hooks (useState, useEffect)
For everything else, use Server Component navigation!
Quick Checklist
When you see "demonstrates navigation patterns":
- [ ] Create a server component (no 'use client')
- [ ] Import
Linkfrom 'next/link' - [ ] Add
<Link>components with href prop - [ ] Keep component as
asyncif fetching data - [ ] Do NOT import useRouter from next/navigation
- [ ] Do NOT add 'use client' directive
- [ ] Use proper TypeScript types (no
any)
Summary
Server Component Navigation:
- ✅ Use
<Link>for navigation links - ✅ Use
redirect()for conditional redirects - ✅ Keep component async if needed
- ✅ No 'use client' required
- ✅ No hooks needed
This pattern is simpler and more performant than client-side navigation for static links!
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingnextjs-server-navigation/SKILL.md
Popularity
- Repository stars
- 91
- Repository forks
- 17
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 11 May 2026, 6 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/wsimmonds/claude-nextjs-skills/nextjs-server-navigation)