umlforge_state_machine
Design state machines for entity lifecycles: model states, events, and transitions, then spot missing states, invalid transitions, and race conditions.
Instructions
Design a state machine for a domain entity that has a lifecycle.
USE THIS WHEN:
An entity moves through states (Order: pending → active → cancelled)
You need to model a workflow, approval chain, or subscription lifecycle
You want to find missing states, invalid transitions, or race conditions
NOT FOR:
Flows between services (requests, responses) → use umlforge_api_sequence
Async event messaging between services → use umlforge_event_driven
Full codebase analysis → use umlforge_reverse_engineer
Produces:
stateDiagram-v2: all states, entry/exit actions, guard conditions, composite states, explicit ERROR and TERMINAL states
State transition table: current state → event → guard → next state → action
Implementation notes: DB write requirements, domain events, race condition guards
(report_mode=True) Analysis Notes: transition risks, unreachable states, quick wins
Args: entity: The domain entity (e.g. "Order", "Subscription", "JobApplication"). states: Known lifecycle states (e.g. "pending, active, suspended, cancelled"). events: Triggers that cause transitions (e.g. "payment_received, user_cancels"). business_rules: Constraints on transitions (optional). report_mode: True → also produce State Machine Analysis Notes. Pro/Team/Enterprise only. Omit to use your saved account preference (dashboard toggle); False forces diagrams only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entity | Yes | ||
| events | Yes | ||
| states | Yes | ||
| report_mode | No | ||
| business_rules | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |