- Create new
commands/folder into your.claude - Create new file
.claude/commands/state-machine.mdwith the content in state-machine.md file
/state-machine all backend componentscommands/ folder into your .claude.claude/commands/state-machine.md with the content in state-machine.md file/state-machine all backend componentsGenerate state machine diagrams. E.g: "all backend components"
Ask the user what diagram format they prefer:
Use their choice for all diagrams below.
Create state machine diagrams that include input/output schema contracts and dataflow transactions for the specified components.
stateDiagram-v2 showing all states, transitions, and substatesuseState, useReducer, enums, status fields, _running flagsif status == X then Y)STATE-MACHINES.md at the repository root (append if file exists, or create new)CLAUDE.md. If yes, include an instruction that STATE-MACHINES.md must be updated whenever stateful logic changes (new states, transitions, schema contracts, or dataflow modifications)Use this structure per component:
## N. Component Name
Description of what this component does.
```mermaid
stateDiagram-v2
[*] --> state1 : trigger\n{ input schema summary }
state1 --> state2 : trigger\naction taken
```
### Transition Table
| Transition | Trigger | Input Schema | Side Effects | Output Schema |
| -------------- | ----------- | ----------------- | ------------ | ----------------- |
| `[*] → state1` | description | `{ field: type }` | What happens | `{ field: type }` |
### Dataflow
```
Input: { ... }
│
▼
Transform description
│
▼
Output: { ... }
```[*] has a path to a terminal state or loops/state-machines all backend orchestrator workers
/state-machines the React Dashboard and Assets pages
/state-machines subscription billing pipeline
/state-machines all components with database status fields