Back to skills
extension
Category: Development & EngineeringNo API key required

react-code-smells

Principal-engineer-level React refactoring patterns for eliminating code smells. Covers prop drilling, state explosion, component composition, abstraction quality, coupling, hooks, rendering patterns, and testability. Use when refactoring existing React codebases, reviewing PRs for architectural issues, or identifying technical debt in React applications.

personAuthor: jakexiaohubgithub

Principal Engineering React Best Practices

Principal-engineer-level refactoring guide for React applications. Contains 42 rules across 8 categories, prioritized by impact from critical (state architecture, composition) to incremental (testability). Each rule includes code smell indicators, before/after examples, and safe transformation steps.

When to Apply

Reference these guidelines when:

  • Refactoring existing React codebases
  • Reviewing PRs for architectural issues
  • Identifying technical debt
  • Planning large-scale refactoring efforts
  • Deciding whether to extract, inline, or restructure components
  • Improving testability of React code

Rule Categories by Priority

| Priority | Category | Impact | Prefix | |----------|----------|--------|--------| | 1 | State Architecture | CRITICAL | state- | | 2 | Component Composition | CRITICAL | comp- | | 3 | Abstraction Quality | HIGH | abs- | | 4 | Coupling & Cohesion | HIGH | couple- | | 5 | Hook Hygiene | MEDIUM-HIGH | hook- | | 6 | Render Patterns | MEDIUM | render- | | 7 | Side Effect Management | MEDIUM | effect- | | 8 | Testability | LOW-MEDIUM | test- |

Quick Reference

1. State Architecture (CRITICAL)

2. Component Composition (CRITICAL)

3. Abstraction Quality (HIGH)

4. Coupling & Cohesion (HIGH)

5. Hook Hygiene (MEDIUM-HIGH)

6. Render Patterns (MEDIUM)

7. Side Effect Management (MEDIUM)

8. Testability (LOW-MEDIUM)

How to Use

Read individual reference files for detailed explanations and code examples:

Related Skills

  • For React 19 API best practices, see react skill
  • For React core principles, see react-principle-engineer skill
  • For form handling, see react-hook-form skill

References

  1. react.dev - Official React documentation
  2. kentcdodds.com - Advanced React patterns
  3. patterns.dev - Design patterns in JavaScript
  4. testing-library.com - Testing best practices