react-hooks

Enforce consistent React hook and Context patterns in React 19 projects.

11|2|Updated Feb 5, 2026
One-click install
npx skills add https://github.com/recca0120/code-quest --skill react-hooks-recca0120
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-hooks
Source: https://github.com/recca0120/code-quest/tree/main/.claude/skills/react-hooks
Command: npx skills add https://github.com/recca0120/code-quest --skill react-hooks-recca0120

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill solves the common React hook problems of unnecessary re-renders, stale closures, infinite loops, and noisy biome exhaustive-deps warnings by standardizing how custom hooks and Context providers should be structured in this project.

Core Features & Use Cases

  • Custom hook design rules: Extract hooks only when there is real duplication, follow naming/return-value conventions, and favor stable references with useCallback/useMemo.
  • Context splitting guidance: Use separate State and Actions contexts so action-only consumers don’t re-render when state changes.
  • Effect and dependency correctness: Use effects only for external synchronization (WebSocket, timers, subscriptions) and derive render-time data during render or with memoization; align with biome useExhaustiveDependencies and safe ref/callback patterns.
  • Testing conventions for hooks: Test custom hooks with @testing-library/react using renderHook and act, without calling hooks directly.

Quick Start

Apply the react-hooks guidelines to refactor a Context provider by splitting state vs actions, then fix any biome exhaustive-deps warnings in its effects using the documented dependency and ref patterns.

Frequently Asked Questions about react-hooks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix biome useExhaustiveDependencies warnings in React hooks?

Fix biome useExhaustiveDependencies warnings by applying safe ref and callback patterns, using effects only for external synchronization, and deriving render-time data during render or with memoization to align dependencies correctly.

Why do my React Context providers cause unnecessary re-renders?

React Context providers cause unnecessary re-renders when state and actions share a single context. Split them into separate State and Actions contexts so action-only consumers don't re-render when state changes.

When should I extract a custom hook in React?

Extract a custom hook in React only when there is real duplication. Follow naming and return-value conventions, and favor stable references using useCallback and useMemo to prevent inefficient re-render patterns.

How do I test custom React hooks with renderHook and act?

Test custom React hooks with @testing-library/react by using renderHook and act utilities. Never call hooks directly; always render them within a component testing wrapper to ensure correct execution behavior.

Does this React hooks guideline work for React 19 projects?

Yes, this React hooks guideline works for React 19 projects. It enforces correct dependency, ref, and callback patterns specifically aligned with biome useExhaustiveDependencies to prevent stale closures and infinite loops.