React Best Practices
shapeshift/web
Comprehensive React and Next.js performance optimization guide with 40+ rules for eliminating waterfalls, optimizing bundles, and improving rendering.
Enforce the no-useEffect rule when writing or reviewing React code.
$ npx skills add mattiacerutti/supernova --skill no-use-effect -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install mattiacerutti/supernova no-use-effect --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/mattiacerutti/supernova.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/no-use-effect .claude/skills/no-use-effect && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "no-use-effect" agent skill from https://github.com/mattiacerutti/supernova/tree/main/.agents/skills/no-use-effect into .claude/skills/no-use-effect/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "no-use-effect", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/mattiacerutti/supernova/tree/main/.agents/skills/no-use-effectType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add mattiacerutti/supernova --skill no-use-effect -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install mattiacerutti/supernova no-use-effect --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/mattiacerutti/supernova.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/no-use-effect .agents/skills/no-use-effect && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "no-use-effect" agent skill from https://github.com/mattiacerutti/supernova/tree/main/.agents/skills/no-use-effect into .agents/skills/no-use-effect/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "no-use-effect", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add mattiacerutti/supernova --skill no-use-effect -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install mattiacerutti/supernova no-use-effect --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/mattiacerutti/supernova.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/no-use-effect .cursor/skills/no-use-effect && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "no-use-effect" agent skill from https://github.com/mattiacerutti/supernova/tree/main/.agents/skills/no-use-effect into .cursor/skills/no-use-effect/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "no-use-effect", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/mattiacerutti/supernova.git --path .agents/skills/no-use-effect--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add mattiacerutti/supernova --skill no-use-effect -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install mattiacerutti/supernova no-use-effect --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/mattiacerutti/supernova.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/no-use-effect .gemini/skills/no-use-effect && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "no-use-effect" agent skill from https://github.com/mattiacerutti/supernova/tree/main/.agents/skills/no-use-effect into .gemini/skills/no-use-effect/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "no-use-effect", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install mattiacerutti/supernova no-use-effectInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add mattiacerutti/supernova --skill no-use-effect -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/mattiacerutti/supernova.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/no-use-effect .github/skills/no-use-effect && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "no-use-effect" agent skill from https://github.com/mattiacerutti/supernova/tree/main/.agents/skills/no-use-effect into .github/skills/no-use-effect/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "no-use-effect", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add mattiacerutti/supernova --skill no-use-effect -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install mattiacerutti/supernova no-use-effect --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/mattiacerutti/supernova.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/no-use-effect .opencode/skills/no-use-effect && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "no-use-effect" agent skill from https://github.com/mattiacerutti/supernova/tree/main/.agents/skills/no-use-effect into .opencode/skills/no-use-effect/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "no-use-effect", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
no-use-effectEnforce the no-useEffect rule when writing or reviewing React code.
No Use Effect is an agent skill from mattiacerutti/supernova. Enforce the no-useEffect rule when writing or reviewing React code. ACTIVATE when writing React components, refactoring existing useEffect calls, reviewing PRs with useEffect, or when an agent adds useEffect "just in case." Provides the five replacement patterns and the useMountEffect escape hatch.
Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Development, covering React components and Refactoring. It works with React. The repository describes itself as: A fast, opinionated development environment for Pi. The licence is MIT.
3 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 984f521. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).
From the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
react.devFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
No Use Effect loads about 1.7k tokens when it runs. Until then it costs about 78 tokens; SKILL.md has 431 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from mattiacerutti/supernova at commit 984f521, republished under its MIT licence (© mattiacerutti). 431 words, ~1,731 tokens.
.claude/skills/no-use-effect/SKILL.md (or your agent's skills folder).Never call useEffect directly. Use derived state, event handlers, data-fetching libraries, or useMountEffect instead.
no-restricted-syntax (configured to ban useEffect)| Instead of useEffect for... | Use |
|---|---|
| Deriving state from other state/props | Inline computation (Rule 1) |
| Fetching data | useQuery / data-fetching library (Rule 2) |
| Responding to user actions | Event handlers (Rule 3) |
| One-time external sync on mount | useMountEffect (Rule 4) |
| Resetting state when a prop changes | key prop on parent (Rule 5) |
useEffect callsuseEffectuseEffect "just in case"Determine what the effect is doing -- deriving state, fetching data, responding to an event, syncing with an external system, or resetting state.
Use the five rules below to pick the right replacement.
Verify that the new code works using existing tools (tests, linting, type checking) and manual testing if necessary.
For the rare case where you need to sync with an external system on mount:
The implementation wraps useEffect with an empty dependency array to make intent explicit:
export function useMountEffect(effect: () => void | (() => void)) {
/* eslint-disable no-restricted-syntax */
useEffect(effect, []);
}Most effects that set state from other state are unnecessary and add extra renders.
// BAD: Two render cycles - first stale, then filtered
function ProductList() {
const [products, setProducts] = useState([]);
const [filteredProducts, setFilteredProducts] = useState([]);
useEffect(() => {
setFilteredProducts(products.filter((p) => p.inStock));
}, [products]);
}
// GOOD: Compute inline in one render
function ProductList() {
const [products, setProducts] = useState([]);
const filteredProducts = products.filter((p) => p.inStock);
}Smell test: You are about to write useEffect(() => setX(deriveFromY(y)), [y]), or you have state that only mirrors other state or props.
Effect-based fetching creates race conditions and duplicated caching logic.
// BAD: Race condition risk
function ProductPage({productId}) {
const [product, setProduct] = useState(null);
useEffect(() => {
fetchProduct(productId).then(setProduct);
}, [productId]);
}
// GOOD: Query library handles cancellation/caching/staleness
function ProductPage({productId}) {
const {data: product} = useQuery(["product", productId], () => fetchProduct(productId));
}Smell test: Your effect does fetch(...) and then setState(...), or you are re-implementing caching, retries, cancellation, or stale handling.
If a user clicks a button, do the work in the handler.
// BAD: Effect as an action relay
function LikeButton() {
const [liked, setLiked] = useState(false);
useEffect(() => {
if (liked) {
postLike();
setLiked(false);
}
}, [liked]);
return <button onClick={() => setLiked(true)}>Like</button>;
}
// GOOD: Direct event-driven action
function LikeButton() {
return <button onClick={() => postLike()}>Like</button>;
}Smell test: State is used as a flag so an effect can do the real action, or you are building "set flag -> effect runs -> reset flag" mechanics.
Good uses: DOM integration (focus, scroll), third-party widget lifecycles, browser API subscriptions.
// BAD: Guard inside effect
function VideoPlayer({ isLoading }) {
useEffect(() => {
if (!isLoading) playVideo();
}, [isLoading]);
}
// GOOD: Mount only when preconditions are met
function VideoPlayerWrapper({ isLoading }) {
if (isLoading) return <LoadingScreen />;
return <VideoPlayer />;
}
function VideoPlayer() {
useMountEffect(() => playVideo());
}Use useMountEffect for stable dependencies (singletons, refs, context values that never change):
// BAD: useEffect with dependency that never changes
useEffect(() => {
connectionManager.on("connected", handleConnect);
return () => connectionManager.off("connected", handleConnect);
}, [connectionManager]); // connectionManager is a singleton from context
// GOOD: useMountEffect for stable dependencies
useMountEffect(() => {
connectionManager.on("connected", handleConnect);
return () => connectionManager.off("connected", handleConnect);
});Smell test: You are synchronizing with an external system, and the behavior is naturally "setup on mount, cleanup on unmount."
// BAD: Effect attempts to emulate remount behavior
function VideoPlayer({ videoId }) {
useEffect(() => {
loadVideo(videoId);
}, [videoId]);
}
// GOOD: key forces clean remount
function VideoPlayer({ videoId }) {
useMountEffect(() => {
loadVideo(videoId);
});
}
function VideoPlayerWrapper({ videoId }) {
return <VideoPlayer key={videoId} videoId={videoId} />;
}Smell test: You are writing an effect whose only job is to reset local state when an ID/prop changes, or you want the component to behave like a brand-new instance for each entity.
Computed values come after hooks and local state, never via useEffect:
export function FeatureComponent({ featureId }: ComponentProps) {
// Hooks first
const { data, isLoading } = useQueryFeature(featureId);
// Local state
const [isOpen, setIsOpen] = useState(false);
// Computed values (NOT useEffect + setState)
const displayName = user?.name ?? 'Unknown';
// Event handlers
const handleClick = () => { setIsOpen(true); };
// Early returns
if (isLoading) return <Loading />;
// Render
return <Flex direction="column" gap="lg">...</Flex>;
}© mattiacerutti, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .agents/skills/no-use-effect of mattiacerutti/supernova.
Open the folder on GitHubat commit 984f521
We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in mattiacerutti/supernova, which our catalogue first saw on October 7, 2026.
No Use Effect next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| No Use Effect this skillmattiacerutti/supernova | 185 | 2 repos | ~1.7k | Automated safety check: Pass | MIT | |
| React Best Practicesshapeshift/web | 206 | 1 repos | ~2k | Automated safety check: Pass | MIT | |
| Migrate Componentasyncapi/generator | 1.1k | — | ~3k | Automated safety check: Pass | Apache-2.0 | |
| Project Form PatternsAkaraChen/aghub | 272 | — | ~1.1k | Automated safety check: Pass | MIT | |
| React Performanceaffaan-m/ECC | 276k | 1 repos | ~4.5k | Automated safety check: Pass | MIT | |
| Vercel React Best Practicessanity-io/sanity | 6.4k | 129 repos | ~1.6k | Automated safety check: Pass | MIT |
shapeshift/web
Comprehensive React and Next.js performance optimization guide with 40+ rules for eliminating waterfalls, optimizing bundles, and improving rendering.
asyncapi/generator
Promote a duplicated React/JSX template-local component into the shared @asyncapi/generator-components package.
AkaraChen/aghub
Form implementation guidance for the aghub desktop app. An agent skill from AkaraChen/aghub.
affaan-m/ECC
React and Next.js performance optimization patterns adapted from Vercel Engineering's React Best Practices (https://github.com/vercel-labs/agent-skills).
sanity-io/sanity
React and Next.js performance optimization guidelines from Vercel Engineering.
mastra-ai/mastra
React performance optimization guidelines from Mastra Engineering.
mattiacerutti/supernova
Write idiomatic Effect v4 TypeScript following official best practices from effect-solutions and the Effect source.
Works with
Categories
Enforce the no-useEffect rule when writing or reviewing React code. No Use Effect is an agent skill from mattiacerutti/supernova. Enforce the no-useEffect rule when writing or reviewing React code.
No Use Effect fits situations like: tasks that involve React components; tasks that involve Refactoring.
Run `npx skills add mattiacerutti/supernova --skill no-use-effect -a claude-code`. Or copy the skill folder (.agents/skills/no-use-effect in mattiacerutti/supernova) into .claude/skills/no-use-effect in your project. Claude Code loads it when a task matches its description.
Run `npx skills add mattiacerutti/supernova --skill no-use-effect -a codex`. Or copy the skill folder (.agents/skills/no-use-effect in mattiacerutti/supernova) into .agents/skills/no-use-effect in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mattiacerutti/supernova --skill no-use-effect -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/no-use-effect, .gemini/skills/no-use-effect, .github/skills/no-use-effect and .opencode/skills/no-use-effect in your project.
SKILL.md names no scripts, command-line tools or credentials: No Use Effect is instructions for the agent only.
SKILL.md names 1 domain. As links in the text: react.dev. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
No Use Effect is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.7k tokens (SKILL.md is roughly 6.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with No Use Effect: React Best Practices (shapeshift/web, 206 stars), Migrate Component (asyncapi/generator, 1.1k stars), Project Form Patterns (AkaraChen/aghub, 272 stars) and React Performance (affaan-m/ECC, 276k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
mattiacerutti (a GitHub user) maintains it in mattiacerutti/supernova, which has 185 GitHub stars. The repository holds 2 skills in this directory. The repository was last updated on October 9, 2026.
Source: mattiacerutti/supernova on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.