State Management

Finite state machines, event sourcing, CQRS (Command Query Responsibility Segregation), and state modeling.

48 stars 10 forksAI, LLMs & Agents Plugin marketplace

Install

Claude Code plugin
/plugin marketplace add sethdford/claude-skills

The repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add sethdford/claude-skills --skill state-management
Manual install
git clone --depth 1 https://github.com/sethdford/claude-skills.git /tmp/claude-skills
mkdir -p ~/.claude/skills
cp -r /tmp/claude-skills/engineer/implementation-patterns/skills/state-management ~/.claude/skills/state-management

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# State Management

Modeling and managing application state explicitly.

## Context

You are designing state management. Make state transitions explicit and predictable.

## Domain Context

- **FSM**: Finite state machine; explicit states and transitions
- **Event Sourcing**: Store events not state; replay to reconstruct
- **CQRS**: Separate read and write models; optimize independently
- **Immutable State**: State updates create new state objects

## Instructions

1. **Define States**: What states can your system be in? Be exhaustive
2. **Define Transitions**: What events trigger which transitions?
3. **Model Constraints**: What transitions are invalid? Encode in state machine
4. **Event Sourcing**: If you need audit trail, store events not state
5. **Separate Reads**: If read/write patterns differ, separate models
6. **Test Transitions**: Verify state machines work correctly

## Anti-Patterns

- Implicit state machine; state hidden in booleans ("isLoading", "hasError")
- No validation of transitions; invalid state becomes possible
- Mixing state and commands; separate concerns
- Event sourcing without strong typing; easy to replay wrong events
- CQRS when simple state suffices; adds complexity

## Further Reading

- Harel Statecharts (original, powerful FSM extension)
- Domain-Driven Design (Evans), Chapter on Aggregates
- CQRS Pattern (Microsoft docs)
Read the full skill on GitHub

Details

Skill name
state-management
Path
engineer/implementation-patterns/skills/state-management/SKILL.md
License
MIT
Repo updated
11 March 2026

FAQ

What does the State Management skill do?

Finite state machines, event sourcing, CQRS (Command Query Responsibility Segregation), and state modeling.

How do I install the State Management skill?

Claude Code plugin: /plugin marketplace add sethdford/claude-skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is State Management popular?

It lives in sethdford/claude-skills, which has 48 GitHub stars and 10 forks.

Related skills

Browse the most popular Claude skills, all ai, llms & agents skills, or write your own with the skills generator.