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
.claude/rules/server-serialization.mdWhat 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.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/server-serialization.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/server-serialization.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/server-serialization.mdManually: put the files in place
.clinerules/server-serialization.mdStep 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