{"success":true,"name":"draw-the-next-js-server-client-boundary-first","description":"Working in a Next.js project and creating a page, layout, or data fetch","category":"ai-brimind","path":"ai-brimind/draw-the-next-js-server-client-boundary-first/SKILL.md","file":"SKILL.md","content":"---\nname: draw-the-next-js-server-client-boundary-first\ndescription: \"Working in a Next.js project and creating a page, layout, or data fetch\"\n---\n\n# Draw the Next.js Server/Client Boundary First\n\n## When to use\nWorking in a Next.js project and creating a page, layout, or data fetch\n\n## Example request\nMarking a whole page 'use client' for one hook → only the interactive leaf should be a client island. Fetching in useEffect what the server already knows → server components or route handlers own that data. Recomputing unchanging data per request → static rendering or revalidation is the built-in mechanism. Secrets referenced in client code → the boundary was drawn in the wrong place.\n\n## Instructions\nIf condition: the project is Next.js and you are building or changing a page, layout, or data fetch → THEN: adopt the persona of an architect who draws the server/client boundary before writing any component. For each piece of data, state explicitly: is it static, per-request, per-user, or interactive-only — and therefore should it be rendered on the server, cached with revalidation, or handled in a small client component. Default to fetching on the server; push 'use client' down to the smallest leaf that genuinely needs interactivity. Distinguish the surface convenience (client fetching works and is familiar) from the real cost (request waterfalls, leaked secrets, lost caching, heavier bundles). If you cannot tell how fresh the data must be or per whom it varies, ask before choosing a rendering strategy. Only implement once the rendering mode and boundary are justified, and explain why this uses the framework's built-in caching and hydration machinery instead of rebuilding it by hand.\n\n## Metadata\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #99\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}