principle-model-the-domain

Encodes domain rules in data structures instead of scattered conditionals.

1|Updated Aug 26, 2026
One-click install
npx skills add https://github.com/edivad1999/stuc-stack --skill principle-model-the-domain-edivad1999
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: principle-model-the-domain
Source: https://github.com/edivad1999/stuc-stack/tree/main/skills/principle-model-the-domain
Command: npx skills add https://github.com/edivad1999/stuc-stack --skill principle-model-the-domain-edivad1999

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Stateful logic often grows into scattered booleans, repeated shape assumptions, and branching spread across files, creating accidental complexity and invalid states that are hard to maintain. ## Core Features & Use Cases - Domain Structure Selection: Guides the choice of state machines, typed models, lookup tables, discriminated unions, reducers, and command/event models to replace ad hoc conditionals. - Anti-Pattern Detection: Identifies tells such as growing if/else chains, booleans that must stay in sync, and phase-named modules that repeat domain rules. - Restraint Guidance: Advises against forcing abstractions when the current shape is already clear, local, and unlikely to grow. - Use Case: When adding a feature that would extend an existing if/else chain or introduce a second boolean tied to a first, apply this principle to model the domain as a state machine or discriminated union so invalid states become unrepresentable. ## Quick Start Apply the model-the-domain principle to refactor this stateful logic into a structure that makes invalid states unrepresentable.

Frequently Asked Questions about principle-model-the-domain

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I replace scattered booleans with a state machine?▼

Identify the lifecycle phases the booleans represent and encode them as explicit states in a state machine. This makes invalid state combinations unrepresentable and deletes the branches that kept the booleans in sync.

When should I model the domain instead of adding another conditional?▼

Model the domain when a new feature grows an existing if/else chain, when a second boolean must stay in sync with a first, or when shape assumptions repeat across files. These are tells that the domain is scattered rather than encoded.

What structures can replace branching spread across files?▼

Use a map, registry, lookup table, or discriminated union to gather branching into one structure. A reducer or command/event model works for ad hoc state mutations, and a module organized around one body of domain knowledge replaces phase-based decomposition.

When should I avoid adding a domain abstraction?▼

Avoid the abstraction when the current shape is already clear, local, and unlikely to grow. Be skeptical of any structure that adds indirection without removing branches, duplicated rules, invalid states, or lifecycle risk.

Why is temporal decomposition a code smell?▼

Phase-named modules organized around load, validate, transform, and save repeat the same domain rules across steps. Execution order is not ownership, so modules should be organized around one body of domain knowledge instead.