Logo vun State Modeling

State Modeling

Communautéit
jdm4pku
state-modeling

Create state-transition diagrams and state tables to model object lifecycle behavior. Use when requirements involve objects that change state based on events and where valid transitions must be constrained.

Iwwersiicht

Editeurjdm4pku
RepositoryRE-Skills
Skill-Nummstate-modeling
Stären
27
Forks
1
Matgeliwwert Fichieren
2
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 2 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum jdm4pku op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill State Modeling an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/jdm4pku/RE-Skills/tree/main/skills/state-modeling
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jdm4pku/RE-Skills.git /tmp/RE-Skills
mkdir -p .claude/skills
cp -r /tmp/RE-Skills/skills/state-modeling .claude/skills/state-modeling
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert State Modeling an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet State Modeling automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass State Modeling net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Purpose

Model the lifecycle of domain objects using state-transition diagrams (STDs) and state tables. Use this when objects move through defined states in response to events, and where invalid transitions must be prevented. State modeling systematically exposes missing requirements.

This is not a process flow -- it models the states of a single object over its lifetime, not the steps a user takes.

Key Concepts

State-Transition Diagram Elements

ElementRepresentationMeaning
StateRounded rectangleA condition the object can be in
TransitionArrow between statesMovement from one state to another
Event/TriggerLabel on arrowWhat causes the transition
Guard[condition] on arrowCondition that must be true for the transition
Action/action on arrowWhat happens during the transition
Initial StateFilled circleWhere the object starts
Final StateBullseye circleWhere the object terminates

State Table (Complement to STD)

A state table is a matrix that systematically covers every state-event combination:

State \ EventEvent AEvent BEvent C
State 1-> State 2 / action-- (impossible)-> State 3 / action
State 2error-> State 3 / action-> State 1 / action
State 3-> State 1 / actionerror-- (no change)

Cell values:

  • -> State X / action -- Valid transition with action
  • -- (impossible) -- This event cannot occur in this state (by design)
  • error -- This event should not occur; system must handle as error
  • -- (no change) -- Event occurs but object stays in current state

The power of the state table: Every empty cell is a potential missing requirement. Fill in every cell.

When to Use State Modeling

State modeling is valuable when:

  • An object has 3+ distinct states
  • Transitions between states are governed by business rules
  • Invalid transitions must be prevented (not just ignored)
  • The lifecycle involves multiple actors triggering transitions
  • Regulatory compliance requires tracking state history

Anti-Patterns

  • Missing States -- Not modeling terminal states (Deleted, Expired, Archived)
  • Missing Transitions -- Only modeling the happy path; ignoring error and rollback transitions
  • Conflating State and Status -- A "status" field in the UI is not the same as a state model. The model should capture all possible values, transitions, and rules.

Application

Step 1: Identify the Object

Pick a domain object whose lifecycle involves multiple states:

  • Order, Ticket, Account, Chemical, Prescription, Request, Document, etc.

Step 2: List All States

Enumerate every possible state the object can be in. Include:

  • Initial state (how the object enters the system)
  • Normal states (the expected lifecycle)
  • Exception states (error, suspended, on-hold)
  • Terminal states (completed, deleted, expired, archived)

Step 3: List All Events

Enumerate every event that can affect the object's state:

  • User actions (submit, approve, reject, cancel)
  • System events (timer expires, threshold reached)
  • External events (payment received, API response)

Step 4: Build the State Table

Create the matrix with states as rows and events as columns. For each cell:

  1. Can this event occur in this state?
  2. If yes, what state does the object transition to?
  3. What action is performed during the transition?
  4. What guard conditions apply?

Fill in EVERY cell. Empty cells are bugs waiting to happen.

Step 5: Draw the State-Transition Diagram

Convert the state table into a visual diagram:

  • Draw states as rounded rectangles
  • Draw transitions as arrows labeled: event [guard] / action
  • Mark initial and terminal states
  • Verify the diagram matches the table

Step 6: Derive Requirements

For each transition:

When [event] occurs and [object] is in [state],
the system shall [action] and set [object] state to [new state].

For each error cell:

If [event] occurs while [object] is in [state],
the system shall reject the action and display "[error message]."

Step 7: Validate

  • Every state has at least one incoming and one outgoing transition (except initial and terminal)
  • Every event is handled in every state (no empty cells in state table)
  • Terminal states have no outgoing transitions
  • All guard conditions are defined precisely
  • State history tracking requirements are specified (if needed for audit)

Examples

See examples/sample.md for complete state models.

Mini example:

markdown
## Chemical Record States

States: Active, Expiring Soon, Expired, Disposed

| State \ Event | 30-day alert triggered | Expiration date passed | Technician disposes | Technician renews |
|--------------|----------------------|----------------------|--------------------|--------------------|
| Active | -> Expiring Soon / send alert | -> Expired / block usage | -> Disposed / log disposal | error (not near expiry) |
| Expiring Soon | -- (already alerted) | -> Expired / block usage | -> Disposed / log disposal | -> Active / update date |
| Expired | -- (past expiry) | -- (already expired) | -> Disposed / log disposal | error (must dispose first) |
| Disposed | error | error | error (already disposed) | error |

Common Pitfalls

Pitfall 1: Empty Cells in State Table

Symptom: Several state-event combinations are left blank during analysis.

Consequence: When these combinations occur in production, the system behaves unpredictably.

Fix: Fill in every cell. If the combination should not occur, mark it "error" and specify the error handling.


Pitfall 2: No Terminal States

Symptom: State model shows active states but never defines how the object's lifecycle ends.

Consequence: Objects accumulate in the system forever with no cleanup or archival.

Fix: Add terminal states (Deleted, Archived, Expired, Completed) and define what triggers them and what cleanup occurs.


Pitfall 3: Modeling Process Flow Instead of Object State

Symptom: The diagram shows user steps (login, search, select, submit) instead of object states.

Consequence: This is an activity diagram, not a state model. It does not capture object lifecycle requirements.

Fix: Focus on what the object becomes, not what the user does. "Order: Pending -> Approved -> Shipped" (object states), not "Submit -> Review -> Ship" (user actions).

References

Related Skills

  • skills/use-case/SKILL.md -- Use cases reference state transitions in alternative and exception flows
  • skills/srs-document/SKILL.md -- State models appear in SRS Appendix B (Analysis Models)
  • skills/data-dictionary/SKILL.md -- State enumerations are defined in the data dictionary
  • skills/business-rule/SKILL.md -- Business rules often govern state transitions

External Frameworks

  • David Harel, "Statecharts" (1987) -- Hierarchical state machines
  • Karl Wiegers & Joy Beatty, Software Requirements, Third Edition (2013) -- Chapter 12: A Picture Is Worth 1024 Words

Skill type: Component Dependencies: References skills/data-dictionary/SKILL.md, skills/business-rule/SKILL.md Used by: skills/requirements-analysis-process/SKILL.md, skills/srs-document/SKILL.md

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill State Modeling?

Create state-transition diagrams and state tables to model object lifecycle behavior. Use when requirements involve objects that change state based on events and where valid transitions must be constrained.

Firwat State Modeling op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. State Modeling besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech State Modeling an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/jdm4pku/RE-Skills/tree/main/skills/state-modeling an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen State Modeling benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat State Modeling benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir State Modeling domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill State Modeling gratis?

De Skill gëtt vum jdm4pku op GitHub publizéiert. Kuckt am Repository no de Lizenzbedéngungen. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇