rendering-activity — Claude Code rule: what it does, how to install
rendering-activity — a Claude rule that tells the agent to keep costly React components inside <Activity> so hiding them does not throw away state.
no license ★ 1,064 updated 2026-01-21
.claude/rules/rendering-activity.mdWhat rendering-activity does
The rule is a single markdown file with one instruction: take a component that is expensive to render and gets shown and hidden all the time, wrap it in React's <Activity>, and drive the mode prop between visible and hidden. The tree stays put, so DOM and state survive each toggle.
A dropdown that picks its mode from an isOpen flag is the example given. The rule itself is marked MEDIUM, which reads as a local fix for one heavy component rather than a house style for every conditional render.
This only applies to a React project. <Activity> comes from React, and there is nothing to wrap anywhere else.
What it helps with
- stop a frequently toggled menu from losing its state
- keep a costly component's DOM alive between showings
- drop redundant re-renders when visibility flips
- point the agent at
<Activity>instead of plain conditional rendering
Example prompts for the agent
- Wrap
ExpensiveMenuin<Activity>and drivemodefromisOpenso it keeps its state. - Which components here toggle visibility often enough to move them under
<Activity>? - Rewrite the dropdown's conditional render with
<Activity>and keep the DOM mounted.
How to install rendering-activity
Manually: put the files in place
.claude/rules/rendering-activity.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/rendering-activity.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/rendering-activity.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/rendering-activity.mdManually: put the files in place
.clinerules/rendering-activity.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about rendering-activity
How do I install rendering-activity in Claude Code?
Copy the rule file into your project at .claude/rules/rendering-activity.md. That path is the whole install.
What does rendering-activity do?
It has the agent wrap expensive, frequently toggled React components in <Activity> and switch mode, so state and DOM are kept while the component is hidden.
Which components should use it?
Ones that cost a lot to render and are shown and hidden often, like a menu that opens and closes repeatedly.