Model application states with AI
Find a data structure that expresses the real rules of your code and reduces repeated branches, synchronised flags and invalid combinations.
Model application states with AI when every new case grows another branch or several flags must stay in sync. principle-model-the-domain asks the agent to express the actual domain in a suitable data structure.
It is a coding principle rather than a fixed architecture. A state machine, typed model, registry or small module may help, depending on the rules and access pattern. The proposed structure should remove a real problem; clear local code can remain as it is.
What it does
- Find repeated domain assumptions
- Identify invalid state combinations
- Compare state models with scattered flags
- Choose structures suited to access patterns
- Gather related ownership into a coherent module
- Reject abstraction that adds no practical benefit
Install and use
- Install the skill in a compatible coding agent and provide the relevant code. No separate programme or account is required.
- Ask: “Identify the real states and rules in this branching code.” Explain the intended behaviour.
- Request the smallest suitable structure and ask which branches, duplicated rules or invalid states it removes.
- Review compatibility with existing callers and stored data before authorising implementation.
FAQ
Source
Made by Lauren Tan. Original skill: principle-model-the-domain, published on GitHub under the MIT licence.
View on GitHub