/bulletproof-react-skills:project-structurefrom bulletproof-react-skills
Project 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".
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.
Put most of the code in the src folder, laid out like this:
src
|
+-- app # application layer containing:
| | # this folder might differ based on the meta framework used
| +-- routes # application routes / can also be pages
| +-- app.tsx # main application component
| +-- provider.tsx # application provider that wraps the entire application with different global providers - this might also differ based on meta framework used
| +-- router.tsx # application router configuration
+-- assets # assets folder can contain all the static files such as images, fonts, etc.
|
+-- components # shared components used across the entire application
|
+-- config # global configurations, exported env variables etc.
|
+-- features # feature based modules
|
+-- hooks # shared hooks used across the entire application
|
+-- lib # reusable libraries preconfigured for the application
|
+-- stores # global state stores
|
+-- testing # test utilities and mocks
|
+-- types # shared types used across the application
|
+-- utils # shared utility functions
Organize most of the code within the features folder, not a flat structure — this keeps each feature's code together, prevents it from bleeding into shared components, and makes the codebase easier to manage, read, and scale as it grows.
Give a feature this structure:
src/features/awesome-feature
|
+-- api # exported API request declarations and api hooks related to a specific feature
|
+-- assets # assets folder can contain all the static files for a specific feature
|
+-- components # components scoped to a specific feature
|
+-- hooks # hooks scoped to a specific feature
|
+-- stores # state stores for a specific feature
|
+-- types # typescript types used within the feature
|
+-- utils # utility functions for a specific feature
NOTE: Only create the folders a feature actually needs — don't scaffold all of them by default.
If a lot of API calls are shared between features, put them in a dedicated top-level api folder instead of duplicating them per-feature.
Don't reach for barrel files to re-export a feature's contents — they break Vite's tree shaking and can cause performance issues. Import files directly instead.
Don't import across features. Compose different features together at the application level instead, so each feature stays independent and the codebase stays less convoluted.
To enforce this, add an ESLint rule forbidding cross-feature imports:
'import/no-restricted-paths': [
'error',
{
zones: [
// disables cross-feature imports:
// eg. src/features/discussions should not import from src/features/comments, etc.
{
target: './src/features/auth',
from: './src/features',
except: ['./auth'],
},
{
target: './src/features/comments',
from: './src/features',
except: ['./comments'],
},
{
target: './src/features/discussions',
from: './src/features',
except: ['./discussions'],
},
{
target: './src/features/teams',
from: './src/features',
except: ['./teams'],
},
{
target: './src/features/users',
from: './src/features',
except: ['./users'],
},
// More restrictions...
],
},
],
Also enforce a unidirectional codebase: code should flow one way, from shared parts to the application (shared -> features -> app). This keeps the codebase predictable and easier to reason about.

Shared parts can be used by any part of the codebase, but features can only import from shared parts, and the app can import from features and shared parts — never the reverse.
Enforce this with ESLint too:
'import/no-restricted-paths': [
'error',
{
zones: [
// Previous restrictions...
// enforce unidirectional codebase:
// e.g. src/app can import from src/features but not the other way around
{
target: './src/features',
from: './src/app',
},
// e.g src/features and src/app can import from these shared modules but not the other way around
{
target: [
'./src/components',
'./src/hooks',
'./src/lib',
'./src/types',
'./src/utils',
],
from: ['./src/features', './src/app'],
},
],
},
],
Follow these practices to keep the codebase well-organized, scalable, and maintainable, and to work more efficiently with a team. The same architecture applies just as well to apps built with Next.js, Remix, or React Native.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub dfadler/bulletproof-react-skills --plugin bulletproof-react-skills7 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."
/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.
/securitySecurity conventions from bulletproof-react: token storage and
authentication for SPAs, authorization patterns, and other client-side
hardening practices. Use when implementing auth, authorization checks, or
handling sensitive data in a React app. Reach for this whenever a task
involves deciding where to store a JWT after login, wiring up route/component
guards so only certain roles can see a feature, restricting an action (like
deleting a comment) to its owner, or reviewing a PR that touches
authentication/authorization code — for example "where should I store the
auth token", "how do I hide this button from non-admins", "only the comment
author should be able to delete it", or "is this login flow XSS-safe".
/state-and-dataState management and data-fetching conventions from bulletproof-react:
component vs. application vs. server vs. form vs. URL state, a single shared
API client instance, colocated request declarations paired with React Query
hooks, and API/in-app error handling. Use when adding state, wiring up an
API call, or handling request/render errors in a React app. Reach for this
whenever you're about to decide "should this be useState or global state?",
add a new fetch/mutation to a React app, wire up form validation, or figure
out where a caught error should surface — e.g. "where should I put this
modal's open/closed state?", "how do I fetch and cache this list from the
API?", "the app crashed on one bad component and took the whole page down
with it."
/testingTesting strategy conventions from bulletproof-react: when to reach for a
unit vs. integration vs. e2e test, and the recommended tooling (Vitest,
Testing Library, Playwright, MSW) for each. Use this whenever adding tests
to a React app, deciding what kind of test a piece of code actually needs,
or reviewing a PR's test coverage — especially when the default has been
"add a unit test" without considering whether an integration test would
give more real confidence. Reach for this when the user asks things like
"what kind of test should this component have", "should I mock the API
for this test", or "how do I set up e2e tests for this app".