Claude Code Plugins

Community-maintained marketplace

Feedback

react-best-practices

@buildworksai/AgentHub
0
0

React + TypeScript development best practices

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name react-best-practices
description React + TypeScript development best practices
status ✅ Working
last-validated Mon Dec 15 2025 00:00:00 GMT+0000 (Coordinated Universal Time)

React Best Practices

Purpose

Invoked when writing or reviewing React components. Provides React + TypeScript best practices for hooks, state management, and performance optimization.

Component Design

  • Keep components small and focused (single responsibility)
  • Prefer functional components over class components
  • Extract reusable logic into custom hooks
  • Use composition over inheritance
  • Props should be immutable

Hooks Best Practices

  • Follow Rules of Hooks (only at top level, only in React functions)
  • Use useState for component-specific state
  • Use useReducer for complex state logic
  • Use useCallback for stable function references
  • Use useMemo for expensive computations
  • Clean up effects with return functions

State Management

  • Keep state as local as possible
  • Lift state only when needed
  • Use Context for global state sparingly
  • Consider state management libraries for complex apps
  • Derive data instead of storing redundant state

Performance

  • Use React.memo for expensive components
  • Avoid inline function definitions in render
  • Use key prop correctly in lists
  • Split large components into smaller ones
  • Use lazy loading for route components

Code Organization

  • One component per file
  • Group by feature/module, not by type
  • Use index files for clean imports
  • Separate business logic from UI logic
  • TypeScript required for all components

Common Pitfalls

  • Don't mutate state directly
  • Don't use array index as key
  • Don't forget cleanup in useEffect
  • Don't nest components inside render
  • Don't fetch data without handling loading/error states