Command Palette

Search for a command to run...

Назад к скиллам
скилл № 16176

react-architecture

Use when the user asks about React project structure, feature-based folders, a React component that re-renders too often, how to structure state and custom…

БесплатноБез исполняемых скриптов
j4flmaoот j4flmao★ 47 звёзд на GitHub

Установить react-architecture в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

React Architecture

Purpose

Organize React applications by feature, not by type. Each feature is a self-contained module with its own components, hooks, API calls, and types. No circular imports between features.

Agent Protocol

Trigger

Exact user phrases: "React structure", "React architecture", "React folder", "React component pattern", "React hooks architecture", "React clean arch", "feature-based React", "React project layout".

Input Context

Before activating, verify:

  • package.json has react dependency.
  • Whether the project uses Vite, CRA, or custom setup.

Output Artifact

No file output. Produces folder structure and code examples as text.

Response Format

Folder structure:

src/
  app/
  features/{feature}/
    api/, components/, hooks/, stores/, types/
  shared/components/

Code: show component and hook definitions. No import statements.

No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output — why use many token when few do trick.

Completion Criteria

  • Folder structure is feature-based (src/features/{feature}).
  • Smart components fetch data and manage state. Dumb components receive props.
  • Custom hooks encapsulate all stateful logic.
  • Barrel exports (index.ts) exist only at feature boundaries, not in every folder.
  • No data fetching in dumb/presentational components.
  • Error boundaries wrap each feature route.
  • Components are under 150 lines.

Max Response Length

Folder structure: unlimited. Code: 15 lines per example.

Component Architecture / Decision Trees

Architecture Options

Approach Trade-off When to Use
Feature-based folders Cohesion, scalability All projects with multiple features
Type-based folders (components/, hooks/) Simple for small apps Small projects, prototypes
Smart/Dumb separation Testable, reusable UI Components with data dependencies
Compound components Flexible, composable Complex UI (Dropdown, Tabs, Select)
Render props Max flexibility Cross-cutting behavior (Mouse position, Scroll)
Custom hooks Reusable stateful logic Data fetching, form logic, subscriptions

Decision Tree: Component Type

Does the component fetch data or manage state?
  ├── Yes -> Smart component
  │    ├── Uses custom hooks for logic
  │    ├── Renders dumb components
  │    └── Exports from feature barrel
  └── No -> Dumb (presentational) component
       ├── Receives everything via props
       ├── No data fetching, no stores
       └── Resides in features/{feature}/components/

Decision Tree: State Management

How complex is the state?
  ├── Local (component only) -> useState, useReducer
  ├── Shared across few components -> Props lifting, Context
  └── Shared across many components ->
       ├── Server state -> TanStack Query
       ├── Client state -> Zustand, Jotai, Context
       └── URL state -> useSearchParams, react-router

Decision Tree: Custom Hook vs Component

Does the logic produce UI?
  ├── Yes -> Component (possibly compound)
  └── No -> Custom hook
       ├── Data fetching -> Query hook
       ├── Form logic -> Form hook
       ├── Browser API -> useMediaQuery, useOnlineStatus
       └── Animation -> Animation hook

Decision Tree: Data Flow Direction

Where does data come from?
  ├── Server API -> TanStack Query (useQuery/useMutation)
  ├── Parent component -> Props (drilled or composed)
  ├── Global client state -> Zustand/Jotai store
  └── URL params -> useParams, useSearchParams

Decision Tree: Composing Components

Do child components need to share state with siblings?
  ├── Yes -> Lift state to common parent
  │    ├── Only 1-2 levels -> Prop drilling
  │    └── 3+ levels -> Context or store
  └── No -> Local state in each component

Component Design Patterns

Compound Component

interface TabsContext {
  activeTab: string
  setActiveTab: (tab: string) => void
}
const TabsCtx = createContext<TabsContext | null>(null)

function Tabs({ children, defaultTab }: { children: ReactNode; defaultTab: string }) {
  const [activeTab, setActiveTab] = useState(defaultTab)
  return <TabsCtx.Provider value={{ activeTab, setActiveTab }}>{children}</TabsCtx.Provider>
}

Tabs.List = function List({ children }: { children: ReactNode }) {
  return <div role="tablist">{children}</div>
}

Tabs.Tab = function Tab({ value, children }: { value: string; children: ReactNode }) {
  const ctx = useContext(TabsCtx)!
  return <button role="tab" onClick={() => ctx.setActiveTab(value)}>{children}</button>
}

Tabs.Panel = function Panel({ value, children }: { value: string; children: ReactNode }) {
  const ctx = useContext(TabsCtx)!
  return ctx.activeTab === value ? <div role="tabpanel">{children}</div> : null
}

Custom Hook for Data Fetching

function useUsers(search: string) {
  const { data, isLoading, error } = useQ
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/component-patterns.md
  • references/folder-structure.md
  • references/hooks-guide.md
  • references/react-19-patterns.md
  • references/react-compiler-optimizations.md
  • references/react-compiler.md
  • references/react-server-components.md
  • references/rendering-patterns.md

FAQ

Что делает скилл react-architecture?

Use when the user asks about React project structure, feature-based folders, a React component that re-renders too often, how to structure state and custom hooks, error boundaries or the React Compiler. Produces a React 19 app architecture with component and hook conventions. Not for Next.js App Router (use react-nextjs) or picking a state library (use frontend-state-management).

Как установить скилл react-architecture?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл react-architecture запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить react-architecture с