eisland-dev-refactor-module-split

Solid

Refactor a monolithic React component file into a standardized module structure with components/, hooks/, utils/, and config/ subdirectories. Use this skill whenever the user asks to "split", "refactor", "拆分", "拆解", or "restructure" a component file into subdirectories, or when they mention organizing code into utils/hooks/config/components folders.

Code & Development 238 stars 11 forks Updated today GPL-3.0

Install

View on GitHub

Quality Score: 89/100

Stars 20%
79
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Refactor Module Split Split a monolithic React component file into a clean module structure with four subdirectories: `components/`, `hooks/`, `utils/`, and `config/`. ## When to use - A single `.tsx` file has grown large and contains multiple concerns (utility functions, hooks, sub-components, constants) - The user explicitly asks to split/refactor a component into subdirectories - The file is a React component that mixes UI rendering, state management, utility logic, and configuration ## Process ### Step 1: Analyze the source file Read the target file in full. Categorize every piece of code into one of four buckets: | Bucket | Criteria | Target directory | |--------|----------|-----------------| | **Pure functions** | No React hooks, no side effects, deterministic input→output | `utils/` | | **React hooks** | Uses `useState`, `useEffect`, `useMemo`, `useCallback`, or custom hooks | `hooks/` | | **Sub-components** | Returns JSX, used within the main component | `components/` | | **Constants** | `const` values, config keys, i18n keys/defaults, type-only definitions used across modules | `config/` | Also check if the file's sibling directories already exist (e.g., `components/` or `hooks/` may already have files from prior refactoring). Don't duplicate existing extractions. ### Step 2: Create the extracted files For each extracted piece, create a new file in the appropriate directory. Every file must include: 1. **License header** — copy the exact GPL-3.0 block fr...

Details

Author
JNTMTMTM
Repository
JNTMTMTM/eIsland
Created
4 months ago
Last Updated
today
Language
TypeScript
License
GPL-3.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category