state-safety-action-creator-guard
Installation
SKILL.md
State Safety & Action Creator Guard
Ensure global state remains consistent, immutable, and valid.
Workflow
-
Use Action Creators
- Rule: Never dispatch raw objects (
dispatch({ type: 'FOO' })). - Fix: Import from
src/context/actionCreators.js. - Cross-check: Verify reducer handling in
gameReducer.js. - Why: Centralizes logic and ensures payload shape.
- Rule: Never dispatch raw objects (
-
Enforce Invariants
- Money: Must be
>= 0. - Harmony: Must be
> 0(or triggers Game Over). - Inventory: Items must be unique IDs.
- Money: Must be