# state-management

state-management is a Claude Code skill that models application state before library selection. It reviews and refactors models, keeps source state minimal, computes derived values, and makes invalid states hard to represent.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 181 installs · ★ 50 repo stars
- Author: statelyai
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/statelyai/skills/tree/HEAD/skills/state-management/SKILL.md
- Updated: 2026-05-22
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/statelyai-state-management

## What it does

The skill treats state modeling as the first step — before any library choice — then maps the result to Redux, Zustand, Pinia, TanStack Query, or plain local component state.

The process is structured: inventory every state value, classify it (source, derived, finite, server cache, URL, history, ephemeral mutable ref), remove duplication, define invariants, collapse boolean sets into a single finite status field, list domain events, and sketch transitions. Four modes are available: Design a new model from requirements, Review existing code for bugs and invalid states, Refactor while preserving behavior, or Library mapping once the model is sound.

The skill activates whenever Redux, Zustand, Pinia, `useEffect`, forms, wizards, boolean flags, duplicated state, or tangled UI logic come up — no explicit request for a “state model” needed. Several booleans describing one status get replaced with a single field because that structure rules out invalid combinations; `package.json` and local imports are read first to understand what is already in the project.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add statelyai/skills --skill state-management -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/state-management/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/state-management/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add statelyai/skills --skill state-management -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/state-management/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add statelyai/skills --skill state-management -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/state-management/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install statelyai/skills skills/state-management
```

2. **Manually: put the files in place**
- File: `.github/skills/state-management/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add statelyai/skills --skill state-management -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/statelyai/skills --path skills/state-management
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/state-management/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add statelyai/skills --skill state-management -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/statelyai/skills/tree/HEAD/skills/state-management/SKILL.md

## When to use it
- replace a set of boolean flags with a single finite-state status field
- eliminate duplicated state and move derived values to computed expressions
- identify invalid state combinations that are currently representable in code
- untangle `useEffect` chains that synchronize state instead of reacting to transitions
- decide the right home for each value: component, store, URL, or server cache

## Example prompts
- Review this component's state for duplication or invalid combinations
- Refactor this reducer — remove the boolean flags and introduce a single `status` field
- Decide what belongs in URL params versus TanStack Query for this filter and pagination state

## Similar
- [frontend-state-management](https://affpapa.org/en/nevibecode/skills/frontend-state-management.md) — skill · 487 installs
- [zustand-state-management](https://affpapa.org/en/nevibecode/skills/zustand-state-management.md) — skill · 1000 installs
- [React State Management taste](https://affpapa.org/en/nevibecode/prompts/react-state-management-taste.md) — prompt · ★ 178201 repo stars
- [react-state-management](https://affpapa.org/en/nevibecode/skills/react-state-management.md) — skill · 15286 installs
- [zustand-state-builder](https://affpapa.org/en/nevibecode/skills/zustand-state-builder.md) — skill · 264 installs
- [zustand-state](https://affpapa.org/en/nevibecode/skills/zustand-state.md) — skill · 261 installs

## Other versions with the same name
- [state-management · asyrafhussin](https://affpapa.org/en/nevibecode/skills/state-management.md) — 849 installs
- [state-management · patternsdev](https://affpapa.org/en/nevibecode/skills/patternsdev-state-management.md) — 201 installs
- [state-management · akillness](https://affpapa.org/en/nevibecode/skills/akillness-state-management.md) — 367 installs

From the same set: [statelyai/skills](https://affpapa.org/en/nevibecode/by/statelyai/skills.md) — 2 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
