m09-domain

Classify domain concepts and map them to Rust ownership patterns.

3|Updated Mar 22, 2026
One-click install
npx skills add https://github.com/0xharryriddle/codex-field-kit --skill m09-domain-0xharryriddle
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: m09-domain
Source: https://github.com/0xharryriddle/codex-field-kit/tree/main/archive/upstream/chasebuild-agent-skills/rust/skills/m09-domain
Command: npx skills add https://github.com/0xharryriddle/codex-field-kit --skill m09-domain-0xharryriddle

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Domain modeling solves how to classify concepts (Entity vs Value Object vs Aggregate) and map them to Rust patterns with proper ownership and invariants.

Core Features & Use Cases

  • Provides a structured approach to classify Domain Concepts (Entity, Value Object, Aggregate Root, Repository, Domain Event) and map them to Rust patterns.
  • Helps design safe ownership models (Owned vs Shared) and invariant enforcement through constructors.
  • Use Case: When modeling a new domain module in a Rust service, apply these patterns to define IDs, ownership, and boundaries, ensuring clean testable boundaries.

Quick Start

Apply the domain modeling guidance to a new Rust module by deciding on Entity vs Value Object and mapping ownership and invariants accordingly.

Frequently Asked Questions about m09-domain

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I model domain entities and value objects in Rust?

Domain modeling in Rust maps concepts like entities and value objects to ownership patterns with proper invariants. Entities receive unique IDs, while value objects are immutable and compared by value, enforced through guarded constructors that validate data before instantiation.

What is the best way to define aggregate boundaries in a Rust service?

Defining aggregate boundaries in Rust involves classifying aggregate roots, grouping related entities and value objects, and enforcing consistency rules within those boundaries. This approach ensures clear ownership semantics and maintains valid state across domain events and repository interactions.

How does Rust ownership apply to DDD aggregate roots and shared data?

Rust ownership applies to DDD by distinguishing between owned data within an aggregate root and shared references across boundaries. This model uses Rust's borrow checker to enforce invariant rules at compile time, preventing invalid state mutations and ensuring scalable, correct designs.

When should I use domain events in Rust domain modeling?

Use domain events in Rust domain modeling to decouple aggregate roots and signal state changes across service boundaries. They provide a clear audit trail and allow downstream modules to react to invariant changes without creating tight coupling between separate domain repositories.

Can I enforce domain invariants using Rust constructors?

Enforcing domain invariants in Rust uses guarded constructors that validate all business rules before returning a valid entity or value object instance. This pattern leverages Rust's type system to make invalid states unrepresentable, ensuring data integrity throughout the aggregate lifecycle.