Agent skill

React Rerender Mental Models

by stellar in stellar/laboratory

Correct mental models for React re-renders and memoization. An agent skill from stellar/laboratory.

MITAuto-check passedFrontend & Design

Install React Rerender Mental Models

skills CLI
$ npx skills add stellar/laboratory --skill react-rerender-mental-models -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install stellar/laboratory react-rerender-mental-models --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/stellar/laboratory.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/react-rerender-mental-models .claude/skills/react-rerender-mental-models && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
react-rerender-mental-models
GitHub stars
112
Token cost
~1.1k tokens
SKILL.md length
429 words
Files
9
Skills in repo
6
Repo updated
First seen
Licence
MIT

At a glance

Correct mental models for React re-renders and memoization. An agent skill from stellar/laboratory.

  • Works in 3 steps: Component's own state changes (useState,… → Parent component re-renders (cascades to… → Context value changes (for consumers of…
  • Optimizing React components to avoid common misconceptions about performance
  • SKILL.md covers Core Philosophy, When to Apply, Rule Categories and Quick Reference, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

React Rerender Mental Models is an agent skill from stellar/laboratory. Correct mental models for React re-renders and memoization. Use this skill when writing, reviewing, or optimizing React components to avoid common misconceptions about performance. Debunks the myth that "props cause re-renders" and teaches when memoization actually helps.

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 9 other files (for example `rules/anti-pattern-memoization-trap.md`, `rules/anti-pattern-premature-memo.md` and `rules/architecture-composition.md`).

It sits in Frontend & Design, covering React components. It works with React. The repository describes itself as: A set of tools that enables developers to try out and learn about the Stellar network. The licence is MIT.

When your agent uses it

  • Optimizing React components to avoid common misconceptions about performance
  • Tasks that involve React components

Example prompts

  • “props cause re-renders”
  • “/react-rerender-mental-models”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Component's own state changes (useState, useReducer)
  2. Parent component re-renders (cascades to all children)
  3. Context value changes (for consumers of that context)

What it can do on your machine

Read from SKILL.md and the folder at commit b4b6465. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

React Rerender Mental Models loads about 1.1k tokens when it runs. Until then it costs about 75 tokens; SKILL.md has 429 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~75
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from stellar/laboratory at commit b4b6465, republished under its MIT licence (© stellar). 429 words, ~1,085 tokens.

Download SKILL.mdSave it as .claude/skills/react-rerender-mental-models/SKILL.md (or your agent's skills folder). This skill also uses 8 other files; get the full folder from GitHub.
name
react-rerender-mental-models
description
Correct mental models for React re-renders and memoization. Use this skill when writing, reviewing, or optimizing React components to avoid common misconceptions about performance. Debunks the myth that "props cause re-renders" and teaches when memoization actually helps.
license
MIT
metadata.author
freighter
metadata.version
1.0.0

React Re-render Mental Models

A practical guide to understanding how React re-renders actually work, debunking common misconceptions, and knowing when optimization is truly needed.

Core Philosophy

"Trust React to be fast. Write simple code. Measure when something actually feels slow. Optimize based on data, not fear."

When to Apply

Reference these guidelines when:

  • Writing new React components
  • Reviewing code for performance issues
  • Deciding whether to add React.memo, useCallback, or useMemo
  • Debugging perceived "slowness" in React apps
  • Refactoring component architecture

Rule Categories

CategoryPrefixDescription
Mental Modelsmental-model-Correct understanding of how React works
Anti-Patternsanti-pattern-Common mistakes to avoid
When to Memoizewhen-to-memo-Profile-driven optimization guidance
Architecturearchitecture-Component structure patterns

Quick Reference

Mental Models (Foundational)
  • mental-model-parent-triggers - Props don't trigger re-renders; parent re-renders do
  • mental-model-render-vs-commit - Render ≠ Commit; renders are cheap, commits touch DOM
Anti-Patterns (Avoid These)
  • anti-pattern-premature-memo - Don't memoize without profiling first
  • anti-pattern-memoization-trap - Real bottlenecks are often not re-renders
When to Memoize (Use Sparingly)
  • when-to-memo-context-values - Stabilize context object references
  • when-to-usecallback - Only needed when child is already memoized
Architecture (Prefer These)
  • architecture-local-state - Keep state close to where it's used
  • architecture-composition - Component structure prevents re-renders naturally

What Actually Triggers Re-renders

  1. Component's own state changes (useState, useReducer)
  2. Parent component re-renders (cascades to all children)
  3. Context value changes (for consumers of that context)

Props are NOT on this list. Props are inputs to a render that's already happening—they don't schedule one.

The Performance Debugging Flow

1. Something feels slow
2. Open React DevTools Profiler
3. Record the interaction
4. Look for components with 50ms+ render times
5. If found → consider memoization
6. If not found → the problem is elsewhere:
   - API calls firing too often
   - Unoptimized images
   - Too many DOM nodes
   - CSS animations triggering layout
Show full SKILL.md (195 more words)Show less

React 19 Compiler

This project runs React 19. The React Compiler (formerly React Forget) is an opt-in build-time tool that statically analyzes components and automatically inserts the equivalent of useMemo, useCallback, and React.memo. It is not enabled by default — it requires babel-plugin-react-compiler (or the SWC equivalent) to be installed and configured.

  • If the compiler is enabled in this project: skip manual memoization. The compiler tracks data flow within each component and caches results at a more granular level than hand-written hooks. If the compiler opts out a specific component (e.g. due to side effects during render), fix the component rather than adding manual memo.
  • If the compiler is not enabled (current default): follow the rules below, but prefer architecture fixes (local state, composition) over adding memo/useCallback.

Regardless of compiler status, the mental models and architecture rules in this skill still apply — composition and local state are always better than relying on memoization (auto or manual). Re-render triggers remain the same either way.

How to Use

Read individual rule files for detailed explanations and code examples:

rules/mental-model-parent-triggers.md
rules/anti-pattern-premature-memo.md
rules/architecture-local-state.md

Each rule file contains:

  • Brief explanation of why it matters
  • Incorrect code example with explanation
  • Correct code example with explanation

© stellar, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 8 other files in .claude/skills/react-rerender-mental-models of stellar/laboratory.

  • SKILL.md
  • rules/anti-pattern-memoization-trap.md
  • rules/anti-pattern-premature-memo.md
  • rules/architecture-composition.md
  • rules/architecture-local-state.md
  • rules/mental-model-parent-triggers.md
  • rules/mental-model-render-vs-commit.md
  • rules/when-to-memo-context-values.md
  • rules/when-to-usecallback.md

Open the folder on GitHubat commit b4b6465

Compare with similar skills

React Rerender Mental Models next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

React Rerender Mental Models compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
React Rerender Mental Models this skillstellar/laboratory112—~1.1kAutomated safety check: PassMIT
Web Artifacts Builderanthropics/skills180k41 repos~769Automated safety check: PassApache-2.0
React Router Developmentremix-run/react-router57k1 repos~1.5kAutomated safety check: PassMIT
React UI State PatternsChrisWiles/claude-code-showcase6.1k8 repos~1.6kAutomated safety check: PassNone
Chakra UI v3 Builderchakra-ui/chakra-ui41k—~3.1kAutomated safety check: PassMIT
React Component PerformanceDimillian/Skills4k5 repos~1.2kAutomated safety check: PassMIT

Similar skills

  • Web Artifacts Builder

    anthropics/skills

    Official

    Builds multi-component claude.ai HTML artifacts as a small React, TypeScript and Tailwind project, then bundles it into one shareable HTML file.

    180k GitHub starsUsed in 41 repos~769 tokens
    Frontend & DesignAuto-check passed
  • React Router Development

    remix-run/react-router

    Guides work on React Router apps by first identifying whether the app uses Framework, Data or Declarative mode, then loading the matching reference and the installed package docs.

    57k GitHub starsUsed in 1 repo~1.5k tokens
    Frontend & DesignAuto-check passed
  • React UI State Patterns

    ChrisWiles/claude-code-showcase

    Sets patterns for React interfaces: when to show loading spinners or skeletons, how to surface errors, how to disable buttons during async work and how to handle empty lists.

    6.1k GitHub starsUsed in 8 repos~1.6k tokens
    Frontend & DesignAuto-check passed
  • Chakra UI v3 Builder

    chakra-ui/chakra-ui

    Builds responsive, accessible Chakra UI v3 components and layouts, sets up Chakra in new or existing projects, and designs themes with tokens, semantic tokens and recipes.

    41k GitHub stars~3.1k tokensUpdated yesterday
    Frontend & DesignAuto-check passed
  • Analyze and optimize React component performance issues (slow renders, re-render thrash, laggy lists, expensive computations).

    4k GitHub starsUsed in 5 repos~1.2k tokens
    Frontend & DesignAuto-check passed
  • React View Transitions Guide

    vercel-labs/next-beats

    Official

    Guides implementing animated page and state transitions in React with the native View Transition API, covering shared elements, list reorders and directional navigation.

    167 GitHub starsUsed in 10 repos~3.1k tokens
    Frontend & DesignAuto-check passed

More from stellar/laboratory

  • Component Guide

    stellar/laboratory

    Guide for building React components using @stellar/design-system and project SCSS conventions.

    112 GitHub stars~999 tokensUpdated 4 days ago
    Auto-check passed
  • Zustand Store Patterns

    stellar/laboratory

    Reference for the two Zustand store patterns in Stellar Lab — main store (querystring) and transaction flow store (sessionStorage).

    112 GitHub stars~1.4k tokensUpdated 4 days ago
    Auto-check passed
  • Commit Progress

    stellar/laboratory

    Commit a logical unit of work with a descriptive message. An agent skill from stellar/laboratory.

    112 GitHub stars~774 tokensUpdated 4 days ago
    Auto-check: notes
  • Figma To Code

    stellar/laboratory

    Bridge Figma MCP output to Stellar Lab code conventions. An agent skill from stellar/laboratory.

    112 GitHub stars~520 tokensUpdated 4 days ago
    Auto-check passed
  • Test Changed

    stellar/laboratory

    Run e2e and unit tests related to files changed on the current branch.

    112 GitHub stars~836 tokensUpdated 4 days ago
    Auto-check passed

Works with

Questions about React Rerender Mental Models

What does React Rerender Mental Models do?

Correct mental models for React re-renders and memoization. An agent skill from stellar/laboratory. React Rerender Mental Models is an agent skill from stellar/laboratory. Correct mental models for React re-renders and memoization.

When should I use React Rerender Mental Models?

React Rerender Mental Models fits situations like: optimizing React components to avoid common misconceptions about performance; tasks that involve React components.

How do I install React Rerender Mental Models in Claude Code?

Run `npx skills add stellar/laboratory --skill react-rerender-mental-models -a claude-code`. Or copy the skill folder (.claude/skills/react-rerender-mental-models in stellar/laboratory) into .claude/skills/react-rerender-mental-models in your project. Claude Code loads it when a task matches its description.

How do I install React Rerender Mental Models in Codex?

Run `npx skills add stellar/laboratory --skill react-rerender-mental-models -a codex`. Or copy the skill folder (.claude/skills/react-rerender-mental-models in stellar/laboratory) into .agents/skills/react-rerender-mental-models in your project. Codex loads it when a task matches its description.

Can I use React Rerender Mental Models in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add stellar/laboratory --skill react-rerender-mental-models -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/react-rerender-mental-models, .gemini/skills/react-rerender-mental-models, .github/skills/react-rerender-mental-models and .opencode/skills/react-rerender-mental-models in your project.

What does React Rerender Mental Models need to run?

SKILL.md names no scripts, command-line tools or credentials: React Rerender Mental Models is instructions for the agent only.

Does React Rerender Mental Models access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is React Rerender Mental Models safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does React Rerender Mental Models use?

React Rerender Mental Models is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does React Rerender Mental Models use?

About 1.1k tokens (SKILL.md is roughly 4.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to React Rerender Mental Models?

Skills that share tags, products or a category with React Rerender Mental Models: Web Artifacts Builder (anthropics/skills, 180k stars), React Router Development (remix-run/react-router, 57k stars), React UI State Patterns (ChrisWiles/claude-code-showcase, 6.1k stars) and Chakra UI v3 Builder (chakra-ui/chakra-ui, 41k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains React Rerender Mental Models?

stellar (a GitHub organization) maintains it in stellar/laboratory, which has 112 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on October 3, 2026.

Source: stellar/laboratory on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.