Skip to content

About

Skill: enforces strict no-direct-useEffect rule in React. Use derived state, event handlers, useMemo, key-based resets, or useMountEffect instead.

Resources

Stars

70 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

no-use-effect

A Skill that enforces a strict no-direct-useEffect rule in React and React Native codebases.

Based on Factory's approach and React's official You Might Not Need an Effect guide.

Install

npx skills add alejandrobailo/no-use-effect

The 6 Rules

  1. Derive state, don't sync it — Compute inline (useMemo only for expensive work without React Compiler)
  2. Use data-fetching libraries — React Query, SWR, etc., or use() + Suspense in React 19+, instead of fetch-in-effect
  3. Event handlers, not effects — User actions belong in handlers
  4. useMountEffect for mount-time sync — Named wrapper for useEffect(..., [])
  5. Reset with key — Use React's remount semantics instead of reset effects
  6. Never patch a broken effect with a ref — Remove the effect instead of guarding it with hasRun/isMounted refs

What it does

When active, this skill prevents Claude from writing useEffect directly in components. Instead, it guides toward the correct primitive for each case: derived state, event handlers, useSyncExternalStore, data-fetching libraries, key-based resets, or useMountEffect.

React Compiler

The skill detects React Compiler (reactCompiler: true in next.config.* or babel-plugin-react-compiler in package.json). When it's on, the skill never suggests useMemo or useCallback, and project rules about memoization take precedence.

About

Skill: enforces strict no-direct-useEffect rule in React. Use derived state, event handlers, useMemo, key-based resets, or useMountEffect instead.

Resources

Stars

70 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors