reviewing-state-management

📁 djankies/claude-configs 📅 9 days ago
1
总安装量
1
周安装量
#43745
全站排名
安装命令
npx skills add https://github.com/djankies/claude-configs --skill reviewing-state-management

Agent 安装分布

replit 1
junie 1
windsurf 1
trae 1
qoder 1
opencode 1

Skill 文档

Review: State Management

Checklist

State Immutability

  • No direct state mutation
  • Using spread operators or immutable update patterns
  • Arrays updated with map/filter/concat (not push/splice)
  • Objects updated with spread or Object.assign

State Location

  • Local state used when appropriate
  • Context only for cross-cutting concerns
  • No prop drilling through 3+ levels
  • Frequently changing state not in Context

useReducer Usage

  • Used for complex state logic
  • Reducer functions are pure
  • Action types are consistent
  • State updates follow patterns

Context Patterns

  • Split contexts for different concerns
  • Using use() API in React 19 (not useContext)
  • Context providers at appropriate level
  • No unnecessary re-renders

Anti-Patterns

  • ❌ Direct state mutation (state.push(), state.x = y)
  • ❌ Context for frequently changing values
  • ❌ Excessive prop drilling
  • ❌ God components managing too much state

For comprehensive state patterns, see: research/react-19-comprehensive.md.