State Modelingのロゴ

State Modeling

コミュニティ
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.

概要

公開者jdm4pku
リポジトリRE-Skills
スキル名state-modeling
スター
27
フォーク
1
同梱ファイル
2
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 2個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    jdm4pkuがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「State Modeling」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/jdm4pku/RE-Skills/tree/main/skills/state-modeling
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

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
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでState Modelingを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にState Modelingを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、State Modelingは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

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

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「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.

TypingMindでState Modelingを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。State Modelingはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにState Modelingをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/jdm4pku/RE-Skills/tree/main/skills/state-modelingを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

State Modelingを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

State Modelingで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもState Modelingを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「State Modeling」は無料ですか?

jdm4pkuがGitHubで公開しています。ライセンス条件はリポジトリでご確認ください。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇