wsimmonds avatar

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-code

Installs 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

More from wsimmonds/claude-nextjs-skills

All 9
1existential-birds avatarshadcn-uiexistential-birds/beagleshadcn/ui component patterns with Radix primitives and Tailwind styling. Use when building UI components, using CVA variants, implementing compound components, 356skills.sh installs
2patricio0312rev avatarresponsive-design-systempatricio0312rev/skillsImplements responsive design systems with mobile-first breakpoints, container queries, fluid typography, and adaptive layouts using Tailwind CSS. Use when users353skills.sh installs
3borghei avatarsenior-frontendborghei/claude-skillsFrontend development for React, Next.js, TypeScript, and Tailwind CSS. Use when building React components, optimizing Next.js performance, analyzing bundle size351skills.sh installs
4jamesrochabrun avatarfrontend-designerjamesrochabrun/skillsBuild accessible, responsive, and performant frontend components with design system best practices, modern CSS, and framework-agnostic patterns.340skills.sh installs
5gohypergiant avataraccelint-react-best-practicesgohypergiant/agent-skillsReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimiz335skills.sh installs
6dalestudy avatarreactdalestudy/skillsReact 성능 최적화 및 베스트 프랙티스 스킬. Vercel Engineering 가이드 기반, 프레임워크 비종속. 다음 상황에서 사용: (1) React 컴포넌트(.tsx, .jsx) 작성 또는 수정 시, (2) 상태 관리, hooks, 리렌더링 최적화 작업 시, (3) 비동기 데이334skills.sh installs