Apply these strategies to keep components, hooks, and methods focused, testable, and readable. Rules are split into component, hook, and method simplification.
| KISS | Simplest solution that works. Avoid over-engineering. | | Single responsibility | One clear responsibility per component or function; extract utilities, hooks, sub-components. | | DRY | Extract common logic; create reusable functions or components. | | YAGNI | Don't build features before they're needed. |
| Composition | Prefer composing small components and utilities over large, multi-purpose blocks. |
구성요소, 후크 및 메소드를 단순화하는 전략: 분해 순서(유틸리티, 후크, 하위 구성요소), 조기 반환, 제어 흐름, 매개변수 설계 및 코드 냄새 수정. 사용자가 말할 때 사용: ungodify 이 메서드/함수/컴포넌트, 이 메서드/함수/컴포넌트를 단순화하고, 이 메서드/함수/컴포넌트를 만드세요. 덜 복잡하다; 또는 대규모 구성 요소, 후크 또는 기능을 리팩토링하여 복잡성을 줄이고 적용할 때 단일 책임 또는 구성 요소, 후크 또는 방법을 단순화하는 방법을 묻는 것입니다. 출처: lichens-innovation/ai-dev-tools.