principle-model-the-domain

Encodes domain logic in data structures instead of scattered conditionals.

1|Updated Aug 27, 2025
One-click install
npx skills add https://github.com/IgorGanapolsky/Random-Timer --skill principle-model-the-domain-igorganapolsky
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: principle-model-the-domain
Source: https://github.com/IgorGanapolsky/Random-Timer/tree/main/.cursor/skills/principle-model-the-domain
Command: npx skills add https://github.com/IgorGanapolsky/Random-Timer --skill principle-model-the-domain-igorganapolsky

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Stateful code often accumulates scattered booleans, repeated shape assumptions, and branching spread across files, creating accidental complexity that makes invalid states possible and refactors expensive. This Skill guides you to encode the real domain in a structure at write time, deleting branches and making invalid states unrepresentable. ## Core Features & Use Cases - Structure Selection Guidance: Recommends concrete structures such as state machines, typed models, lookup tables, discriminated unions, reducers, and command/event models matched to the problem shape. - Anti-Pattern Detection: Identifies warning signs like growing if/else chains, booleans that must stay in sync, and phase-named modules that repeat domain rules across steps. - Restraint Against Over-Abstraction: Advises preferring boring code 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 by one more branch, apply this Skill to replace the branching with a state machine or registry that encodes the domain directly. ## Quick Start Apply the model-the-domain principle to refactor this module's scattered conditionals into a structure that encodes the domain.

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 conditionals with a state machine?▼

Identify the lifecycle checks and booleans spread across files, then define explicit states and transitions in one structure. This makes invalid states unrepresentable and deletes the branches that previously enforced them.

When should I use a typed model instead of loose parameters?▼

Use a typed model when the same shape assumption repeats across files or functions. A single typed object encodes the domain once, so changes propagate through the type system instead of requiring edits in every location.

What are signs that code needs domain modeling?▼

Key signs include a new feature growing an if/else chain by one branch, a second boolean that must stay in sync with the first, and phase-named modules that repeat the same domain rules across sequential steps.

When should I avoid adding an abstraction?▼

Avoid abstraction when the current code 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.

What is temporal decomposition in code organization?▼

Temporal decomposition organizes modules by execution order such as load, validate, transform, and save. This repeats domain rules across steps; instead, organize modules around one body of domain knowledge since execution order is not ownership.