agentleFS
B16B1RDB16B1RD/bb-writ/skills/principle-model-the-domain/SKILL.md

principle-model-the-domain

Skill0 starsChanged 6 days agoMITView on GitHub

状態を持つ処理を書くとき、分岐が増え続けるとき、同じデータの形の仮定が複数のファイルで繰り返されるときに適用する。規則を条件分岐でなく構造に入れる。

50 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use principle-explain-the-number, poteto-help and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • ianclearySkill

    principle-explain-the-number

    Apply before you trust, report, or act on a number you measured: a speedup, a regression, a throughput, a latency, or an eval result. Find what limits it, and rule out that it measured something other than the work you think.

    Also in 29 projects that use this

  • ianclearySkill

    poteto-help

    Guides users through pstack setup, /poteto-mode, and picking the skill, playbook, or principle for a task. Type /poteto-help with a question.

    Also in 14 projects that use this

  • bnemaSkill

    setup-pstack

    Configure which Pi models pstack uses per role. Detects available provider/model specs and writes pstack's user configuration. Use for /setup-pstack, "configure pstack models", or changing pstack model choices.

    Also in 24 projects that use this

  • eryzerzSkill

    make-bot-ui

    Use when building a custom UI (page, dashboard, buttons) that should wake a Grok Bot over a webhook, when the user must provide a webhook sender key, or when exposing that UI on Tailscale.

    Also in 18 projects that use this

  • tristanphvnSkill

    ketchup-video

    Catch the user up like /keel:ketchup, with a short silent video of slides for what happened and the waiting calls as text under it. Use for /keel:ketchup-video.

    Also in 10 projects that use this

  • TheOnlyFusionCubeSkill

    maintain-formal-verification-skill

    Bring a project's formal verification back in line with the code after the code changes: find the commits that touched verified code, update the model, harness, or properties to describe the code as it is now, rerun, and say whether each failure is drift in the verification or a bug in the code. Use for /maintain-formal-verification-skill, \"is the model still true to the code\", or after merges and refactors that touched verified code without rechecking it.

    Also in 16 projects that use this

The file

Files
SKILL.md

ドメインを構造で表す

対象のドメインの規則は、散らばった条件分岐でなく、データ構造に入れる。ドメインに合った構造は、ありえない状態を表せなくし、分岐を消す。書くときに選べば安いが、後から取り戻すと作り直しになり、先送りされる。

なぜ: 規則が分岐に散ると、新しい場合が来るたびに全部の分岐を探して直す。構造に入れた規則は 1 か所で読めて、破れない。

適用する場面:

  • 機能を足すと、既存の if・elif の連鎖が 1 つ伸びるとき。
  • 1 つ目の真偽値と常に揃えておく、2 つ目の真偽値を足そうとしたとき。
  • モジュールが「読む・検証する・変換する・保存する」の段の名前で分かれ、同じ規則が各段に繰り返されているとき。

やること:

  • 散らばった真偽値・段階の判定は、状態機械(状態と遷移の表)にする。
  • ファイルをまたぐ分岐は、表・登録簿(辞書)・種類を持つ型(Python の Enum や dataclass、Rust の enum)にする。読み方に合わせて、索引・キャッシュ・木などの集まりを選ぶ。
  • モジュールは、実行の順番でなく、1 つのドメインの知識(料金の規則、在庫の条件)ごとにまとめる。合う構造が無ければ、決して許さない状態と読み方を書き出し、それをちょうど表す構造を探す。

使わないとき: いまの形が明快で、局所的で、育つ見込みが無いとき。分岐・重複した規則・ありえない状態を減らさない抽象は、間接の層を足すだけなので作らない。

確かめる例: 新しい場合を足す差分が、表や状態の定義への追加で済んでいる。同じ規則を判定する条件式が、複数のファイルに無い。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.