state-safety-action-creator-guard

Review state updates to enforce invariants and prefer action creators.

1|Updated Jan 6, 2026
One-click install
npx skills add https://github.com/DaFum/neurotoxic-game --skill state-safety-action-creator-guard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: state-safety-action-creator-guard
Source: https://github.com/DaFum/neurotoxic-game/tree/main/.agents/skills/state-safety-action-creator-guard
Command: npx skills add https://github.com/DaFum/neurotoxic-game --skill state-safety-action-creator-guard

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Review or refactor state updates to enforce invariants (money >= 0, harmony > 0) and prefer action creators/ActionTypes. Use when reviewing PRs for state safety or adjusting reducers/hooks.

Core Features & Use Cases

  • canonical action creators usage to replace raw dispatch calls.
  • reducer clamps for money and harmony invariants.
  • unit tests coverage for action creators and reducers.

Quick Start

Review your PRs to ensure all state updates go through action creators, verify clamps in reducers, and confirm tests cover negative-value scenarios.

Frequently Asked Questions about state-safety-action-creator-guard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce state invariants like money and harmony in Redux reducers?

To enforce state invariants in Redux reducers, implement clamps that prevent negative values and route updates through canonical action creators. This ensures predictable state transitions and guards against invalid data during event processing.

Why should I use action creators instead of raw dispatch calls for state updates?

Using action creators instead of raw dispatch calls enforces state safety by centralizing update logic. This pattern ensures canonical ActionTypes are used, making state transitions predictable and easier to unit test across your codebase.

How do I review a PR for state safety and predictable state transitions?

Review PRs for state safety by verifying all state updates go through action creators, checking that reducers implement clamps for invariants, and confirming unit tests cover negative-value scenarios to guarantee predictable state transitions.

What is a reducer clamp and when do I need it for state management?

A reducer clamp is a boundary check applied during state updates to enforce invariants like money >= 0. You need clamps in state management when processing events that could reduce values below valid thresholds.

Do I need unit tests for negative-state scenarios in action creators?

Yes, unit tests for negative-state scenarios are required. Tests should cover action creators and reducers to verify clamps are implemented correctly and invariants hold true when processing events that trigger negative values.

Can this state safety approach work with hooks or only traditional reducers?

This state safety approach applies to codebases using reducers and action dispatch patterns, including hooks. It adjusts reducers and hooks to enforce invariants and prefer action creators for predictable state transitions.