一键导入
state-management
Procedural knowledge for managing application state, data flow, and avoiding race conditions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Procedural knowledge for managing application state, data flow, and avoiding race conditions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Procedural knowledge for generating and maintaining code documentation, API specs, and architecture diagrams.
Procedural knowledge for orchestrating multi-agent systems and Agent-to-Agent (A2A) handoffs.
Procedural knowledge for designing autonomous AI agents with tools, memory, and reasoning loops.
Procedural knowledge for implementing the Model Context Protocol (MCP) to expose local tools to LLMs.
Procedural knowledge for ensuring frontend interfaces comply with WCAG standards.
Procedural knowledge for designing and configuring continuous integration and deployment pipelines.
| name | state-management |
| description | Procedural knowledge for managing application state, data flow, and avoiding race conditions. |
Procedural knowledge for managing application state, data flow, and avoiding race conditions.
Enable the Developer role to architect clean, predictable state transitions in frontend or backend systems, preventing bugs related to mutation and async race conditions.
Step 1: State Localization
- Keep state as close to where it is used as possible.
- Avoid polluting global state (Redux/Context) with ephemeral UI state (e.g., modal open/close).
Step 2: Immutability
- Never mutate state directly. Always return a new object/array.
- Use predictable reducers for complex state transitions.
Step 3: Async State
- Explicitly model `loading`, `error`, and `success` states for data fetching.
- Handle race conditions (e.g., ignoring out-of-order network responses).
Step 1: Statelessness
- Design API endpoints to be stateless where possible.
- Store session data in external stores (e.g., Redis), not in server memory.
Step 2: Concurrency Control
- Use Optimistic Concurrency Control (version numbers) or Pessimistic Locking for critical database updates to prevent lost updates.
- Ensure background jobs are idempotent.
"Apply the state-management skill from .ace/skills/state-management/SKILL.md
to refactor the data flow in this React component."