Claude-skill-registry feature-arch
React feature-based architecture guidelines for scalable applications (formerly feature-architecture). This skill should be used when writing, reviewing, or refactoring React code to ensure proper feature organization. Triggers on tasks involving project structure, feature organization, module boundaries, cross-feature imports, data fetching patterns, or component composition.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/feature-arch" ~/.claude/skills/majiayu000-claude-skill-registry-feature-arch && rm -rf "$T"
skills/data/feature-arch/SKILL.mdFeature-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 | |
| 2 | Import & Dependencies | CRITICAL | |
| 3 | Module Boundaries | HIGH | |
| 4 | Data Fetching | HIGH | |
| 5 | Component Organization | MEDIUM-HIGH | |
| 6 | State Management | MEDIUM | |
| 7 | Testing Strategy | MEDIUM | |
| 8 | Naming Conventions | LOW | |
Quick Reference
1. Directory Structure (CRITICAL)
- Organize by feature, not technical typestruct-feature-folders
- Make features self-containedstruct-feature-self-contained
- Use shared layer for truly generic code onlystruct-shared-layer
- Keep directory hierarchy flatstruct-flat-hierarchy
- Include only necessary segmentsstruct-optional-segments
- Separate app layer from featuresstruct-app-layer
2. Import & Dependencies (CRITICAL)
- Enforce unidirectional import flowimport-unidirectional-flow
- Prohibit cross-feature importsimport-no-cross-feature
- Export through public API onlyimport-public-api
- Avoid deep barrel file re-exportsimport-avoid-barrel-files
- Use consistent path aliasesimport-path-aliases
- Use type-only imports for typesimport-type-only
3. Module Boundaries (HIGH)
- Enforce feature isolationbound-feature-isolation
- Define explicit interface contractsbound-interface-contracts
- Scope routing to feature concernsbound-feature-scoped-routing
- Minimize shared state between featuresbound-minimize-shared-state
- Use events for cross-feature communicationbound-event-based-communication
- Keep features appropriately sizedbound-feature-size
4. Data Fetching (HIGH)
- Keep query functions single-purposefquery-single-responsibility
- Colocate data fetching with featuresfquery-colocate-with-feature
- Fetch independent data in parallelfquery-parallel-fetching
- Avoid N+1 query patternsfquery-avoid-n-plus-one
- Use feature-scoped query keysfquery-feature-scoped-keys
- Fetch at server component levelfquery-server-component-fetching
5. Component Organization (MEDIUM-HIGH)
- Apply single responsibility to componentsfcomp-single-responsibility
- Prefer composition over prop drillingfcomp-composition-over-props
- Separate container and presentational concernsfcomp-container-presentational
- Use props as feature boundariesfcomp-props-as-data-boundary
- Colocate styles with componentsfcomp-colocate-styles
- Use feature-level error boundariesfcomp-error-boundaries
6. State Management (MEDIUM)
- Scope state stores to featuresfstate-feature-scoped-stores
- Separate server state from client statefstate-server-state-separation
- Lift state only as high as necessaryfstate-lift-minimally
- Use context sparingly for feature statefstate-context-sparingly
- Reset feature state on unmountfstate-reset-on-unmount
7. Testing Strategy (MEDIUM)
- Colocate tests with featurestest-colocate-with-feature
- Test features in isolationtest-feature-isolation
- Create feature-specific test utilitiestest-shared-utilities
- Write integration tests at app layertest-integration-at-app-layer
8. Naming Conventions (LOW)
- Use domain-driven feature namesname-feature-naming
- Use consistent file naming conventionsname-file-conventions
- Use descriptive export namesname-descriptive-exports
How to Use
Read individual reference files for detailed explanations and code examples:
- Section definitions - Category structure and impact levels
- Rule template - Template for adding new rules
- Individual rules:
references/{prefix}-{slug}.md
Related Skills
- For feature planning, see
skillfeature-spec - For data fetching, see
skilltanstack-query - For React component patterns, see
skillreact-19
Full Compiled Document
For the complete guide with all rules expanded:
AGENTS.md