react-best-practices

Standardize React component patterns for hooks, effects, and refs.

Updated Jan 14, 2026
One-click install
npx skills add https://github.com/CarlosDoers/poems-guest-book --skill react-best-practices-carlosdoers
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-best-practices
Source: https://github.com/CarlosDoers/poems-guest-book/tree/main/.agent/skills/react-best-practices
Command: npx skills add https://github.com/CarlosDoers/poems-guest-book --skill react-best-practices-carlosdoers

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps frontend teams write consistent React components by following proven patterns for hooks, effects, refs, and composition, reducing bugs and code churn.

Core Features & Use Cases

  • Pair with TypeScript for type-safe React patterns and improved DX.
  • Use effects as escape hatches to synchronize with external systems, while avoiding unnecessary re-renders.
  • Follow best practices for refs, custom hooks, and component patterns to improve readability and maintainability.
  • Use cases include refactoring legacy code, conducting code reviews, and onboarding new engineers to React best practices.

Quick Start

Audit your React components and apply the included patterns to improve effect usage, hook composition, and predictable rendering.

Frequently Asked Questions about react-best-practices

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

FAQPage Schema
When should I use React effects instead of event handlers?

React effects should be used as escape hatches to synchronize components with external systems, not for responding to user events, preventing unnecessary re-renders and complex data flows.

How do I write type-safe React custom hooks with TypeScript?

Writing type-safe React custom hooks with TypeScript requires correctly typing input parameters and return values, ensuring robust component composition and improved developer experience without losing type inference.

What is the best way to clean up React effects in .tsx components?

The best way to clean up React effects is returning a cleanup function from the effect body, ensuring synchronization logic correctly halts and preventing memory leaks during component unmounting or re-renders.

How do I choose between controlled and uncontrolled component patterns in React?

Choosing between controlled and uncontrolled component patterns in React depends on whether the parent needs to own the state, with controlled components offering predictable rendering and uncontrolled components managing internal refs.

Can I use these React patterns to refactor legacy .jsx code?

Yes, you can use these React patterns to refactor legacy .jsx code by auditing existing components and applying standard hook, ref, and effect best practices to reduce bugs and code churn.