Index of every page on this site: llms.txt
All skills
siberiacancode avatar

/react-hooks-best-practices

@49a3a43
Run it yourself

React hooks best practices for React application code and custom hook design across DX, optimization, and logic. Use when writing components with hooks, creating or refactoring custom hooks, reviewing hook usage/APIs/internals, checking effects/dependencies/state/refs/callbacks, or improving hook correctness, ergonomics, and performance.

Use this Skill: https://skilld.dev/gh/siberiacancode/agent-skills/react-hooks-best-practices

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈92 tokens for metadata: the name and description. ≈491 when used: this file. ≈4.3k more on demand in 7 files.

Description uses 4.6% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈368 characters, or 4.6%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

React Hooks Best Practices

Practical rules for using hooks in React applications and designing custom hooks across three lenses: DX, optimization, and logic.

When to Apply

Reference these guidelines when:

  • Writing React components that use hooks
  • Creating or refactoring custom hooks
  • Designing hook APIs that are ergonomic and composable
  • Reviewing dependencies, effects, refs, state, callbacks, and memoization
  • Reviewing hook APIs for unnecessary re-renders
  • Reviewing hook internals for stale closures, cleanup, SSR, and lifecycle correctness
  • Designing custom hooks that subscribe to high-frequency updates
  • Consuming hooks that expose snapshot, callback, and watch() APIs
  • Refactoring hooks that update React state on every browser event
  • Moving DOM-adjacent work out of React render state

Rule Categories by Priority

Priority Category Impact Prefix
1 DX HIGH dx-
2 Optimization HIGH optimization-
3 Logic HIGH logic-

Quick Reference

1. DX (HIGH)

  • dx-extract-complex-hook - Move complex feature logic into custom hooks with grouped return contracts like form, state, functions, refs, and features

2. Optimization (HIGH)

  • optimization-watch-mode - Use watch() only when the UI needs reactive render data; keep hot updates in snapshots and callbacks otherwise

3. Logic (HIGH)

Rules coming soon.

How to Use

Read individual rule files for detailed explanations and examples:

rules/dx-extract-complex-hook.md
rules/optimization-watch-mode.md

Each rule file contains:

  • The problem the pattern solves
  • Incorrect and correct code examples
  • Guidance for hook authors and hook consumers
  • References to source material where relevant

Full Compiled Document

For the compiled overview, see AGENTS.md.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts3mo3 checks · Risk SAFE
  • Gen Agent Trust Hub3mo

    This skill provides a set of architectural guidelines and performance best practices for using React Hooks. It consists entirely of documentation and code examples intended for developer guidance and contains no malicious code, hidden instructions, or security risks.

  • Socket3mo

    No alerts

  • Snyk3mo

    Risk: LOW · No issues

Signed by skilld at 49a3a43. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 4 months ago

README badge

README badge for siberiacancode/agent-skills/react-hooks-best-practices