Tooluck logoTooluck
SKILL.md

principle-model-the-domain

Agent skill frombacknotprop/pstack

Apply when writing stateful logic, or when code branches a lot or repeats a shape assumption across files.

How to install principle-model-the-domain

install principle-model-the-domain
# install the pstack pack with the skills CLI
npx skills add backnotprop/pstack

# or add only this skill to Claude Code: copy the folder

skills/principle-model-the-domain/

# into

~/.claude/skills/principle-model-the-domain/ (all projects)

.claude/skills/principle-model-the-domain/ (one project)

skills/principle-model-the-domain/SKILL.md

MITFull file
1# Model the Domain
2
3Encode 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.
4
5Reach for:
6
7- A state machine instead of scattered booleans, phases, or lifecycle checks.
8- A typed model instead of loose parameters or repeated shape assumptions.
9- A map, registry, lookup table, or discriminated union instead of branching spread across files.
10- A reducer or command/event model instead of ad hoc state mutations.
11- 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.
12- A small module boundary that gathers repeated behavior, ownership, or invariants.
13- A queue, cache, index, graph, tree, or normalized collection where the access pattern calls for it.
14- 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.
15
16Do 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.
17…

Excerpt shown under the repository's MIT license.

More skills in pstack

Keep exploring

Similar skill repositories

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates