No use effect skill
Reviews React code with useEffect or useLayoutEffect. Replaces effects with derived state, event handlers, query APIs, key resets, useSyncExternalStore, or named hooks. Use when writing components, refactoring effects, or reviewing diffs.From its SKILL.md
npx -y skills add CodingCossack/no-use-effect-skillAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.6 KB, 805 tokens by cl100k_base, as published. Nobody here has run it
No useEffect
Default stance: do not add raw useEffect or useLayoutEffect in application components until the cause is classified.
Use this skill when:
- a diff adds
useEffectoruseLayoutEffect - refactoring existing effects
- debugging stale state, extra renders, render loops, dependency churn, remount issues, or parent/child sync bugs
- deciding between render-time derivation, event handlers, data APIs,
useSyncExternalStore,key,useMountEffect, or a named hook
Fast triage
- Pure derivation from props/state? Compute during render. Use
useMemoonly for measured expensive work. - Specific user interaction? Put it in the event handler or action. Do not relay through state + effect.
- Screen-driven data loading? Use framework loaders, server components, or a query library. If the request is user-triggered, do it in the handler.
- Child effect pushing state or fetched data to a parent? Lift state or fetch in the parent instead.
- External store with subscribe + current snapshot semantics? Use
useSyncExternalStoreor the library’s hook. - Whole subtree should reset when identity changes? Remount with
key. - Only part of state adjusts on prop change? Derive it during render or redesign the state shape. Do not effect-reset it.
- Real external synchronization still remains because the component is on screen? Hide it in a descriptive custom hook. Use
useLayoutEffectonly for pre-paint layout/scroll work.
Red flags
useEffect(() => setX(f(y)), [y])- state flag -> effect -> reset flag
- child effect calling a parent setter
- fetch in effect followed by local
setState - chains of effects whose only job is to trigger more state
- empty
[]effect used as “runs once” - replacing
useEffectwithuseLayoutEffectto dodge the rule
Working mode
- Search for
useEffectanduseLayoutEffect. - Classify each with rules/01-triage.md.
- Rewrite with the smallest matching replacement from rules/02-replacements.md.
- If an effect survives, move it into a named hook and validate it with rules/03-allowed-effects.md.
- Run the checks in rules/04-enforcement.md.
Non-negotiables
- If the external system cannot be named explicitly, the effect is probably wrong.
useMountEffectis only a thin wrapper arounduseEffect([]). It does not mean “exactly once” in dev Strict Mode.- Raw effects in components are exceptional; surviving ones should usually live behind descriptive hooks.
useLayoutEffectis not a loophole. Keep it for pre-paint layout measurement and scroll correction only.
Additional resources
- rules/01-triage.md: first-match classification tree
- rules/02-replacements.md: concrete rewrites for the common anti-patterns
- rules/03-allowed-effects.md: the narrow set of surviving effects,
useMountEffect,useLayoutEffect, cleanup, Strict Mode, and SSR - rules/04-enforcement.md: lint and review enforcement
- examples/before-after.md: compact bad/good examples
- reference/react-rationale.md: the React model this skill is built on
What ships with it: 15 files
36.7 KB alongside SKILL.md, 5 of them executable
agents/
- openai.yaml309 B
bootstrap/
- common.shruns4.7 KB
- install-global.shruns1.0 KB
- uninstall-global.shruns699 B
- verify-global.shruns1.4 KB
examples/
- before-after.md1.8 KB
reference/
- react-rationale.md2.2 KB
rules/
- 01-triage.md3.2 KB
- 02-replacements.md6.1 KB
- 03-allowed-effects.md4.7 KB
- 04-enforcement.md2.5 KB
scripts/
- build-zip.shruns981 B
- .gitignore29 B
- PACKAGING.md1.5 KB
- README.md5.4 KB