Skip to main content
rule CX Codex

server-serialization — Claude Code rule: what it does, install

server-serialization is a Claude Code rule for limiting data passed across React Server/Client boundaries. It applies when client components receive props from server components.

MIT ★ 7,191 updated 2026-10-24

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/rules/server-serialization.md
Open on GitHub

What server-serialization does

server-serialization tells the agent to pass client components only the properties they use. For instance, a component that displays a user's name can receive that value rather than the whole user object.

React serializes properties crossing the Server/Client boundary into the HTML response and later RSC requests. Their size affects page weight and load time. The rule concerns props passed to the client, not server-side data fetching.

What it helps with

  • reduce props sent to a client component
  • remove unused object fields from data crossing the boundary
  • pass a component only the values it renders

Example prompts for the agent

  • Review this Server/Client boundary and remove props the client component never uses.
  • Change the user data passed to the client; it only needs the name.

How to install server-serialization

Manually: put the files in place

.claude/rules/server-serialization.md

The paths frontmatter field limits the files

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about server-serialization

How do I install server-serialization in Claude Code?

Add the rule file at .claude/rules/server-serialization.md.

What does server-serialization do?

It guides the agent to pass only client-used properties across React's Server/Client boundary, reducing serialized data in HTML responses and RSC requests.

Which fields should cross the Server/Client boundary?

Pass only fields used by the client component. If it displays a user's name, pass the name rather than the full user object.

Source text

server-serialization.md · MIT
---
title: Minimize Serialization at RSC Boundaries
impact: HIGH
impactDescription: reduces data transfer size
tags: server, rsc, serialization, props
---

## Minimize Serialization at RSC Boundaries

The React Server/Client boundary serializes all object properties into strings and embeds them in the HTML response and subsequent RSC requests. This serialized data directly impacts page weight and load time, so **size matters a lot**. Only pass fields that the client actually uses.

**Incorrect (serializes all 50 fields):**

```tsx
async function Page() {
  const user = await fetchUser()  // 50 fields
  return <Profile user={user} />
}

'use client'
function Profile({ user }: { user: User }) {
  return <div>{user.name}</div>  // uses 1 field
}
```

**Correct (serializes only 1 field):**

```tsx
async function Page() {
  const user = await fetchUser()
  return <Profile name={user.name} />
}

'use client'
function Profile({ name }: { name: string }) {
  return <div>{name}</div>
}
```

© tech-leads-club · MIT · tech-leads-club/agent-skills

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set130

The whole set →
react19-no-forwardref react19-no-forwardref is a Claude Code rule covering React 19 ref and context changes: pass ref as a prop and use use() instead of useContext(). It supports React 19 migrations. CX Codex +1 ★ 7,191repo stars advanced-init-once advanced-init-once prevents running app-wide startup logic inside component useEffect([]) hooks and suggests module-level guards or top-level initialization instead. CX Codex +1 ★ 7,191repo stars rerender-defer-reads The rerender-defer-reads rule keeps callback-only reads of dynamic state out of component subscriptions. Use it when searchParams or localStorage is needed only after an action. CX Codex +1 ★ 7,191repo stars rendering-conditional-render The rendering-conditional-render rule prevents accidental rendering of zeros and NaN in JSX. It enforces explicit ternary operators instead of && checks, so falsy values stay out of the DOM. CX Codex +1 ★ 7,191repo stars rerender-simple-expression-in-memo The rerender-simple-expression-in-memo rule advises against using useMemo for simple expressions that return a boolean, number, or string. It applies when reviewing React component calculations. CX Codex +1 ★ 7,191repo stars js-hoist-regexp js-hoist-regexp — a Claude rule that keeps RegExp construction out of the render path: define the pattern at module scope or wrap it in useMemo(). CX Codex +1 ★ 7,191repo stars rendering-hoist-jsx rendering-hoist-jsx extracts static JSX elements outside components to prevent element re-creation on every render pass. CX Codex +1 ★ 7,191repo stars rerender-transitions The rerender-transitions rule marks frequent, non-urgent state changes as transitions. It fits React code where updates such as scroll tracking should keep the interface responsive. CX Codex +1 ★ 7,191repo stars

Project sponsors

Companies that keep this analytics open