360 Secure SkillHub
360 安全技能中心

principle-model-the-domain

一项面向编码的领域建模原则:建议用状态机、类型模型、映射或注册表、reducer、规范化集合承载领域规则,以减少分散的条件分支和非法状态;同时强调不要为清晰、局部的代码强行抽象。该 Skill 仅提供原则说明,无代码示例或工具依赖。

分类:开发
michael-denyer
热度 0.00
最近更新 2026-11-25 17:33:01

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add michael-denyer/pstack-claude/principle-model-the-domain
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
principle-model-the-domain
description
Apply when writing stateful logic, or when code branches a lot or repeats a shape assumption across files.
user-invocable
false

Model the Domain

Encode the domain in a data structure instead of scattering it across conditionals. The right structure makes invalid states unrepresentable and deletes branches.

Reach for a state machine instead of scattered booleans or phase checks, a typed model instead of loose parameters, a map, registry, or discriminated union instead of branching spread across files, a reducer instead of ad hoc mutations, and an index, queue, or normalized collection where the access pattern calls for it.

Do not force it. Keep boring code when the shape is clear, local, and unlikely to grow, and distrust an abstraction that adds indirection without removing branches or invalid states.

The sign that you skipped this: a feature that grows an if/else chain by one more branch, or a second boolean that must stay in sync with the first.