/bulletproof-react-skills:performancefrom bulletproof-react-skills
Performance conventions from bulletproof-react: code splitting, component/state update optimization, list virtualization, image optimization, and bundle analysis. Use when a React app feels slow or before shipping a feature that renders large lists or heavy assets. Reach for this whenever you're about to add a route, decide where a piece of state should live, render a list of unknown or large size, or add images — and whenever a request mentions phrasing like "this page feels slow", "why is this component re-rendering so much", or "how should I load these images".
Ships in bulletproof-react-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Adapted from bulletproof-react @
9506629, MIT licensed. See ../../NOTICE.md for provenance and the re-pin workflow.
Split production JavaScript into smaller files so the app downloads only what's needed, when it's needed, instead of one monolithic bundle upfront.
Split at the routes level by default: load only what a route needs initially, and fetch the rest lazily as the user navigates. Don't over-split — splitting too aggressively multiplies the number of requests needed to fetch all the chunks and can make things slower, not faster. Target the parts of the app that actually matter for initial load rather than splitting everything.
Don't put everything in a single state — that triggers unnecessary re-renders. Split global state into multiple states, scoped to where each piece is actually used.
Keep state as close as possible to where it's used, so components that don't depend on it don't re-render when it updates.
When a piece of state is initialized by an expensive computation, use the state initializer function form instead of calling it directly — otherwise the expensive function reruns on every re-render instead of just once:
// instead of this which would be executed on every re-render:
const [state, setState] = React.useState(myExpensiveFn());
// prefer this which is executed only once:
const [state, setState] = React.useState(() => myExpensiveFn());
If the app needs to track many elements of state at once, consider a state management library with atomic updates, such as jotai.
Use React Context deliberately. Reach for it with low-velocity data — themes, user data, small local state — but for medium/high-velocity data, consider the use-context-selector library (selectors are already built in to most popular state management libraries like zustand or jotai). Don't treat Context as the default fix for props drilling — check first whether lifting the state up or a proper composition of components solves it instead. Don't rush into Context or global state.
If the app will have frequent updates that could hurt performance, prefer zero-runtime styling solutions (tailwind, vanilla-extract, CSS modules, which generate styles at build time) over runtime styling solutions like emotion or styled-components, which generate styles at runtime.
Reach for the children prop as the simplest, easiest optimization available — it eliminates a lot of unnecessary re-renders when applied properly. JSX passed as children is an isolated VDOM structure that the parent cannot and does not need to re-render, so use it to shield components from a parent's state updates. Example:
// Not optimized example
const App = () => <Counter />;
const Counter = () => {
const [count, setCount] = useState(0);
return (
<div>
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<PureComponent /> {/* will rerender whenever "count" updates */}
</div>
);
};
const PureComponent = () => <p>Pure Component</p>;
// Optimized example
const App = () => (
<Counter>
<PureComponent />
</Counter>
);
const Counter = ({ children }) => {
const [count, setCount] = useState(0);
return (
<div>
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
{children} {/* won't rerender whenever "count" updates */}
</div>
);
};
const PureComponent = () => <p>Pure Component</p>;
Lazy-load images that aren't in the viewport.
Use modern image formats such as WEBP for faster loading.
Use srcset to serve the most optimal image for the client's screen size.
Google uses web vitals as a signal in its search ranking systems, so track Lighthouse and Pagespeed Insights scores rather than treating them as optional.
Prefetch data before the user navigates to a page using queryClient.prefetchQuery from @tanstack/react-query, to prefetch a specific query's data ahead of time. Use this when you know the user is likely to navigate to a given page next — it cuts the load time they see when they get there.
What SKILL.md sets; muted values are Claude Code's defaults
7 skills in this plugin
/components-and-stylingComponent and styling conventions from bulletproof-react: colocation,
avoiding nested render functions, container/presentation separation, and
composition-over-config for component APIs. Covers when to reach for a
fully-styled vs. headless component library, which styling solution fits
a given setup (including React Server Components constraints), and using
Storybook for isolated component development. Use this when designing a
new component's API, reviewing a component for prop bloat or nested
render functions, choosing a component library or styling approach for a
project, or when a request looks like "this component is taking too many
props, how should I split it up," "what component library should I use
for this dashboard," or "where should I put this piece of state/style so
it doesn't cause unnecessary re-renders."
/project-standardsProject standards from bulletproof-react: ESLint/Prettier/TypeScript config,
absolute imports, pre-commit hooks, and CI conventions. Use when setting up
tooling for a React project or reviewing its lint/format/type configuration.
Reach for this whenever asked to "set up linting for a new React project,"
"configure absolute imports so I stop seeing ../../../," "add a pre-commit
hook to run lint and type-check," or "review this project's ESLint/Prettier/
tsconfig setup" — or when enforcing consistent file/folder naming conventions
across a codebase.
npx claudepluginhub dfadler/bulletproof-react-skills --plugin bulletproof-react-skills