Pular para o conteúdo
Skillpedia
Código em geral15 mil · #10982

principle-model-the-domain

O que ela faz

Dá ao assistente uma regra para modelar lógica com estado usando estruturas que correspondem ao domínio. É para engenheiros cujo código está cheio de flags e condições aninhadas.

Quando usar

  • ✓Quando você escreve lógica com estado, com ciclos de vida ou fases.
  • ✓Quando o código tem muitas ramificações ou repete as mesmas suposições de formato em vários arquivos.
  • ✓Quando estados inválidos continuam entrando no sistema.

Link da skill

https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-model-the-domain/SKILL.md

Copie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.

Como usar

O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.

Mensagem pronta para colar

Use esta skill para me ajudar: https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-model-the-domain/SKILL.md Leia o arquivo SKILL.md desse link e siga as instruções dele na minha tarefa.
Quer que a sua IA encontre skills como esta sozinha?Instale o MCP grátis do Skillpedia: uma linha, e ela pesquisa entre 15.000+ skills antes de cada tarefa.Instalar em 1 minuto →

Exemplo do que pedir para a IA

“Nosso fluxo de pedidos usa uma bagunça de booleanos para acompanhar o status. Modele isso direito para que estados impossíveis não possam acontecer.”

5 skills novas por semana. 1 minuto de leitura.

Como funciona

O assistente identifica os estados e regras reais e os codifica em uma estrutura adequada, como uma máquina de estados, um modelo tipado ou uma tabela de consulta. Isso elimina muitas ramificações e dificulta escrever estados inválidos.

Conteúdo técnico (SKILL.md original)

Texto original do autor, em inglês, direto do GitHub.

Model the Domain

Encode 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.

Reach for:

  • A state machine instead of scattered booleans, phases, or lifecycle checks.
  • A typed model instead of loose parameters or repeated shape assumptions.
  • A map, registry, lookup table, or discriminated union instead of branching spread across files.
  • A reducer or command/event model instead of ad hoc state mutations.
  • 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.
  • A small module boundary that gathers repeated behavior, ownership, or invariants.
  • A queue, cache, index, graph, tree, or normalized collection where the access pattern calls for it.
  • 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.

Do 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.

The sign that you skipped this is a new feature that grows an existing if/else chain by one more branch, or a second boolean that must stay in sync with the first. Temporal decomposition is another sign. Phase-named modules repeat the same domain rules across steps.

Perguntas frequentes

Todo problema precisa de uma estrutura nova?

Não. A skill diz para preferir código simples quando a forma atual é clara e não deve crescer.

Qual é um exemplo comum?

Trocar booleanos espalhados por uma máquina de estados que só permite transições válidas.

Por que escolher a estrutura cedo?

Escrever a estrutura certa é barato no momento, enquanto recuperá-la depois costuma ser adiado e custa mais.

Detalhes

Descrição original do autor

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

repo: cursor/plugins

Popularidade

Estrelas no GitHub
15 mil
Posição no ranking
#10982
Licença
—
Atualizada em
31/10/2026

Essa skill é útil?

0

Entre para votar.

Comentários

  • …

Mais skills deste repositório

Skills parecidas