component-refactoring

Originally fromlanggenius/dify
Installation
SKILL.md

Component Refactoring Skill

Refactor high-complexity React components with the patterns and workflow below.

Core Refactoring Patterns

Pattern 1: Extract Custom Hooks

When: Component has complex state management, multiple useState/useEffect, or business logic mixed with UI.

Dify Convention: Place hooks in a hooks/ subdirectory or alongside the component as use-<feature>.ts.

// ❌ Before: Complex state logic in component
const Configuration: FC = () => {
  const [modelConfig, setModelConfig] = useState<ModelConfig>(...)
  const [datasetConfigs, setDatasetConfigs] = useState<DatasetConfigs>(...)
  const [completionParams, setCompletionParams] = useState<FormValue>({})
Related skills

More from pageai-pro/ralph-loop

Installs
24
GitHub Stars
230
First Seen
Feb 23, 2026