Model Entity States
Purpose
Make an entity's lifecycle explicit and complete, so that every status, allowed move, rule and side effect is agreed once and can be built and tested consistently across screens, APIs, batch jobs and reports.
When to use
- An entity has a status field that controls what users or systems can do.
- Teams disagree on what "Approved" or "Closed" means, or status rules live in several documents.
- A workflow, API or event design, or state transition testing, is about to start.
When not to use
- You need the step-by-step business process across roles. Use
bpmn-model or as-is-process.
- You need message order between systems for one scenario. Use
sequence-flow.
- You only need a rendered diagram from an agreed model. Use
diagram-as-code.
Inputs
Required:
- The entity and any description of its lifecycle (requirements, process notes, existing status list).
Optional, improves quality:
- Current status values from the database or screens, business rules, roles and permissions.
- Integrations or reports that read the status, SLA timers, regulatory retention rules.
If the entity or any lifecycle description is missing, ask for it. Do not ask more; record unknown rules as open questions.
Process
- List candidate states from the input. Merge synonyms, split states that hide two meanings (e.g. "Pending" for both awaiting customer and awaiting approver), and name each state as a condition ("Under Review"), not an action.
- Mark the initial state, the final states (terminal) and any states that are only reachable by administrators or batch processes.
- For every state, ask which events move the entity out: user action, system event, timer or external message. Record each as a transition: from, event, guard condition, to, action or side effect, allowed actor.
- Build the full state-by-event matrix and classify each empty cell as Not allowed (reject with error), Ignored (no-op) or
[TBD]; do not leave cells unconsidered.
- Check lifecycle completeness: cancel or withdraw, reopen, expiry and time-outs, rollback on downstream failure, correction after final state, and archival or deletion under retention rules.
- Check concurrency: two actors triggering conflicting transitions at once, duplicated events, out-of-order external messages. State the expected rule (first wins, optimistic lock, idempotent event).
- List side effects per transition: notifications, integration messages, audit entries, SLA timer start/stop. Flag personal data in notifications for minimization.
- Label every rule not stated in the input
[ASSUMPTION] and move it to open questions with a likely owner.
- Produce diagram code (Mermaid stateDiagram-v2 or PlantUML) consistent with the table; every transition appears in both.
- If the user wants to continue, suggest
state-transition-testing to derive tests, business-rules-catalog for guard rules or error-scenario-catalog for rejected transitions.
Output format
# State Model: <entity>
Initial: <state> · Final: <states> · Source: <documents>
## States
| State | Meaning (condition) | Entry via | Final? | Visible to |
|---|---|---|---|---|
## Transitions
| # | From | Event / trigger | Guard | To | Action / side effect | Actor |
|---|---|---|---|---|---|---|
## Not Allowed / Ignored Events
| State | Event | Handling (Reject + message / Ignore / TBD) |
|---|---|---|
## Concurrency and Timing Rules
- ...
## Diagram
<Mermaid stateDiagram-v2 or PlantUML code>
## Assumptions and Open Questions
- [ASSUMPTION] ... — owner
Quality checklist
Common pitfalls
- Using actions as states ("Approve", "Send"). States describe a condition that persists until an event occurs.
- Mixing several dimensions in one status (payment status and review status). Model them as separate state machines or orthogonal regions.
- Forgetting non-human triggers such as timers, batch jobs and inbound messages, which cause most production surprises.
Example
Input: "A claim is submitted, reviewed by an adjuster, approved or rejected, then paid. Customers can cancel before a decision."
Excerpt of output:
| # |
From |
Event |
Guard |
To |
Action |
Actor |
| T1 |
Submitted |
Assign adjuster |
Documents complete |
Under Review |
Start SLA timer |
Team lead |
| T2 |
Under Review |
Approve |
Amount ≤ adjuster limit [ASSUMPTION] |
Approved |
Create payment order |
Adjuster |
| T3 |
Submitted, Under Review |
Cancel |
No decision yet |
Cancelled (final) |
Notify customer |
Customer |
Not allowed: Cancel in Approved → reject with "Claim already decided". Open question: can a Rejected claim be reopened after an appeal, and by whom?
1---2name: state-model3description: "Models the lifecycle of a business entity (order, application, claim, contract, ticket): states, transitions, triggering events, guard conditions, actions, who may trigger each transition, and invalid transitions, delivered as a transition table plus diagram code. Use when an entity has statuses that drive behaviour, when status rules are scattered or disputed, or before designing workflows, APIs or state transition tests."4license: MIT5metadata:6 source: https://skillmd.com/skills/muratdincer/state-model7 version: "1.0.0"8 language: en9 category: 01-business-analysis10 role: system-analyst11 area: specification12 title: "Model entity states"13 related: "business-rules-catalog, state-transition-testing, sequence-flow, error-scenario-catalog, diagram-as-code"14 prompt: "Model the states of an insurance claim from submission to payment or rejection, including reopen and cancel."15---1617# Model Entity States1819## Purpose20Make an entity's lifecycle explicit and complete, so that every status, allowed move, rule and side effect is agreed once and can be built and tested consistently across screens, APIs, batch jobs and reports.2122## When to use23- An entity has a status field that controls what users or systems can do.24- Teams disagree on what "Approved" or "Closed" means, or status rules live in several documents.25- A workflow, API or event design, or state transition testing, is about to start.2627## When not to use28- You need the step-by-step business process across roles. Use `bpmn-model` or `as-is-process`.29- You need message order between systems for one scenario. Use `sequence-flow`.30- You only need a rendered diagram from an agreed model. Use `diagram-as-code`.3132## Inputs33Required:34- The entity and any description of its lifecycle (requirements, process notes, existing status list).3536Optional, improves quality:37- Current status values from the database or screens, business rules, roles and permissions.38- Integrations or reports that read the status, SLA timers, regulatory retention rules.3940If the entity or any lifecycle description is missing, ask for it. Do not ask more; record unknown rules as open questions.4142## Process431. List candidate states from the input. Merge synonyms, split states that hide two meanings (e.g. "Pending" for both awaiting customer and awaiting approver), and name each state as a condition ("Under Review"), not an action.442. Mark the initial state, the final states (terminal) and any states that are only reachable by administrators or batch processes.453. For every state, ask which events move the entity out: user action, system event, timer or external message. Record each as a transition: from, event, guard condition, to, action or side effect, allowed actor.464. Build the full state-by-event matrix and classify each empty cell as Not allowed (reject with error), Ignored (no-op) or `[TBD]`; do not leave cells unconsidered.475. Check lifecycle completeness: cancel or withdraw, reopen, expiry and time-outs, rollback on downstream failure, correction after final state, and archival or deletion under retention rules.486. Check concurrency: two actors triggering conflicting transitions at once, duplicated events, out-of-order external messages. State the expected rule (first wins, optimistic lock, idempotent event).497. List side effects per transition: notifications, integration messages, audit entries, SLA timer start/stop. Flag personal data in notifications for minimization.508. Label every rule not stated in the input `[ASSUMPTION]` and move it to open questions with a likely owner.519. Produce diagram code (Mermaid stateDiagram-v2 or PlantUML) consistent with the table; every transition appears in both.5210. If the user wants to continue, suggest `state-transition-testing` to derive tests, `business-rules-catalog` for guard rules or `error-scenario-catalog` for rejected transitions.5354## Output format55```markdown56# State Model: <entity>57Initial: <state> · Final: <states> · Source: <documents>5859## States60| State | Meaning (condition) | Entry via | Final? | Visible to |61|---|---|---|---|---|6263## Transitions64| # | From | Event / trigger | Guard | To | Action / side effect | Actor |65|---|---|---|---|---|---|---|6667## Not Allowed / Ignored Events68| State | Event | Handling (Reject + message / Ignore / TBD) |69|---|---|---|7071## Concurrency and Timing Rules72- ...7374## Diagram75<Mermaid stateDiagram-v2 or PlantUML code>7677## Assumptions and Open Questions78- [ASSUMPTION] ... — owner79```8081## Quality checklist82- [ ] Every state is reachable from the initial state and every non-final state has at least one exit.83- [ ] Every transition has an event, and guards are written as testable conditions.84- [ ] Each state-event combination is covered: allowed, not allowed or `[TBD]`.85- [ ] Cancel, reopen, expiry and failure paths were considered explicitly.86- [ ] Table and diagram match exactly.87- [ ] Inferred rules are labeled `[ASSUMPTION]` and listed as open questions.88- [ ] All checks pass; if any fails, revise the output and re-run this checklist before answering.8990## Common pitfalls91- Using actions as states ("Approve", "Send"). States describe a condition that persists until an event occurs.92- Mixing several dimensions in one status (payment status and review status). Model them as separate state machines or orthogonal regions.93- Forgetting non-human triggers such as timers, batch jobs and inbound messages, which cause most production surprises.9495## Example96Input: "A claim is submitted, reviewed by an adjuster, approved or rejected, then paid. Customers can cancel before a decision."9798Excerpt of output:99| # | From | Event | Guard | To | Action | Actor |100|---|---|---|---|---|---|---|101| T1 | Submitted | Assign adjuster | Documents complete | Under Review | Start SLA timer | Team lead |102| T2 | Under Review | Approve | Amount ≤ adjuster limit `[ASSUMPTION]` | Approved | Create payment order | Adjuster |103| T3 | Submitted, Under Review | Cancel | No decision yet | Cancelled (final) | Notify customer | Customer |104105Not allowed: Cancel in Approved → reject with "Claim already decided". Open question: can a Rejected claim be reopened after an appeal, and by whom?