Skip to content
Back to skills

No Useeffect

ASecurity

Apply the user's ban on direct React useEffect calls when implementing or refactoring component synchronization.

  • 63 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 9, 2026
code-qualityreactrefactoringgitapi

Works with

  • api

Security analysis

A100/100

Scanned October 5, 2026

npx -y skills add ahonn/dotfiles --skill no-useeffect --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of No Useeffect?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for No Useeffect
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ahonn-no-useeffect/badge)](https://www.skillsdirectory.com/skills/ahonn-no-useeffect)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: no-useeffect
description: Apply the user's ban on direct React useEffect calls when implementing or refactoring component synchronization.
---

# No Direct useEffect

Do not call `useEffect` directly in application components or feature hooks. Use the project's approved primitives and lifecycle architecture. This is the user's coding preference; it does not imply React has no legitimate effect use cases.

Inspect project guidance and lint exemptions first. A project may permit direct effects inside designated low-level primitives such as `useMountEffect`, `useSharedValueSync`, or `useDelayedFlag`. Respect those explicit boundaries instead of imposing a single global wrapper. Do not introduce an unapproved wrapper simply to evade the ban.

## Choose by the behavior needed

| Need | Preferred approach |
|------|--------------------|
| Compute a value from props or state | Derive during render; memoize only when the computation warrants it |
| Respond to a user action | Run the action in its event handler or store action |
| Fetch and cache server data | Use the project's query library or framework loader |
| Read a mutable external store | Use its supported hook or `useSyncExternalStore` |
| Initialize an external resource for a mount | Use the approved mount primitive with cleanup |
| Synchronize a changing input with an external resource | Use an approved reactive primitive or the resource's lifecycle API |
| Reset all local state for a new entity | Use `key` when a full remount matches the intended behavior |

These are decision aids, not an exhaustive replacement theorem. When none fits, inspect the external system's lifecycle and existing primitives before proposing a design. Follow global AGENTS.md authorization rules; this skill adds no confirmation requirement for established project patterns.

## Preserve semantics during refactoring

- Derived state should have a single source of truth. Avoid storing values that can be computed from current inputs.
- User-triggered work belongs in the action path; do not relay it through a state flag and an effect.
- Use query keys and options consistent with the installed data library. Cancellation requires the query function or transport to honor the relevant signal; a library alone does not make every request cancellable.
- A mount primitive is appropriate only when setup belongs to that mounted instance. It is not a drop-in replacement for synchronization that must react to changing dependencies.
- Mount setup may run again after remounts and during development lifecycle checks. Return cleanup, release subscriptions and resources, and handle async completion after disposal.
- A `key` resets the entire subtree, including focus, playback, animations, and local state. Use it only when those resets are intended; do not remount solely to avoid reasoning about updates.
- Do not replace `useEffect` with `useLayoutEffect` merely to bypass the rule. Use the project's approved layout mechanism only when synchronous layout work is actually required.

For a new low-level primitive, keep its contract explicit about updates, cleanup, and ownership, and follow project rules for effect exemptions. Select validation through global AGENTS.md; do not add tests solely because an effect was removed.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in code-quality →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.