Model, review, and refactor application state so source state stays minimal, derived state is computed instead of synchronized, impossible states are not representable, and each piece of state lives in the right place. Use this whenever the user mentions state management, reducers, stores, Redux, Zustand, React state, Vue state, Pinia, selectors, derived state, duplicated state, boolean flags, invalid states, async status, useEffect soup, forms, wizards, filters, URL state, server state, or confusing UI logic, even if they do not explicitly ask for a "state model."
87%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Use this reference when the task is implemented with React, React Native, or React-compatible component state patterns.
useEffect for logic triggered by user actions.useReducer when several fields change together or transitions depend on current state.useRef for mutable values that do not belong in rendering.useSyncExternalStore only for actual external stores or browser APIs, not as a workaround for local modeling problems.Prefer storing:
status instead of several request booleansPrefer deriving:
isEmpty, hasItems, canSubmit, isDirty, and similar booleansselectedId plus entity collectionuseState is enoughUse local useState when:
Move to useReducer when:
useEffect that copies props into stateuseEffect that recalculates derived values and writes them back into stateisLoading, isSuccess, isError, isIdleWhen refactoring React code:
status.useReducer only if it clarifies transitions.type Status = 'idle' | 'editing' | 'submitting' | 'success' | 'failure';
type State = {
status: Status;
draft: DraftForm;
error: string | null;
};If error only exists in failure, prefer a discriminated union instead of a loose nullable field.