/bulletproof-react-skills:components-and-stylingfrom bulletproof-react-skills
Component 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."
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.
Keep components, functions, styles, state, etc. as close as possible to where they are being used. Do this because it makes the codebase more readable and easier to understand, and it improves application performance by reducing redundant re-renders on state updates.
Do not add multiple rendering functions inside a component — this gets out of control quickly as the component grows. Instead, when a piece of UI can be considered a unit, extract it into a separate component.
// this is very difficult to maintain as soon as the component starts growing
function Component() {
function renderItems() {
return <ul>...</ul>;
}
return <div>{renderItems()}</div>;
}
// extract it in a separate component
function Items() {
return <ul>...</ul>;
}
function Component() {
return (
<div>
<Items />
</div>
);
}
Keep code style consistent — for example, if components are named using pascal case, name them that way everywhere. Set up linters and code formatters in the project, since they enforce most of this consistency automatically.
If a component accepts too many props, split it into multiple components or use composition via children or slots instead.
For larger projects, build abstractions around all shared components — this keeps the application consistent and easier to maintain. Identify repetitions before creating the components, so as not to build the wrong abstraction.
Component Library Example Code
Wrap 3rd party components too, adapting them to the application's needs. This makes it easier to change the underlying implementation later without affecting the application's functionality.
3rd Party Component Example Code
Every project needs some UI components such as modals, tabs, sidebars, menus, etc. Reach for an existing, battle-tested component library instead of building these from scratch.
These component libraries come with their components fully styled.
Chakra UI - great library with great developer experience, allows very fast prototyping with decent design defaults. Plenty of components that are very customizable and flexible with accessibility already configured out of the box.
AntD - another great component library that has a lot of different components. Best suitable for creating admin dashboards. However, it might be a bit difficult to change the styles in order to adapt them to a custom design.
MUI - the most popular component library for React. Has a lot of different components. Can be used as a styled solution by implementing Material Design or as unstyled headless component library.
Mantine - a modern react component library with a lot of components and hooks. It is very customizable and has a lot of features out of the box.
These component libraries come with their components unstyled. If there is a specific design system to implement, reach for headless components over adapting a fully featured component library such as Material UI. Some good options are:
There are multiple ways to style a react application. Some good options are:
NOTE: Keep React Server Components in mind. Server Components themselves require a zero-runtime styling solution; runtime CSS-in-JS can still work for a Client Component behind a supported Server/Client boundary, so pick your styling solution based on where in the tree it needs to run, not as a blanket rule for the whole app.
With the rise of headless component libraries, another tier of component libraries has emerged where predefined components are provided with styling solutions included, but instead of being installed as a package, they are provided as code that can be customized and styled as needed.
Reach for Storybook to develop and test components in isolation. Treat it as a catalogue of every component the application uses — useful both for development and for making existing components discoverable before building new ones.
What SKILL.md sets; muted values are Claude Code's defaults
7 skills in this plugin
/performancePerformance 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".
/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.
/project-structureProject structure conventions from bulletproof-react: what lives in src/,
the app/assets/components/features/hooks/lib/stores/testing/types/utils
layout, and how features are organized to stay unidirectional. Use when
scaffolding a new React project, deciding where a new file belongs, reviewing
a PR that imports across feature boundaries, or setting up ESLint import
restrictions — for example "where should this component/hook/API call live",
"should this be shared or feature-scoped", or "is this cross-feature import
okay".
npx claudepluginhub dfadler/bulletproof-react-skills --plugin bulletproof-react-skills