no-use-effect · factory-ai — Claude Code skill: ban useEffect in React
A skill that stops the agent from writing useEffect in React code and points to five replacements. Useful during refactors and PR review.
npx skills add Factory-AI/factory-plugins --skill no-use-effect -a claude-codeWhat no-use-effect does
The rule is simple: never call useEffect directly. Reach for inline computation, a data-fetching library, an event handler, useMountEffect, or a key on the parent instead. A table maps each case to its replacement, and every rule ships with a bad example, a good one, and a smell test that tells you when you are drifting back to an effect.
The skill activates while the agent writes a new component, refactors existing useEffect calls, reviews a PR that adds effects, or drops in useEffect just in case. There is one escape hatch: useMountEffect, a wrapper around useEffect with an empty dependency array, so the intent reads clearly. It is meant for one-time external sync on mount — focus, scroll, browser API subscriptions, third-party widget lifecycles.
After edits the skill suggests running npm run lint, npm run typecheck and npm run test with a package filter. One thing to check first: the project needs the no-restricted-syntax lint rule configured, otherwise the ban rests on the agent's discipline alone. Without that rule, useEffect creeps back in at the first convenient moment.
What it helps with
- strip redundant
useEffectcalls during a component refactor - explain to the agent why state should not be synced through an effect
- spot a flag-state effect that only relays an action
- replace hand-rolled caching and request cancellation with a library
- reset local component state when an id changes
Example prompts for the agent
- Rewrite this component without useEffect and tell me which rule you applied
- Review this PR: where can useEffect become inline computation?
- The agent added useEffect just in case — check it and remove it
How to install no-use-effect
1Skills CLI (Vercel)
npx skills add Factory-AI/factory-plugins --skill no-use-effect -a claude-code2Manually: put the files in place
~/.claude/skills/no-use-effect/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/no-use-effect/
1Skills CLI (Vercel)
npx skills add Factory-AI/factory-plugins --skill no-use-effect -a codex2Manually: put the files in place
.agents/skills/no-use-effect/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Factory-AI/factory-plugins --skill no-use-effect -a cursor2Manually: put the files in place
.cursor/skills/no-use-effect/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Factory-AI/factory-plugins no-use-effect2Manually: put the files in place
.github/skills/no-use-effect/SKILL.md1Skills CLI (Vercel)
npx skills add Factory-AI/factory-plugins --skill no-use-effect -a gemini-cli2Platform CLI
gemini skills install https://github.com/Factory-AI/factory-plugins --path plugins/typescript/skills/no-use-effectManually: put the files in place
.devin/skills/no-use-effect/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add Factory-AI/factory-plugins --skill no-use-effect -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about no-use-effect
How do I install no-use-effect in Claude?
Run npx skills add Factory-AI/factory-plugins --skill no-use-effect -a claude-code. The skill file lands at ~/.claude/skills/no-use-effect/SKILL.md.
What does no-use-effect do?
It bans direct useEffect calls in React code and offers five replacements: inline computation, a query library, event handlers, useMountEffect, and a key on the parent.
How is useMountEffect different from a plain useEffect?
It wraps useEffect with an empty dependency array. The point is to make it explicit that the sync should happen once on mount, not on every change.
Similar skills
Everything for Frontend and UI →no-use-effect by other authors comes first.