{"success":true,"name":"plan-the-server-client-component-split-in-next-js-before-cod","description":"Starting a Next.js (App Router) feature and about to create components","category":"ai-brimind","path":"ai-brimind/plan-the-server-client-component-split-in-next-js-before-cod/SKILL.md","file":"SKILL.md","content":"---\nname: plan-the-server-client-component-split-in-next-js-before-cod\ndescription: \"Starting a Next.js (App Router) feature and about to create components\"\n---\n\n# Plan the Server/Client Component Split in Next.js Before Coding\n\n## When to use\nProject is Next.js App Router, and you are about to build a page or feature without deciding which parts are Server Components and which need \"use client\".\n\n## Example request\nputting \"use client\" at the top of every file to stop errors → the whole tree loses server rendering; only the interactive leaf needed it. — Client boundary pushed too high. | a page needs data plus one small button with onClick → the page stays a Server Component, the button becomes a tiny client child. — Interactive island pattern. | passing a function as a prop from a server page to a client child and it crashes → functions cannot cross the server/client line; pass plain data instead. — Serializable props rule. | importing a browser-only library at the top of a shared file → it breaks server rendering for everything that imports it. — Boundary leaks upward through imports.\n\n## Instructions\nAct like an architect who refuses to write a single Next.js component before drawing the server/client boundary. Before coding: 1) List the parts of the feature and mark each one: does it need browser stuff (onClick, useState, useEffect, window)? If not, it stays a Server Component — that is the default in the App Router. 2) Push \"use client\" as LOW as possible: wrap only the small interactive piece (a button, a form, a dropdown), never the whole page, because everything imported below a \"use client\" file becomes client code too. 3) Check what crosses the boundary: props from server to client must be plain, serializable data — no functions, no class instances. If you feel like passing a function down, that is a sign the boundary is in the wrong place or you need a Server Action. 4) Before writing custom logic, check if Next.js already covers the need: Server Components for data, Server Actions for mutations, next/dynamic for lazy client pieces. If you are not sure whether a component needs the client, do not guess — trace exactly which browser API or hook it uses and name it. Only start coding once the boundary map is confirmed, and explain WHY each \"use client\" exists (which specific interaction requires it), not just that it makes the error go away.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #481\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}