principle-model-the-domain
What it does
Gives the assistant a rule for modeling stateful logic with structures that match the domain. It is for engineers whose code is full of flags and nested conditions.
When to use it
- ✓When you are writing stateful logic with lifecycles or phases.
- ✓When code branches heavily or repeats the same shape assumptions across files.
- ✓When invalid states keep getting into the system.
Skill link
https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-model-the-domain/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Our order flow uses a mess of booleans to track its status. Model it properly so impossible states cannot happen.”
5 new skills a week. 1 minute to read.
How it works
The assistant identifies the real states and rules, then encodes them in a fitting structure such as a state machine, typed model or lookup table. This removes many branches and makes invalid states harder to write.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Model the Domain
Encode the real domain in a data structure instead of scattering it across conditionals. A structure that matches the domain makes invalid states unrepresentable and deletes branches. Choosing it at write time is cheap. Recovering it later reads as a refactor and gets deferred.
Reach for:
- A state machine instead of scattered booleans, phases, or lifecycle checks.
- A typed model instead of loose parameters or repeated shape assumptions.
- A map, registry, lookup table, or discriminated union instead of branching spread across files.
- A reducer or command/event model instead of ad hoc state mutations.
- A module organized around one body of domain knowledge instead of a sequence such as load, validate, transform, and save. Execution order is not ownership.
- A small module boundary that gathers repeated behavior, ownership, or invariants.
- A queue, cache, index, graph, tree, or normalized collection where the access pattern calls for it.
- Any other structure that fits. When none fits, work out what the code must never allow and how the data gets read, then find the structure that encodes exactly that.
Do not force an abstraction. Prefer boring code if the current shape is already clear, local, and unlikely to grow. Be skeptical of an abstraction that adds indirection without removing branches, duplicated rules, invalid states, or lifecycle risk.
The sign that you skipped this is a new feature that grows an existing if/else chain by one more branch, or a second boolean that must stay in sync with the first. Temporal decomposition is another sign. Phase-named modules repeat the same domain rules across steps.
FAQ
Does every problem need a new structure?
No. The skill says to prefer plain code when the current shape is clear and unlikely to grow.
What is a common example?
Replacing scattered booleans with a state machine that only allows valid transitions.
Why choose the structure early?
It is cheap at write time, while recovering the right structure later often gets deferred and costs more.
Details
Original description by the author
Apply when writing stateful logic, or when code branches a lot or repeats a shape assumption across files.
repo: cursor/plugins
Popularity
- GitHub stars
- 15k
- Ranking position
- #10982
- License
- —
- Updated
- 10/31/2026
Comments
- …
More skills from this repository
advisor
15kLets your agent consult a stronger second model at key checkpoints, such as before a big decision or when stuck on an error, if you turn it on.
check-agent-compatibility
15kRuns a full check of whether AI coding agents can start, verify and document a repository, and returns one compatibility score with the main issues.
cli-for-agents
15kTeaches your agent to design or review command-line tools so AI agents can run them without prompts, with clear help text and examples.
continual-learning
15kKeeps your AGENTS.md notes up to date by handing the work of reviewing past chats to a dedicated memory updater.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.