agentleFS
Sequela02Sequela02/canasta/skills/workflow/domain-modeling/SKILL.md

domain-modeling

Skill0 starsChanged yesterdayMITView on GitHub

Domain-driven design with checks behind every rule. Use when a

195 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use setup-ts-deep-modules, decision-mapping and 10 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.
  • liufeng1976Skill

    setup-ts-deep-modules

    Wire dependency-cruiser into a TypeScript repo so each package is a deep module — implementation hidden in subfolders, reachable only through its entry-point files. User-invoked.

    Also in 43 projects that use this

  • FabienDehopreSkill

    decision-mapping

    Turn a loose idea into a sequenced map of investigation tickets, then drive them to resolution one at a time.

    Also in 8 projects that use this

  • LesaniSkill

    writing-beats

    Shape an article as a journey of beats, choose-your-own-adventure style. The user picks a starting beat from the raw material, you write only that beat, then offer options for where to pivot next, beat by beat, until the article reaches a natural end. Use when the user has raw material and wants to assemble it as a narrative rather than an argument.

    Also in 62 projects that use this

  • RoentekSkill

    loop-me

    Grill me about specs for the workflows I want to build, within this workspace.

    Also in 56 projects that use this

  • AWSSkill

    wizard

    Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.

    Also in 134 projects that use this

  • LesaniSkill

    writing-shape

    Take a markdown file of raw material and shape it into an article through a conversational session — drafting candidate openings, growing the piece paragraph by paragraph, arguing about format (lists, tables, callouts, quotes) at each step. Use when the user has a pile of notes, fragments, or a rough draft and wants help turning it into something publishable.

    Also in 60 projects that use this

  • +1 more from Lesani

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 184 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read GLOSSARY.md first: at the repository root, or the per-context file named in a root GLOSSARY-MAP.md.

    line 29
  2. Distinctive:

    When a name crosses surfaces (persisted, serialized, a public API, a prompt), trace its contract with concept contracts before changing it.

    line 51
  3. Very specific:

    Write a property-based test for each invariant of a decider: generate command sequences, fold them through decide and evolve, and assert …

    line 98
  4. Distinctive:

    Use review. Lead with findings ordered by severity, each tied to the language, invariant, lifecycle or coupling evidence behind it.

    line 129

“Common” is measured: kept by at least 6 in 10 of the 184 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Domain Modeling

Domain rules held in prose drift; rules held in types, tests and build checks hold. Each step below ends in an artifact a tool checks: the glossary, a boundary test, closed types, a property test.

Skip the tactical steps (3–5) for plain data maintenance with no business rule, and say so in the pull request. Vocabulary and boundaries apply to every context.

1. Vocabulary

Read GLOSSARY.md first: at the repository root, or the per-context file named in a root GLOSSARY-MAP.md. Then, while designing:

  • Challenge a term that conflicts with the glossary, and ask which meaning holds.
  • Sharpen a vague or overloaded term into a canonical one, using concrete scenarios that probe its edges.
  • Cross-check the code: when a stated rule and the code disagree, quote the code and ask which is right.
  • Write each settled term into the glossary at once, in this shape:

    **Reservation**: a seat held for one customer until checkout completes or
    the hold expires.
    _Avoid_: booking, hold

The glossary holds what terms mean and nothing else; decisions go to an ADR, and only when the decision is hard to reverse, surprising without context and the result of a real trade-off. A rename updates the glossary, the code, tables, events, status values and issue titles in the same commit.

When a name crosses surfaces (persisted, serialized, a public API, a prompt), trace its contract with concept contracts before changing it.

Done when every term the change introduces or renames is in the glossary and the code uses it.

2. Bounded contexts

  • Each context is a module that owns its capability, its terms and its data. Contexts meet only through each other's public API; translate at that boundary. Each context owns its tables and entity classes.
  • Domain code imports only the language and its standard library: no framework, persistence, transport or serialization types.
  • Enforce both with a boundary test in CI, using boundary checks. An existing codebase records its current violations as a baseline, so only new ones fail.

Done when the boundary test runs in CI and passes against the baseline.

3. Decider

For a context whose state changes under business rules, model it as a decider (templates):

  • Commands (ReserveSeat), events in the past tense (SeatReserved) and rejections (SeatAlreadyTaken) are closed types, matched exhaustively.
  • decide(command, state) is pure and returns events or a rejection.
  • evolve(state, event) applies one event, covers every state and never fails.
  • The lifecycle is an explicit state type, so an invalid state is unrepresentable.
  • Size the aggregate to the smallest data that must stay consistent in one transaction. Reference other aggregates by identity. A rule spanning aggregates gets its own aggregate, or a policy that reacts to events.
  • The application service loads state, calls decide, applies evolve, saves and publishes. It holds no business rule.

Store state in the database by default. Choose event sourcing for a context whose history itself has business value, such as a ledger or an audit trail, and record that choice in an ADR.

Done when every business rule of the change lives in a decide function and the compiler rejects an unhandled command, event or state.

4. Invariants

Write a property-based test for each invariant of a decider: generate command sequences, fold them through decide and evolve, and assert the invariant on every resulting state. Use jqwik in Java, fast-check in TypeScript and Hypothesis in Python. Where the risk justifies a proof, such as money, hand decide to formal-verification.

Done when each invariant named in the glossary or the plan has a property test that fails when the rule is removed.

5. Skeleton first

A new context starts as a skeleton: glossary entries; command, event, rejection and state types; decide and evolve signatures; and the invariant tests, failing. Implementation follows in a later commit.

6. Integration

Around a decider, add the pattern the risk calls for, with its check, from integration:

  • a command that moves money or inventory may be retried: idempotency key;
  • two writers may race on one aggregate: optimistic concurrency;
  • a side effect leaves the database: transactional outbox;
  • a flow spans aggregates: process manager;
  • a client must work offline: local queue with server authority.

Done when each risk the change introduces has its pattern and its passing check, or the pull request names the risk accepted instead.

Reviewing a model

Use review. Lead with findings ordered by severity, each tied to the language, invariant, lifecycle or coupling evidence behind it; say plainly when the model is sound.

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.