principle-model-the-domain

Encodes domain logic into data structures instead of scattered conditionals across codebases.

Updated Sep 2, 2026
One-click install
npx skills add https://github.com/jnyross/pstack-muse --skill principle-model-the-domain-jnyross
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: principle-model-the-domain
Source: https://github.com/jnyross/pstack-muse/tree/main/skills/principle-model-the-domain
Command: npx skills add https://github.com/jnyross/pstack-muse --skill principle-model-the-domain-jnyross

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 and invalid states that are hard to maintain. ## Core Features & Use Cases - Domain Structure Selection: Guides choosing state machines, typed models, lookup tables, discriminated unions, reducers, or command/event models to replace scattered conditionals. - Anti-Pattern Detection: Identifies tells like 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 extends an existing if/else chain or introduces a second boolean tied to a first, apply this principle to encode the domain in a structure that makes invalid states unrepresentable. ## Quick Start Ask the AI to apply the model-the-domain principle when reviewing or writing stateful logic that branches heavily or repeats shape assumptions across files.

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 domain model?

Identify what the code must never allow and how the data gets read, then choose a structure that encodes exactly that. Common options include state machines for lifecycle checks, discriminated unions for branching, and typed models for repeated shape assumptions.

When should I use a state machine instead of booleans?

Use a state machine when multiple booleans must stay in sync or when lifecycle and phase checks are scattered across files. A state machine makes invalid state combinations unrepresentable and deletes the synchronization branches.

When should I avoid adding a domain abstraction?

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

What are the signs that code needs domain modeling?

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

How do I organize modules around domain knowledge?

Organize modules around one body of domain knowledge rather than execution sequences like load, validate, transform, and save. Execution order is not ownership, and temporal decomposition causes domain rules to be repeated across steps.