
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)
m09-domain capabilities & compatibility
- Capabilities
- is it an entity (identity matters) or value obje · what invariants must be maintained? · where are the aggregate boundaries?
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, 领域
CRITICAL: Use for domain modeling. Triggers: domain model, DDD, domain-driven design, entity, value object, aggregate, repository pattern, business rules, valid
npx skills add https://github.com/actionbook/rust-skills --skill m09-domainAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1.4k |
|---|---|
| repo stars | ★ 1.3k |
| Security audit | 3 / 3 scanners passed |
| Last updated | May 24, 2026 |
| Repository | actionbook/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
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 Concept | Rust Pattern | Ownership Implication |
|---|---|---|
| Entity | struct + Id | Owned, unique identity |
| Value Object | struct + Clone/Copy | Shareable, immutable |
| Aggregate Root | struct owns children | Clear ownership tree |
| Repository | trait | Abstracts persistence |
| Domain Event | enum | Captures state changes |
| Service | impl block / free fn | Stateless 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 Question | Trace To | Ask |
|---|---|---|
| Entity vs Value Object | domain-* | What makes two instances "the same"? |
| Aggregate boundaries | domain-* | What must be consistent together? |
| Validation rules | domain-* | 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 Concept | Rust Pattern | Example |
|---|---|---|
| Value Object | Newtype | struct Email(String); |
| Entity | Struct + ID | struct User { id: UserId, ... } |
| Aggregate | Module boundary | mod order { ... } |
| Repository | Trait | trait UserRepo { fn find(...) } |
| Domain Event | Enum | enum 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
| Mistake | Why Wrong | Better |
|---|---|---|
| Primitive obsession | No type safety | Newtype wrappers |
| Public fields with invariants | Invariants violated | Private + accessor |
| Leaked aggregate internals | Broken encapsulation | Methods on root |
| String for semantic types | No validation | Validated newtype |
---
Related Skills
| When | See |
|---|---|
| Type-driven implementation | m05-type-driven |
| Ownership for aggregates | m01-ownership |
| Domain error handling | m13-domain-error |
| Specific domain rules | domain-* |
Related skills
Forks & variants (1)
M09 Domain has 1 known copy in the catalog totaling 762 installs. They canonicalize to this original listing.
- zhanghandong - 762 installs
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.