What problem does it solve?
React codebases accumulate unnecessary useEffect calls that mirror query data into local state, chain state updates, and trigger actions from flags, causing bugs like overwritten drafts on refetch and duplicated subscriptions. This Skill provides a decision framework and refactoring workflow to remove avoidable effects while preserving user-visible behavior.
Core Features & Use Cases
- Effect Inventory and Classification: Search a frontend module for every useEffect/useLayoutEffect and classify each as render derivation, query-to-state initialization, synchronization, event workflow, external integration, or test harness.
- Decision Rules and Patterns: Apply ordered rules—derive during render, gate on required data, run actions from events, keep only real external-system integrations—with concrete code patterns from the references file.
- Incremental Migration Workflow: Refactor one semantic seam at a time, verify with focused tests, ESLint, type checks, and browser review, then re-run the inventory to prove the module is clean.
- Use Case: When reviewing a Langfuse frontend form that resets local state via an effect whenever an ID prop changes, use this Skill to replace it with a keyed remount or explicit reset action and confirm drafts survive background refetches.
Quick Start
Use the refactor-react-effects skill to remove avoidable useEffect calls from this frontend module while preserving behavior.