m09-domain

Map domain concepts to Rust structs, enums, and traits.

Updated Feb 12, 2026
One-click install
npx skills add https://github.com/jmduea/emotiv-cortex-rs --skill m09-domain-jmduea
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: m09-domain
Source: https://github.com/jmduea/emotiv-cortex-rs/tree/main/.github/skills/m09-domain
Command: npx skills add https://github.com/jmduea/emotiv-cortex-rs --skill m09-domain-jmduea

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers often struggle to correctly model business concepts in Rust code, deciding between entities, value objects, aggregates, and ensuring invariants and ownership are properly handled.

Core Features & Use Cases

  • Guidance Mapping: Directly maps domain concepts (Entity, Value Object, Aggregate, Repository, Domain Event, Service) to appropriate Rust patterns with ownership implications.
  • Thinking Prompts: Provides structured questions to assess identity, invariants, and ownership before coding.
  • Template Examples: Supplies ready-to-use Rust snippets for value objects, entities, and aggregates, helping enforce encapsulation and validation.
  • Traceability: Shows how to trace domain decisions up to business rules and down to concrete implementation steps.

Quick Start

Use the m09-domain skill to design a Rust struct for a new Domain Entity, specifying its ID type and validation rules.

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?

Map domain entities and value objects to Rust structs and enums, enforcing encapsulation and validation through private fields, constructors, and trait-based persistence interfaces to preserve business invariants.

What is the best way to implement an aggregate root in Rust?

Implement an aggregate root in Rust by defining a struct that enforces business invariants internally, managing identity handling and ownership while exposing only valid state transitions through controlled constructors.

How do I design a repository pattern for domain persistence in Rust?

Design a repository pattern for domain persistence in Rust by defining trait-based interfaces, which abstract data storage operations and allow domain logic to remain decoupled from infrastructure implementation details.

Can I use Domain-Driven Design to handle validation and invariants in Rust?

Yes, you can use Domain-Driven Design in Rust to handle validation by enforcing invariants within aggregate roots and value objects, utilizing private fields and constructors to ensure objects cannot exist in invalid states.

When should I use a value object versus an entity in Rust?

Use a value object in Rust when a concept is defined entirely by its attributes without identity, and use an entity when unique identity and lifecycle tracking are required across the domain.

How do I map domain events to Rust code structures?

Map domain events to Rust code structures by representing them as enums or structs, allowing the system to trace domain decisions down to concrete implementation steps and up to business rules.