Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Factory-AI/factory-plugins --skill no-use-effect -a claude-code
Open on GitHub

What 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 useEffect calls 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-code

2Manually: put the files in place

~/.claude/skills/no-use-effect/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/no-use-effect/

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.

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor