React Hooks Best Practices
Best practices for using hooks in React applications and designing custom hooks across DX, optimization, and logic. Use this skill for component hook usage, custom hook design, hook API review, and hook correctness/performance checks.
Structure
rules/- Individual guide files_sections.md- Section metadata_template.md- Template for new rulesscope-description.md- Individual rule files
metadata.json- Document metadataAGENTS.md- Compiled overview
Creating a New Rule
- Copy
rules/_template.mdtorules/scope-description.md - Choose the appropriate scope prefix:
dx-for hook API ergonomics, naming, typing, and composabilityoptimization-for render boundaries, subscriptions, hot paths, and cleanup/performance tradeoffslogic-for correctness, lifecycle, SSR, stale closures, and edge cases
- Fill in the frontmatter and guide content
- Include concise examples where they clarify the hook behavior
File Naming Convention
- Files starting with
_are special metadata files - Rule files use
scope-description.md - Section is inferred from the filename prefix
Impact Levels
HIGH- Prevents broad unnecessary re-renders or defines a core hook API patternMEDIUM- Useful for everyday hook ergonomics and correctnessLOW- Situational conventions