Skip to main content
skill CX Codex

feature-arch · pymodel — Claude Code skill: React folders by feature

A skill that sets folder and module-boundary rules for React apps: 42 rules in 8 categories, from directory layout to file naming.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add PyModel/react-frontend-skills --skill feature-arch -a claude-code
Open on GitHub

What feature-arch does

The skill explains how to lay out a React app by feature instead of by technical file type. It ships 42 rules with priorities: directory structure and imports first, then module boundaries, data fetching, components, state, testing and naming. Each rule lives in its own references/<rule-id>.md file with the reasoning plus incorrect and correct code samples.

The agent pulls the matching file when you create a feature, reorganise the project tree or review code for architecture violations. Layering and boundary rules follow Feature-Sliced Design, so you are not switching the project to a different standard. For data fetching the skill points to the tanstack-query skill, for component patterns to react.

Worth it once features multiply and teams start reaching into each other's folders. The skill will not draw the boundaries for you: it hands you the rules, and you keep imports in line by hand or with a linter.

What it helps with

  • lay out a React app by feature instead of components and utils folders
  • block imports from one feature into another
  • move genuinely generic code into a shared layer
  • keep data fetching inside a feature rather than a global store
  • review code for module boundary violations

Example prompts for the agent

  • Lay out the new checkout feature using the feature-arch structure
  • Check imports under src/features and flag boundary violations
  • How does feature-arch want data fetching organised for the profile feature?

How to install feature-arch

1Skills CLI (Vercel)

npx skills add PyModel/react-frontend-skills --skill feature-arch -a claude-code

2Manually: put the files in place

~/.claude/skills/feature-arch/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/feature-arch/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about feature-arch

How do I install feature-arch in Claude?

Run npx skills add PyModel/react-frontend-skills --skill feature-arch -a claude-code. The skill lands in ~/.claude/skills/feature-arch/SKILL.md.

What does feature-arch do?

It gives the agent 42 rules for organising a React app: directory structure, imports, module boundaries, data fetching, components, state, tests and naming. The agent reads the relevant rule from references/<rule-id>.md when you work on a feature or review architecture.

What does feature-arch work alongside?

Its layering and boundary rules match Feature-Sliced Design. For data fetching the skill refers to tanstack-query, for component patterns to react.

Source text

SKILL.md · MIT
---
name: feature-arch
description: Feature-based React folder structure and module boundaries.
---

# Feature-Based Architecture Best Practices

Comprehensive architecture guide for organizing React applications by features, enabling scalable development with independent teams. Contains 42 rules across 8 categories, prioritized by impact from critical (directory structure, imports) to incremental (naming conventions).

## When to Apply

Reference these guidelines when:
- Creating new features or modules
- Organizing project directory structure
- Setting up import rules and boundaries
- Implementing data fetching patterns
- Composing components from multiple features
- Reviewing code for architecture violations

## Rule Categories by Priority

| Priority | Category | Impact | Prefix |
|----------|----------|--------|--------|
| 1 | Directory Structure | CRITICAL | `struct-` |
| 2 | Import & Dependencies | CRITICAL | `import-` |
| 3 | Module Boundaries | HIGH | `bound-` |
| 4 | Data Fetching | HIGH | `fquery-` |
| 5 | Component Organization | MEDIUM-HIGH | `fcomp-` |
| 6 | State Management | MEDIUM | `fstate-` |
| 7 | Testing Strategy | MEDIUM | `test-` |
| 8 | Naming Conventions | LOW | `name-` |

## Quick Reference

### 1. Directory Structure (CRITICAL)

- `struct-feature-folders` - Organize by feature, not technical type
- `struct-feature-self-contained` - Make features self-contained
- `struct-shared-layer` - Use shared layer for truly generic code only
- `struct-flat-hierarchy` - Keep directory hierarchy flat
- `struct-optional-segments` - Include only necessary segments
- `struct-app-layer` - Separate app layer from features

### 2. Import & Dependencies (CRITICAL)

- `import-unidirectional-flow` - Enforce unidirectional import flow
- `import-no-cross-feature` - Prohibit cross-feature imports
- `import-public-api` - Export through public API only
- `import-avoid-barrel-files` - Avoid deep barrel file re-exports
- `import-path-aliases` - Use consistent path aliases
- `import-type-only` - Use type-only imports for types

### 3. Module Boundaries (HIGH)

- `bound-feature-isolation` - Enforce feature isolation
- `bound-interface-contracts` - Define explicit interface contracts
- `bound-feature-scoped-routing` - Scope routing to feature concerns
- `bound-minimize-shared-state` - Minimize shared state between features
- `bound-event-based-communication` - Use events for cross-feature communication
- `bound-feature-size` - Keep features appropriately sized

### 4. Data Fetching (HIGH)

- `fquery-single-responsibility` - Keep query functions single-purpose
- `fquery-colocate-with-feature` - Colocate data fetching with features
- `fquery-parallel-fetching` - Fetch independent data in parallel
- `fquery-avoid-n-plus-one` - Avoid N+1 query patterns
- `fquery-feature-scoped-keys` - Use feature-scoped query keys
- `fquery-server-component-fetching` - Fetch at server component level

### 5. Component Organization (MEDIUM-HIGH)

- `fcomp-single-responsibility` - Apply single responsibility to components
- `fcomp-composition-over-props` - Prefer composition over prop drilling
- `fcomp-container-presentational` - Separate container and presentational concerns
- `fcomp-props-as-data-boundary` - Use props as feature boundaries
- `fcomp-colocate-styles` - Colocate styles with components
- `fcomp-error-boundaries` - Use feature-level error boundaries

### 6. State Management (MEDIUM)

- `fstate-feature-scoped-stores` - Scope state stores to features
- `fstate-server-state-separation` - Separate server state from client state
- `fstate-lift-minimally` - Lift state only as high as necessary
- `fstate-context-sparingly` - Use context sparingly for feature state
- `fstate-reset-on-unmount` - Reset feature state on unmount

### 7. Testing Strategy (MEDIUM)

- `test-colocate-with-feature` - Colocate tests with features
- `test-feature-isolation` - Test features in isolation
- `test-shared-utilities` - Create feature-specific test utilities
- `test-integration-at-app-layer` - Write integration tests at app layer

### 8. Naming Conventions (LOW)

- `name-feature-naming` - Use domain-driven feature names
- `name-file-conventions` - Use consistent file naming conventions
- `name-descriptive-exports` - Use descriptive export names

## How to Use

Read `references/<rule-id>.md` for each rule above that matches the task: why it matters, then incorrect vs. correct code.

The layering and boundary rules align with Feature-Sliced Design (FSD), the most widely adopted React architecture standard; see [feature-sliced.design](https://feature-sliced.design/) for the full methodology.

## Related Skills

- For data fetching, see `tanstack-query` skill
- For React component patterns, see `react` skill

© PyModel · MIT · PyModel/react-frontend-skills

Similar skills

Everything for Frontend and UI →

feature-arch by other authors comes first.

From the same set9

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor