# state-pattern > Choose and implement the right state management pattern. - Author: Adam Winick - Repository: sinelanguage/cursor-config-web - Version: 20260201223507 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/sinelanguage/cursor-config-web - Web: https://mule.run/skillshub/@@sinelanguage/cursor-config-web~state-pattern:20260201223507 --- --- name: state-pattern description: Choose and implement the right state management pattern. disable-model-invocation: true --- # State Pattern Select local vs global state and implement the pattern with best practices. ## When to Use - Use this skill when state is shared across multiple components or routes. ## Inputs - State shape and lifecycle - Consumers and update frequency - Persistence or caching needs ## Instructions 1. Decide local vs global state (justify decision). 2. Implement store or context if global. 3. Add selectors or derived state helpers. 4. Add tests for state updates and selectors. ## Output - State implementation with tests and a short rationale.