server-component-patterns

Determine Server or Client Component usage in Next.js app router layouts.

9|1|Updated Jun 16, 2026
One-click install
npx skills add https://github.com/AratKruglik/antigravity-sdlc --skill server-component-patterns-aratkruglik
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: server-component-patterns
Source: https://github.com/AratKruglik/antigravity-sdlc/tree/main/plugins/nextjs-plugin/skills/server-component-patterns
Command: npx skills add https://github.com/AratKruglik/antigravity-sdlc --skill server-component-patterns-aratkruglik

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Boundary discipline between Server Components and Client Components in Next.js. It clarifies when to use "use client", how to structure components, and how to implement Server Actions safely to prevent serialization issues and ensure data integrity.

Core Features & Use Cases

  • Decide whether a component should be RSC or Client.
  • Push the "use client" boundary as deep as possible.
  • Implement Server Actions correctly (auth, validation, revalidation).
  • Compose RSC and Client components without breaking the model.
  • Pass data across the boundary safely.

Quick Start

Start by identifying a page that renders data and separate interactive components into a Client subtree while keeping data-fetching and rendering in a Server Component.

Frequently Asked Questions about server-component-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decide whether a component should be a Server Component or a Client Component in Next.js?

To decide between a Server Component or Client Component in Next.js, evaluate if the component requires interactivity or hooks; if not, keep it as a Server Component to push the "use client" boundary as deep as possible.

How do I implement Server Actions safely in Next.js without breaking the component model?

To implement Server Actions safely in Next.js, ensure you enforce proper authentication, input validation, and data revalidation within the Server Component to maintain boundary discipline and prevent serialization issues.

Why does passing data across the Server/Client boundary in Next.js cause serialization issues?

Passing data across the Server/Client boundary in Next.js causes serialization issues when non-serializable data like functions are passed to Client Components, requiring strict separation of server-only logic from interactive client-side code.

What is the best way to structure Next.js app router layouts to separate server-only logic from interactivity?

The best way to structure Next.js app router layouts is to keep data-fetching and rendering in Server Components while isolating interactive elements into a dedicated Client Component subtree, enforcing a robust boundary discipline.

Can I use Server Actions for data mutation without a separate API route in Next.js?

Yes, you can use Server Actions for data mutation directly within Next.js components without a separate API route, provided you correctly handle validation and revalidation to secure the Server/Client boundary.

What are the limitations of pushing the "use client" boundary deep into a Next.js component tree?

Pushing the "use client" boundary deep in Next.js limits your ability to fetch data directly on the server for those child components, requiring you to pass serialized data safely across the boundary from the parent Server Component.