react-hooks

Detect and fix React hook violations across JavaScript and TypeScript codebases.

1|Updated Dec 30, 2025
One-click install
npx skills add https://github.com/minhcopilot/antigravity --skill react-hooks-minhcopilot
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-hooks
Source: https://github.com/minhcopilot/antigravity/tree/main/skills/react-hooks
Command: npx skills add https://github.com/minhcopilot/antigravity --skill react-hooks-minhcopilot

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams enforce correct React hook usage by identifying common hook violations, ensuring hooks are called in the correct order, and preventing dependency-related bugs.

Core Features & Use Cases

  • Rules of Hooks validations: Detect early returns before hook calls and hooks called conditionally.
  • useEffect dependency management: Identify missing or stale dependencies and suggest fixes.
  • Hook ordering and context patterns: Ensure consistent hook sequences and proper use of useContext.
  • Custom hook extraction: Propose safe extraction of reusable logic into custom hooks for maintainability.
  • Use case: While refactoring a large component, automatically surface hook usage issues and provide fixes to make it compliant.

Quick Start

Run the analysis on your React codebase to surface hook violations and recommended fixes without changing source files manually.

Frequently Asked Questions about react-hooks

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

FAQPage Schema
How do I fix React hooks violations like conditional hook calls and early returns?

To fix React hooks violations, you must ensure hooks are called at the top level and never inside conditions or early returns. This Skill detects these rules of hooks violations and proposes safe patterns to restructure your component logic.

How do I find missing or stale dependencies in useEffect during a code review?

Finding missing or stale useEffect dependencies requires analyzing the component's reactive values. This Skill automates dependency management by identifying incorrect dependency arrays and suggesting fixes to prevent bugs during development and code reviews.

What is the best way to enforce consistent hook ordering and context patterns across multiple files?

Enforcing consistent hook ordering and proper useContext usage involves analyzing your React codebase for sequence deviations. This Skill validates hook sequences across multiple JavaScript and TypeScript files to ensure compliant and maintainable code.

Can I automatically extract custom hooks to resolve complex React component refactors?

You can resolve complex component refactors by extracting reusable logic into custom hooks. This Skill analyzes your code and proposes safe custom hook extraction patterns to improve maintainability without manually changing source files.

Does this hook validation tool work with both JavaScript and TypeScript React codebases?

Yes, this hook validation tool works with both JavaScript and TypeScript React codebases. It analyzes component code across multiple files to validate hook usage, detect ordering mistakes, and propose automated checks.

Why does my custom hook cause ordering mistakes when reused across different React components?

Custom hook reuse can cause ordering mistakes if internal hooks are called conditionally or inconsistently. This Skill analyzes component code to detect hook-ordering mistakes and suggests safe patterns ensuring consistent execution sequences.