pixel-rsc-boundary
Skill0 starsChanged 25 days agoMITView on GitHub
pixel's Server/Client boundary discipline for Next.js 16 + React 19.2. Use when writing Server/Client components, debugging hydration mismatches, or seeing "Context is unavailable"/undefined-in-prod. Encodes the 5 boundary mistakes (PITFALLS §5), the non-serializable-props trap (S8), and the provider-above-the-boundary trap (S20).
In this repository59 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- agent-runtimeSkill
- frontend-designSkill
- architectSkill
- deep-thinkSkill
- design-systemsSkill
- ecosystem-referenceSkill
- fractal-delegationSkill
- harness-reviewSkill
- heartbeatSkill
- integrate-resourcesSkill
- llm-council-critiqueSkill
- loop-createSkill
- mcp-setupSkill
- memory-compressionSkill
- memorySkill
- model-routingSkill
- oss-project-scaffoldSkill
- playwright-cliSkill
- repo-scoutSkill
- self-improveSkill
- skill-creatorSkill
- skill-routingSkill
- sprintSkill
- test-visualSkill
- troubleshootSkill
- ux-auditSkill
- Accessibility AuditorSkill
- artifacts-builderSkill
- brand-guidelinesSkill
- canvas-designSkill
- frontend-patternsSkill
- design-mirrorSkill
- design-system-starterSkill
- design-to-codeSkill
- feature-design-assistantSkill
- figma-implement-designSkill
- frontend-designSkill
- frontend-dev-guidelinesSkill
- mobile-designSkill
- motion-canvasSkill
- pixel-agent-uiSkill
- pixel-animateSkill
- pixel-anti-slopSkill
- pixel-brain-pageSkill
- pixel-migrate-next16Skill
- pixel-ship-gateSkill
- premium-web-designSkill
- senior-frontendSkill
- shadcnSkill
- tailwind-design-systemSkill
- tailwind-patternsSkill
- theme-factorySkill
- ui-design-systemSkill
- ui-ux-pro-maxSkill
- ux-researcher-designerSkill
- web-design-guidelinesSkill
The file
Files
pixel-rsc-boundary — the serialization-boundary discipline (PITFALLS §5 + S8/S20)
Stance: the RSC boundary has the highest blast radius in the stack and its failures are SILENT —
tscpasses,next buildpasses, then it hydration-mismatches or returnsundefinedin production. A human notices; an agent sees green and moves on (O14). This is the one to get right first.
trigger
- writing a Server or Client component / deciding where
'use client'goes - a hydration mismatch or
Warning: Text content did not matchin the console "React Context is unavailable in Server Components"/ a provider returnsundefined- "works in
next dev, breaks in production" - adopting
cacheComponents/'use cache'
The 5 boundary mistakes this encodes (named, from PITFALLS §5)
- Over-using
'use client'(§5.1) — ships Markdown parsers, date libs, DB clients to the browser ("pretends App Router is Pages Router"). Push'use client'to the LEAVES; keep data-fetching + heavy deps in Server Components. Default to RSC (zero JS) + client islands hydrated on interaction/viewport entry — below-fold eager hydration tanks INP (§12.1: Wix saw <40% good-INP with full hydration; islands → INP ~40% faster). - Non-serializable props across the boundary (§5.2 → S8) — a
Date, a class instance, a non-event-handler function → hydration mismatch. Pass primitives / plain objects; reconstructDateclient-side. - Non-deterministic SSR output (§5.3) —
Math.random(),Date.now(),window,localStoragein a component body → server HTML ≠ client HTML. Guard withuseEffectordynamic(…, { ssr: false });suppressHydrationWarningONLY narrowly for extension-mutated DOM. - Provider rendered from/above a Server boundary (§10.3 → S20) — React Context is unavailable in Server Components; a
ClerkProvider/SessionProvidermounted from a server component body works innext dev, returnsundefinedin production (the dev-passes/prod-fails blind spot). All providers in a dedicated'use client'providers.tsx, mounted high in the CLIENT tree. On React 19, avoid redundant nested same-context providers (#35397 — 1000+ unnecessary calls). - Cache-default inversion (§5.5 → S2) — migrators from 13–15 assume fetches are cached; in 16 nothing is cached without
use cache. The reverse trap: enablingcacheComponentsand getting "Uncached data outside<Suspense>". NEVER setcacheComponents: trueglobally (it has a live bug cluster — Clerk #85490, Portals #85390, CSP nonce #89754,<Activity>#86577, dup-search-param router cache #92152); adopt'use cache'per-route with<Suspense>around every dynamic read from day one (O2).
steps
- Place the boundary deliberately: server by default;
'use client'only at the leaf that needs interactivity/state/browser APIs. - Audit props crossing the boundary — primitives + plain objects only; no
Date/class/function (except event handlers). - Providers →
providers.tsx('use client'), mounted in the client tree — never from a server component body. cacheComponents→ per-route +<Suspense>, never the global flag. UseupdateTag(tag)in a Server Action for read-your-writes (not single-argrevalidateTag, which silently drops SWR — §1.4).- Prove it the way the compiler can't:
next build && next start(NOT justnext dev), load every context-dependent route, assert 0 hydration warnings viapage.on('console')and noundefined/"unavailable".
output
- The boundary decision (which file is
'use client'and why it's the leaf). - A grep report:
'use client'density; any non-serializable prop; any provider in a server file. - The prod proof:
next build && next start+ 0-hydration-warning console assertion.
verify
grep -rn "'use client'" src/ shows leaf-level placement (not page-top blanket) AND providers live in a 'use client' file AND a prod build + console check records 0 hydration warnings.
sources
brain/KNOWN-PITFALLS.md §5.1–§5.8, §10.3, §12.1 · brain/OPINIONS.md O2, O14 · BATTLE-TESTED S2, S8, S20.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

