
react-gradual-architecture
Incremental React code organization guidelines. Start small, then extract when scanning and responsibilities start to blur. Use when creating features, organizing files, refactoring components, or deciding when to extract hooks, UI, or utils.
Incremental React code organization guidelines. Start small, then extract when scanning and responsibilities start to blur. Use when creating features, organizing files, refactoring components, or deciding when to extract hooks, UI, or utils.
React Gradual Architecture
Lightweight guidance for organizing React code without over-structuring. The core idea: start small, minimum necessary (one file), extract only when it improves clarity or reuse. Contains 12 rules across 5 categories, prioritized by when to apply them in the development lifecycle.
When to Use This Skill
Reference these guidelines when:
- Creating new React features or components
- Organizing component files and folders
- Refactoring a growing component
- Deciding when to extract hooks, UI, or utils
- Structuring feature directories and shared code
- Creating feature documentation (README.md)
Rule Categories by Priority
| Priority | Category | When to Apply | Prefix |
|---|---|---|---|
| 1 | Foundation | Before starting any feature | framework- |
| 2 | Starting | When beginning a new feature | start- |
| 3 | Organization & Structure | When organizing files and folders | organize- |
| 4 | Extraction | When refactoring or extracting code | extract- |
| 5 | Data & State | When managing types and state | data-, state- |
Quick Reference
1. Foundation (CRITICAL)
framework-conventions- Follow framework conventions and keep domain code framework-agnosticframework-react-router- Use.serversuffix for server-only code (React Router / Remix)
2. Starting (CRITICAL)
start-small- Begin features in a single file;- if a file has more that 100 lines of code proceed with organization and extractions accordingly.
component-composition- Prefer composition over configuration; use children instead of many props (exception: variant props)
3. Organization & Structure
organize-features-folder- Place features undersrc/features/<feature>/orapp/features/<feature>/organize-locality- Keep related files close to the featureorganize-reuse-boundaries- Wait for the second use before extracting shared codeorganize-feature-readme- Create README.md for each feature documenting structure and specifications
4. Extraction
extract-scrolling- Extract when scanning becomes difficultextract-to-share- Use hooks for React logic, plain functions for everything elseextract-ui-logic-utils- Extract UI, logic, and utils when concerns divergeextract-container-presentational- Extract container (data) from presentational (UI) components
5. Data & State
data-types-placement- Define types where the data is born. NEVER create separatetypes.tsfilesstate-placement- Keep state local; lift only as high as needed
Rules Reference
The guidelines are organized into focused rule files. Reference the specific rules when making architectural decisions:
Foundation
framework-conventions.md- Follow framework conventions and keep domain code framework-agnosticframework-react-router.md- Use.serversuffix for server-only code (React Router / Remix)
Starting
start-small.md- Begin features in a single filecomponent-composition.md- Prefer composition over configuration; use children instead of many props
Organization & Structure
organize-features-folder.md- Place features undersrc/features/<feature>/orapp/features/<feature>/organize-locality.md- Keep related files close to the featureorganize-reuse-boundaries.md- Wait for the second use before extracting shared codeorganize-feature-readme.md- Create README.md for each feature documenting structure and specifications
Extraction
extract-scrolling.md- Extract when scanning becomes difficultextract-to-share.md- Use hooks for React logic, plain functions for everything elseextract-ui-logic-utils.md- Extract UI, logic, and utils when concerns divergeextract-container-presentational.md- Extract container (data) from presentational (UI) components
Data & State
data-types-placement.md- Define types where the data is bornstate-placement.md- Keep state local; lift only as high as needed
How to Use
Read individual rule files for detailed explanations and code examples:
rules/start-small.md
rules/extract-scrolling.md
rules/organize-features-folder.md
Each rule file contains:
- Brief explanation of why it matters
- Examples showing the pattern
- Guidance on when to apply it
- Additional context and references
Core Principles:
- Start with the overview above to understand the incremental approach
- Reference specific rule files when making architectural decisions
- Apply the smallest change that restores clarity
- Extract only when it improves readability or enables reuse
Full Compiled Document
For the complete guide with all rules expanded and optimized for AI agents: AGENTS.md
Detailed Rule Documentation
See individual rule files in rules/ for in-depth explanations and code examples.
You Might Also Like
Related Skills

coding-agent
Run Codex CLI, Claude Code, OpenCode, or Pi Coding Agent via background process for programmatic control.
openclaw
add-uint-support
Add unsigned integer (uint) type support to PyTorch operators by updating AT_DISPATCH macros. Use when adding support for uint16, uint32, uint64 types to operators, kernels, or when user mentions enabling unsigned types, barebones unsigned types, or uint support.
pytorch
at-dispatch-v2
Convert PyTorch AT_DISPATCH macros to AT_DISPATCH_V2 format in ATen C++ code. Use when porting AT_DISPATCH_ALL_TYPES_AND*, AT_DISPATCH_FLOATING_TYPES*, or other dispatch macros to the new v2 API. For ATen kernel files, CUDA kernels, and native operator implementations.
pytorch
skill-writer
Guide users through creating Agent Skills for Claude Code. Use when the user wants to create, write, author, or design a new Skill, or needs help with SKILL.md files, frontmatter, or skill structure.
pytorch
implementing-jsc-classes-cpp
Implements JavaScript classes in C++ using JavaScriptCore. Use when creating new JS classes with C++ bindings, prototypes, or constructors.
oven-sh
implementing-jsc-classes-zig
Creates JavaScript classes using Bun's Zig bindings generator (.classes.ts). Use when implementing new JS APIs in Zig with JSC integration.
oven-sh