What problem does it solve?
This skill tackles the problem of extensive code duplication (currently ~25% or 800 lines) across similar React components, leading to high maintenance costs and inconsistent codebases. It streamlines development by promoting reusable, generic components and custom hooks.
Core Features & Use Cases
- Duplicate Code Elimination: Identify and refactor repetitive logic into reusable custom hooks (e.g.,
useAutoSaveNotes, useModuleProgress).
- Generic Component Creation: Develop a
BaseLearningSystem component to serve as a template for multiple learning systems, drastically reducing boilerplate.
- Modular Subcomponents: Extract common UI blocks (e.g.,
Breadcrumb, ProgressBar, NotesSection) into shared, reusable components.
- Use Case: Transform five highly duplicated
*LearningSystem.jsx components into a single BaseLearningSystem component, reducing 800 lines of repeated code to a minimal, maintainable structure.
Quick Start
Use the component-refactor skill to extract the auto-save logic from CLearningSystem.jsx into a new useAutoSaveNotes.js custom hook.