Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
actionbook avatar

M09 Domain

  • 1.4k installs
  • 1.3k repo stars
  • Updated May 24, 2026
  • actionbook/rust-skills

m09-domain is an agent skill for model domain logic in rust with entities, value objects, and bounded context patterns.

About

The m09-domain skill is designed for model domain logic in Rust with entities, value objects, and bounded context patterns. Domain Modeling > Layer 2: Design Choices Core Question What is this concept's role in the domain? Before modeling in code, understand: Is it an Entity (identity matters) or Value Object (interchangeable)? Invoke when the user designs domain entities, value objects, or bounded contexts in Rust.

  • Is it an Entity (identity matters) or Value Object (interchangeable)?.
  • What invariants must be maintained?.
  • Where are the aggregate boundaries?.

M09 Domain by the numbers

  • 1,448 all-time installs (skills.sh)
  • +50 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #11 of 129 Rust skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

m09-domain capabilities & compatibility

Capabilities
is it an entity (identity matters) or value obje · what invariants must be maintained? · where are the aggregate boundaries?
From the docs

What m09-domain says it does

CRITICAL: Use for domain modeling. Triggers: domain model, DDD, domain-driven design, entity, value object, aggregate, repository pattern, business rules, validation, invariant, 领域
SKILL.md
CRITICAL: Use for domain modeling. Triggers: domain model, DDD, domain-driven design, entity, value object, aggregate, repository pattern, business rules, valid
SKILL.md
npx skills add https://github.com/actionbook/rust-skills --skill m09-domain

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1.4k
repo stars1.3k
Security audit3 / 3 scanners passed
Last updatedMay 24, 2026
Repositoryactionbook/rust-skills

How do I model domain logic in rust with entities, value objects, and bounded context patterns?

Model domain logic in Rust with entities, value objects, and bounded context patterns.

Who is it for?

Rust developers structuring domain-driven design in application cores.

Skip if: Skip for syntax-only questions without domain modeling scope.

When should I use this skill?

User designs domain entities, value objects, or bounded contexts in Rust.

What you get

Completed m09-domain workflow with documented commands, files, and expected deliverables.

  • Domain model design with Rust pattern mappings

Files

SKILL.mdMarkdownGitHub ↗

Domain Modeling

Layer 2: Design Choices

Core Question

What is this concept's role in the domain?

Before modeling in code, understand:

  • Is it an Entity (identity matters) or Value Object (interchangeable)?
  • What invariants must be maintained?
  • Where are the aggregate boundaries?

---

Domain Concept → Rust Pattern

Domain ConceptRust PatternOwnership Implication
Entitystruct + IdOwned, unique identity
Value Objectstruct + Clone/CopyShareable, immutable
Aggregate Rootstruct owns childrenClear ownership tree
RepositorytraitAbstracts persistence
Domain EventenumCaptures state changes
Serviceimpl block / free fnStateless operations

---

Thinking Prompt

Before creating a domain type:

1. What's the concept's identity?

  • Needs unique identity → Entity (Id field)
  • Interchangeable by value → Value Object (Clone/Copy)

2. What invariants must hold?

  • Always valid → private fields + validated constructor
  • Transition rules → type state pattern

3. Who owns this data?

  • Single owner (parent) → owned field
  • Shared reference → Arc/Rc
  • Weak reference → Weak

---

Trace Up ↑

To domain constraints (Layer 3):

"How should I model a Transaction?"
    ↑ Ask: What domain rules govern transactions?
    ↑ Check: domain-fintech (audit, precision requirements)
    ↑ Check: Business stakeholders (what invariants?)
Design QuestionTrace ToAsk
Entity vs Value Objectdomain-*What makes two instances "the same"?
Aggregate boundariesdomain-*What must be consistent together?
Validation rulesdomain-*What business rules apply?

---

Trace Down ↓

To implementation (Layer 1):

"Model as Entity"
    ↓ m01-ownership: Owned, unique
    ↓ m05-type-driven: Newtype for Id

"Model as Value Object"
    ↓ m01-ownership: Clone/Copy OK
    ↓ m05-type-driven: Validate at construction

"Model as Aggregate"
    ↓ m01-ownership: Parent owns children
    ↓ m02-resource: Consider Rc for shared within aggregate

---

Quick Reference

DDD ConceptRust PatternExample
Value ObjectNewtypestruct Email(String);
EntityStruct + IDstruct User { id: UserId, ... }
AggregateModule boundarymod order { ... }
RepositoryTraittrait UserRepo { fn find(...) }
Domain EventEnumenum OrderEvent { Created, ... }

Pattern Templates

Value Object

struct Email(String);

impl Email {
    pub fn new(s: &str) -> Result<Self, ValidationError> {
        validate_email(s)?;
        Ok(Self(s.to_string()))
    }
}

Entity

struct UserId(Uuid);

struct User {
    id: UserId,
    email: Email,
    // ... other fields
}

impl PartialEq for User {
    fn eq(&self, other: &Self) -> bool {
        self.id == other.id  // Identity equality
    }
}

Aggregate

mod order {
    pub struct Order {
        id: OrderId,
        items: Vec<OrderItem>,  // Owned children
        // ...
    }

    impl Order {
        pub fn add_item(&mut self, item: OrderItem) {
            // Enforce aggregate invariants
        }
    }
}

---

Common Mistakes

MistakeWhy WrongBetter
Primitive obsessionNo type safetyNewtype wrappers
Public fields with invariantsInvariants violatedPrivate + accessor
Leaked aggregate internalsBroken encapsulationMethods on root
String for semantic typesNo validationValidated newtype

---

Related Skills

WhenSee
Type-driven implementationm05-type-driven
Ownership for aggregatesm01-ownership
Domain error handlingm13-domain-error
Specific domain rulesdomain-*

Related skills

Forks & variants (1)

M09 Domain has 1 known copy in the catalog totaling 762 installs. They canonicalize to this original listing.

How it compares

Use m09-domain for DDD design decisions in Rust; use general Rust skills when the task is syntax, async, or cargo tooling without domain modeling.

FAQ

What does m09-domain do?

Model domain logic in Rust with entities, value objects, and bounded context patterns.

When should I use m09-domain?

User designs domain entities, value objects, or bounded contexts in Rust.

Is m09-domain safe to install?

Review the Security Audits panel on this page before installing in production.

Rustbackend

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.