principle-model-the-domain
できること
このスキルは、状態を持つロジックを、ドメインに合った構造でモデル化する規則を、アシスタントに与えます。フラグやネストした条件でコードがいっぱいになっているエンジニア向けです。
使う場面
- ✓ライフサイクルや段階を持つ、状態を扱うロジックを書いているとき。
- ✓コードの分岐が多く、同じ形の前提がファイル間で繰り返されるとき。
- ✓無効な状態がシステムに入り続けてしまうとき。
スキルのリンク
https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-model-the-domain/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“注文の流れで、ステータスの追跡にブール値が大量に使われています。あり得ない状態が起きないように、きちんとモデル化してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
アシスタントは本当の状態とルールを特定し、状態機械、型付きのモデル、ルックアップテーブルなど、適した構造でそれらを表します。これにより、多くの分岐が減り、無効な状態を書きにくくなります。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)を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.
よくある質問
すべての問題に新しい構造が必要ですか?
いいえ。現在の形が明確で、大きくなりそうにないなら、スキルは単純なコードを優先します。
典型的な例は?
散らばったブール値を、有効な遷移だけを許す状態機械に置き換えることです。
なぜ構造を早く選ぶのですか?
書く時点では安価ですが、後から正しい構造を再構築するのは先送りされがちで、費用が大きくなるからです。
詳細
作者による元の説明
Apply when writing stateful logic, or when code branches a lot or repeats a shape assumption across files.
repo: cursor/plugins
人気
- GitHubのスター
- 15k
- ランキング
- #10982
- ライセンス
- —
- 更新日
- 2026/10/31
コメント
- …
このリポジトリの他のスキル
advisor
15k重要な判断の前や、エラーで行き詰まったときなど、要所でより強力な第二のモデルに相談させます。機能をオンにしている場合のみ動きます。
check-agent-compatibility
15kAIコーディングエージェントがリポジトリを起動し、検証し、文書化できるかを包括的に確認し、主な問題とともに1つの互換性スコアを返します。
cli-for-agents
15kAIエージェントがプロンプトなしで実行でき、わかりやすいヘルプ文と例を備えるように、コマンドラインツールを設計または確認する方法をエージェントに教えます。
continual-learning
15k過去のチャットを確認する作業を専用のメモリ更新エージェントに任せることで、AGENTS.mdのメモを最新に保ちます。
似ているスキル
diffs
394k編集内容の実際の共有可能な差分を、手書きの要約ではなく、ビューアーのリンクや画像ファイルとして作成するようエージェントを支援します。
coding-agent
394kCodex、Claude Code、OpenCodeに大きめのコーディング作業をバックグラウンドのワーカーとして渡し、その進捗を確認するようエージェントを支援します。
gh-issues
394kGitHubのイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。