State Modeling logo

State Modeling

Community
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.

Overview

Publisherjdm4pku
RepositoryRE-Skills
Skill namestate-modeling
Stars
27
Forks
1
Bundled files
2
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by jdm4pku on GitHub. Read the source before you install it.

Installation

Install the State Modeling AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/jdm4pku/RE-Skills/tree/main/skills/state-modeling
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable State Modeling in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads State Modeling on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so State Modeling is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the State Modeling AI skill do?

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.

Why use State Modeling on TypingMind?

Because you install it once and use it with any model. State Modeling is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install State Modeling in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/jdm4pku/RE-Skills/tree/main/skills/state-modeling. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use State Modeling?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with State Modeling?

As many as you like. As long as a model supports skills, you can use State Modeling with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the State Modeling AI skill free?

It is published on GitHub by jdm4pku. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇