UI Component Extractor
Goal: systematically split bloated pages/components to improve reuse and maintainability.
SSOT
- •
../../component-extraction-rules.md - •
../../frontend-code-standards.md(naming and directory standards)
Trigger Thresholds
- •Single file > 300 lines
- •Single component > 200 lines
- •Same JSX pattern repeated >= 3 times
- •JSX nesting depth > 5
- •Conditional rendering branches > 3
- •Complex business logic suitable for hook extraction
Execution Flow
- •Detect extraction candidates
- •Mark structure blocks, repeated blocks, state blocks, and logic blocks.
- •Choose extraction strategy
- •Structure block -> section subcomponent
- •Repeated block -> reusable component
- •State block -> state-focused component
- •Logic block ->
useXxxcustom hook
- •Implement refactor
- •Keep props minimal and types complete.
- •Avoid introducing tighter coupling after extraction.
- •Regression validation
- •Behavior consistency (no regression in UI/interaction/data flow).
- •Consistent import paths, export index, and naming.
Output Contract
- •Before/after structure comparison
- •New component/hook list
- •Reuse gains and risk points
- •Next extraction candidates
Collaboration
- •Use with
ui-generation-workflow-runner: trigger in Step 3 optimization. - •Use with
frontend-standards-enforcer: run standards re-check after refactor.