From harness-claude
Enables React Server Components to eliminate client JavaScript and directly access data in server components. Provides patterns for splitting server and client components using 'use client' directive.
How this skill is triggered — by the user, by Claude, or both
Slash command
/harness-claude:react-server-componentsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> Run components on the server to eliminate client JavaScript and enable direct data access
Run components on the server to eliminate client JavaScript and enable direct data access
'use client' unless needed.async/await directly: const data = await db.query(...)'use client' directive at the top of a file when the component needs:
useState, useEffect, or any hookswindow, document)onClick, onChange)children props).// Server Component (no 'use client')
async function ProductPage({ id }: { id: string }) {
const product = await db.products.findById(id); // direct DB access
return (
<div>
<h1>{product.name}</h1>
<AddToCartButton productId={id} /> {/* Client Component */}
</div>
);
}
// Client Component
'use client';
function AddToCartButton({ productId }: { productId: string }) {
return <button onClick={() => addToCart(productId)}>Add to Cart</button>;
}
RSC introduces a server/client component split at the file level. The framework serializes server-rendered output as a JSON-like payload (RSC payload) and sends it to the client for React to reconcile.
What RSC eliminates:
Common mistakes:
'use client' to every file "to be safe" — this negates RSC benefitsuseEffect for data fetching in client components when a server component would workFramework support (2024): Next.js App Router is the primary production implementation. Remix, Waku, and other frameworks have RSC support in various stages.
https://patterns.dev/react/react-server-components
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeGuides React Server Components in Next.js: server vs client distinction, 'use client' directive, component boundaries, composition patterns, and data fetching.
Guides usage of Next.js Server Components for server-side data fetching and minimizing client bundle size. Covers async components, 'use client' boundaries, and server-only modules.
React Server Components patterns for Next.js 16. Server vs Client boundaries, async components, data fetching, serialization rules, streaming with Suspense.