
Nextjs Server Client Components
This is your reference guide when you're confused about whether to add 'use client' to a Next.js component or getting errors mixing server and client APIs. It covers the critical patterns: accessing cookies and headers in server components, handling searchParams with proper async/await in Next.js 15+, and knowing when Link and redirect work server-side versus when you actually need useRouter on the client. The TypeScript section is unusually specific about avoiding `any` types, which suggests this came from a codebase with strict linting. Most useful when you're debugging "you're trying to use X in a server component" errors or wondering why useSearchParams needs Suspense boundaries.
- skills.sh installs
- 364
- GitHub stars
- 110
- last updated
- Aug 21, 2026
Install
$ npx -y skills add wsimmonds/claude-nextjs-skills --skill nextjs-server-client-components --agent claude-codeInstalls into .claude/skills of the current project.
Files
Next.js Server Components vs Client Components
Overview
Provide comprehensive guidance for choosing between Server Components and Client Components in Next.js App Router, including cookie/header access, searchParams handling, pathname routing, and React's 'use' API for promise unwrapping.
TypeScript: NEVER Use any Type
CRITICAL RULE: This codebase has @typescript-eslint/no-explicit-any enabled. Using any will cause build failures.
❌ WRONG:
function handleSubmit(e: any) { ... }
const data: any[] = [];
✅ CORRECT:
function handleSubmit(e: React.FormEvent<HTMLFormElement>) { ... }
const data: string[] = [];
Common Next.js Type Patterns
// Page props
function Page({ params }: { params: { slug: string } }) { ... }
function Page({ searchParams }: { searchParams: { [key: string]: string | string[] | undefined } }) { ... }
// Form events
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => { ... }
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => { ... }
// Server actions
async function myAction(formData: FormData) { ... }
When to Use This Skill
Sponsors
Details
- Repository
- github.com/wsimmonds/claude-nextjs-skills
- Categories
- Frontend Development, Backend & APIs, Documentation, AI & Agent Building
- First seen
- Jun 3, 2026