AgentSkillsCN

state-pattern

选择并落地合适的状态管理方案。

SKILL.md
--- frontmatter
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.