react-project-structure

Organizes React projects into feature modules with a shared base UI component layer.

1|Updated Apr 15, 2026
One-click install
npx skills add https://github.com/pnewsam/skills --skill react-project-structure-pnewsam
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: react-project-structure
Source: https://github.com/pnewsam/skills/tree/main/archive/react-project-structure
Command: npx skills add https://github.com/pnewsam/skills --skill react-project-structure-pnewsam

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? React codebases often degrade into giant type-based folders where related code is scattered across components/, hooks/, and api/ directories, making features hard to find, modify, or delete. This Skill provides concrete conventions for structuring React projects so domain code stays grouped by feature and generic UI stays reusable. ## Core Features & Use Cases - Two-layer component model: Separates generic base UI components (buttons, modals, layout primitives in src/components/ui/) from domain components that live inside feature modules. - Feature-based organization: Groups components, hooks, API clients, and types per feature under src/features/ with clear boundaries and public APIs via index.ts barrel files. - Naming and placement rules: Defines kebab-case file naming, sub-component prefixing, page suffixes, co-located tests folders, and a decision table for where any new file belongs. - Use Case: When adding a new invoices feature to an existing React app, use this Skill to decide exactly where the list component, data hook, API client, and tests should live, and how to name them consistently. ## Quick Start Use the react-project-structure skill to decide where to place a new AgentCard component and its hook in my React app.

Frequently Asked Questions about react-project-structure

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a React project by feature?▼

Group domain code under src/features/<feature>/ with subfolders for components, hooks, api, and types, plus an index.ts public API. Keep generic reusable components in a separate src/components/ui/ layer that knows nothing about the business domain.

Where should shared React components live in a project?▼

Generic, domain-free components like buttons, modals, and layout primitives belong in src/components/ui/ or src/components/base/. Domain-specific components like InvoiceCard belong inside their feature module under src/features/<feature>/components/.

Should I use barrel files in a React feature folder?▼

Use at most one barrel file per feature to define its public API. Barrel files can break tree-shaking, create circular dependencies, and slow IDE tooling, so avoid them in subdirectories and don't introduce them if the project doesn't already use them.

Where do tests go in a feature-based React structure?▼

Place tests in a local __tests__/ folder at the same directory level as the files they cover, not as sibling files or in a distant global test tree. Stories and CSS module files stay alongside their component.

How do I migrate an existing React project to feature folders?▼

Migrate incrementally rather than reorganizing everything at once. Follow existing conventions for files you touch, create new features directly under src/features/, and move older features when you significantly modify them.