react-server-components
/react-server-components
React Server Components (RSC) for server-side rendering without client JS. Covers Server vs Client components, data fetching patterns, Server Actions, streaming, caching, and Next.js App Router integration. USE WHEN: user mentions "Server Components", "RSC", "Next.js App Router", "use server", "Server Actions", "async components", asks about "server-side React", "zero bundle impact" DO NOT USE FOR: Client-only React apps (CRA, Vite), Next.js Pages Router, React < 18, Non-Next.js frameworks without RSC support
- Author
- claude-dev-suite ↗
- Repository
- claude-dev-suite ↗
- Licence
- MIT
- Last repository change
- 21.10.2026
Assessment and security
- Files in this package
- 2
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 2
No signals detected. Repository changed on 21.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
React Server Components (RSC) for server-side rendering without client JS. Covers Server vs Client components, data fetching patterns, Server Actions, streaming, caching, and Next.js App Router integration. USE WHEN: user mentions "Server Components", "RSC", "Next.js App Router", "use server", "Server Actions", "async components", asks about "server-side React", "zero bundle impact" DO NOT USE FOR: Client-only React apps (CRA, Vite), Next.js Pages Router, React < 18, Non-Next.js frameworks without RSC support
Triggers from the description
Original author description
React Server Components (RSC) for server-side rendering without client JS. Covers Server vs Client components, data fetching patterns, Server Actions, streaming, caching, and Next.js App Router integration. USE WHEN: user mentions "Server Components", "RSC", "Next.js App Router", "use server", "Server Actions", "async components", asks about "server-side React", "zero bundle impact" DO NOT USE FOR: Client-only React apps (CRA, Vite), Next.js Pages Router, React < 18, Non-Next.js frameworks without RSC support
How it works
- When NOT to Use This Skill
- Overview
- Server Components (Default in Next.js App Router)
- Client Components
- Composition: Server + Client
- Server Actions
- When to Use Server vs Client
- Anti-Patterns
- Quick Troubleshooting
- Best Practices
SKILL.md preview
---
name: react-server-components
description: |
React Server Components (RSC) for server-side rendering without client JS.
Covers Server vs Client components, data fetching patterns, Server Actions,
streaming, caching, and Next.js App Router integration.
USE WHEN: user mentions "Server Components", "RSC", "Next.js App Router", "use server",
"Server Actions", "async components", asks about "server-side React", "zero bundle impact"
DO NOT USE FOR: Client-only React apps (CRA, Vite), Next.js Pages Router,
React < 18, Non-Next.js frameworks without RSC support
allowed-tools: Read, Grep, Glob, Write, Edit
---
# React Server Components
> **Full Reference**: See [advanced.md](advanced.md) for streaming patterns, caching strategies, advanced composition patterns, error handling, and parallel/sequential data fetching.
> **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `react`, topic: `server-components` for comprehensive documentation.
## When NOT to Use This Skill
- Building client-only apps (CRA, Vite)
- Using Next.js Pages Router
- React version < 18
- Framework doesn't support RSC
## Overview
```
┌─────────────────────────────────────────────────────────────────┐
│ Server │
├─────────────────────────────────────────────────────────────────┤
│ Server Components │
│ • Run only on server │
│ • Can access databases, filesystems, secrets │
│ • Zero bundle size impact │
│ • No hooks (useState, useEffect) │
├─────────────────────────────────────────────────────────────────┤
│ Client │
├─────────────────────────────────────────────────────────────────┤
│ Client Components │
│ • Run on client (and server for SSR) │
│ • Can use hooks, event handlers │
│ • Interactive │
│ • Add to JS bundle │
└─────────────────────────────────────────────────────────────────┘
```
---
## Server Components (Default in Next.js App Router)
```tsx
// app/users/page.tsx - Server Component by default
import { db } from '@/lib/db';
export default async function UsersPage() {
// Direct database access - no API layer needed!
const users = await db.user.findMany({
orderBy: { createdAt: 'desc' },
take: 10,
});
return (
<ul>
{users.map(user => (
<li key={user.id}>{user.name}</li>
))}
</ul>
);
}
```
### Accessing Server-Only Resources
```tsx
// app/dashboard/page.tsx
import { cookies, headers } from 'next/headers';
export default async function DashboardPage() {
const cookieStore = await cookies();
const token = cookieStore.get('session')?.value;
const user = await verifyToken(token);
if (!user) {
redirect('/login');
}
const stats = await db.stats.findUnique({
where: { userId: user.id },
});
return <Dashboard user={user} stats={stats} />;
}
```
---
## Client Components
Add `'use client'` directive for interactivity:
```tsx
// components/counter.tsx
'use client';
import { useState } from 'react';
export function Counter() {
const [count, setCount] = useState(0);
return (
<button onClick={() => setCount(c => c + 1)}>
Count: {count}
</button>
);
}
```
---
## Composition: Server + Client
```tsx
// app/products/page.tsx (Server Component)
import { db } from '@/lib/db';
import { FilterSidebar } from '@/components/filter-sidebar';
export default async function ProductsPage({ searchParams }) {
const products = await db.product.findMany({
where: { category: searchParams.category },
});
const categories = await db.category.findMany();
return (
<div className="flex">
{/* Client Component for interactivity */}
<FilterSidebar categories={categories} />
{/* Server-rendered products */}
<ProductGrid products={products} />
</div>
);
}
```
---
## Server Actions
Mutate data from client with server functions:
```tsx
// app/actions.ts
'use server';
import { revalidatePath } from 'next/cache';
import { redirect } from 'next/navigation';
import { z } from 'zod';
const CreatePostSchema = z.object({
title: z.string().min(3).max(100),
content: z.string().min(10),
});
export async function createPost(formData: FormData) {
const validated = CreatePostSchema.safeParse({
title: formData.get('title'),
content: formData.get('content'),
});
if (!validated.success) {
return { error: validated.error.flatten().fieldErrors };
}
const user = await getCurrentUser();
if (!user) {
return { error: { auth: ['Unauthorized'] } };
}
const post = await db.post.create({
data: { ...validated.data, authorId: user.id },
});
revalidatePath('/posts');
redirect(`/posts/${post.id}`);
}
```
### Using Server Actions
```tsx
// Option 1: In a form
export default function CreatePostPage() {
return (
<form action={createPost}>
<input name="title" required />
<textarea name="content" required />
<button type="submit">Create Post</button>
</form>
);
}
// Option 2: With useActionState for loading/error states
'use client';
import { useActionState } from 'react';
import { createPost } from '@/app/actions';
export function CreatePostForm() {
const [state, formAction, isPending] = useActionState(createPost, null);
return (
<form action={formAction}>
<input name="title" required />
{state?.error?.title && <p className="error">{state.error.title[0]}</p>}
<button type="submit" disabled={isPending}>
{isPending ? 'Creating...' : 'Create Post'}
</button>
</form>
);
}
```
---
## When to Use Server vs Client
| Server Components | Client Components |
|-------------------|-------------------|
| Data fetching | Event handlers (onClick, onChange) |
| Database access | useState, useEffect |
| Sensitive logic (secrets) | Browser APIs |
| Heavy dependencies | Interactivity |
| Static content | Real-time updates |
```tsx
// Decision tree:
// 1. Does it need interactivity? → Client
// 2. Does it use hooks? → Client
// 3. Does it need browser APIs? → Client
// 4. Everything else → Server (default)
```
---
## Anti-Patterns
| Anti-Pattern | Why It's Bad | Correct Approach |
|--------------|--------------|------------------|
| Making everything Client Component | Loses RSC benefits | Default to Server, client only when needed |
| Passing functions to Client Components | Not serializable | Use Server Actions |
| Fetching data in Client Components | Slower, larger bundle | Fetch in Server Components |
| Not using Suspense | Sequential loading | Add Suspense boundaries |
| Exposing secrets in Client | Security risk | Keep in Server Components |
## Quick Troubleshooting
| Issue | Likely Cause | Solution |
|-------|--------------|----------|
| "use client" not working | Wrong file location | Add to top of file |
| Cannot pass function as prop | Functions not serializable | Use Server Action |
| Hooks error in Server Component | Using client hooks | Add "use client" directive |
| Data not updating | Cache not revalidated | Use `revalidatePath` or `revalidateTag` |
| Slow data fetching | Sequential fetches | Use parallel Promise.all |
## Best Practices
- ✅ Default to Server Components
- ✅ Use `'use client'` only when needed
- ✅ Keep Client Components small and focused
- ✅ Pass Server Components as children to Client
- ✅ Use Suspense for streaming
- ✅ Use Server Actions for mutations
- ❌ Don't fetch data in Client Components if avoidable
- ❌ Don't pass functions as props to Client Components
## Reference Documentation
- [Server Components](https://react.dev/reference/rsc/server-components)
- [Next.js App Router](https://nextjs.org/docs/app)
Files in this package (2)
- SKILL.md 9 KB
- advanced.md 6 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · claude-dev-suite/claude-dev-suite | 100 | MIT |
| j4flmao/agent-skills | 100 | MIT |
| nextboxis/library-skill-agents | 100 | MIT |
| chrishuffman5/domain-expert | 100 | MIT |
| Thisisjuke/skills | 90 | MIT |
Database snapshot: 13.11.2026 · package version 40e695c8a039 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100react-rsc
Use when working with React Server Components — choosing between Server and Client components, designing the server/client boundary, debugging hydration mismatches, fetching data on the server, using Server Actions, optimizing initial load, or migrating from a Pages Router or… - 100react-server-components-framework
Use when building Next.js 16+ apps with React Server Components. Covers App Router, Cache Components (replacing experimental_ppr), streaming SSR, Server Actions, and React 19 patterns for server-first architecture. - 95nextjs-app-router
Next.js 14+ App Router. Covers Server Components, routing, data fetching, caching, and deployment. Use when building Next.js applications with the App Router. USE WHEN: user mentions "Next.js", "App Router", "Server Components", "RSC", asks about "server actions", "Next.js… - 100nextjs-expert
Expert Next.js App Router: Server vs Client Components, data fetching, caching, server actions, and rendering strategy. Trigger keywords: Next.js, App Router, Server Components, RSC, use client, use server, server actions, route handler, generateStaticParams, revalidate,… - 100nextjs-app-router-expert
Expert in Next.js 14/15 App Router architecture, React Server Components (RSC), Server Actions, and modern full-stack React development. Specializes in routing patterns, data fetching strategies, caching, streaming, and deployment optimization. Use when the user explicitly needs… - 100server-components
This skill should be used when the user asks about "Server Components", "Client Components", "'use client' directive", "when to use server vs client", "RSC patterns", "component composition", "data fetching in components", or needs guidance on React Server Components architecture in Next.js.