Logo de State Modeling

State Modeling

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

Visão geral

Publicado porjdm4pku
RepositórioRE-Skills
Nome da habilidadestate-modeling
Estrelas
27
Forks
1
Arquivos incluídos
2
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    As habilidades de IA são escritas em Markdown simples, não em código específico de um provedor. Por isso, funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • Arquivos incluídos: 2

    Scripts, templates e referências que o modelo pode ler enquanto trabalha. Os arquivos são somente para leitura e nunca são executados.

  • Código aberto

    Publicada por jdm4pku no GitHub. Leia os arquivos da habilidade antes de instalá-la.

Instalação

Instale a habilidade de IA State Modeling no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL abaixo, que aponta para a pasta da habilidade, e confirme.
    https://github.com/jdm4pku/RE-Skills/tree/main/skills/state-modeling
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Adicionar habilidade → Via URL do GitHub. Depois, cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

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
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative State Modeling em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega State Modeling automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, State Modeling não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

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

Arquivos incluídos

O modelo lê esses arquivos sob demanda enquanto a habilidade está carregada. Eles são disponibilizados para leitura e nunca são executados.

Perguntas frequentes

O que a habilidade de IA State Modeling faz?

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.

Por que usar State Modeling no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. A habilidade State Modeling é escrita em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. No TypingMind, você usa suas próprias chaves de API e paga diretamente aos provedores, em vez de pagar uma assinatura por licença de usuário. Suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar State Modeling no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/jdm4pku/RE-Skills/tree/main/skills/state-modeling. O TypingMind lê o arquivo SKILL.md, reúne os arquivos da habilidade e a instala para que possa ser ativada em cada chat.

Quais modelos de IA podem usar State Modeling?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com State Modeling?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar State Modeling com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA State Modeling é gratuita?

A habilidade é publicada no GitHub por jdm4pku. Consulte os termos de licenciamento no repositório. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, templates ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas que ele pode acionar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA dá ao modelo o conhecimento e as orientações de que ele precisa: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver lista completa

Crie seu próprio espaço de trabalho com IA agora

Inscreva-se na nossa newsletter para receber avisos sobre novos recursos e futuros sorteios 👇