The m09-domain skill guides developers in applying Domain-Driven Design (DDD) principles to Rust code by helping them classify domain concepts as entities, value objects, aggregates, or repositories before implementation. It's designed for Rust developers building complex business domains who need to understand how to translate domain concepts into appropriate Rust ownership patterns and type structures. The skill solves the problem of misaligning code architecture with business logic by providing a decision framework that traces domain modeling choices upward to business constraints and downward to concrete Rust implementation patterns.

skills.sh installs
750
GitHub stars
1.3K
last updated
Jul 14, 2026

Install

$ npx -y skills add zhanghandong/rust-skills --skill m09-domain --agent claude-code

Installs into .claude/skills of the current project.

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 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

Sponsors

Details

Repository
github.com/zhanghandong/rust-skills
Category
Rust

More from zhanghandong/rust-skills

All 34

Recommended

More Rust
1zhanghandong avatarm11-ecosystemzhanghandong/rust-skillsm11 ecosystem747skills.sh installs
2zhanghandong avatarmeta-cognition-parallelzhanghandong/rust-skillsmeta cognition parallel635skills.sh installs
3zhanghandong avatardomain-embeddedzhanghandong/rust-skillsdomain embedded625skills.sh installs
4mohitmishra786 avatarrustc-basicsmohitmishra786/low-level-dev-skillsRust compiler skill for systems programming. Use when selecting RUSTFLAGS, configuring Cargo profiles, tuning release builds, reading assembly or MIR output, un567skills.sh installs
5secondsky avatarcloudflare-workers-multi-langsecondsky/claude-skillsMulti-language Workers development with Rust, Python, and WebAssembly. Use when building Workers in languages other than JavaScript/TypeScript, or when integrat310skills.sh installs
6openzeppelin avatarsetup-stellar-contractsopenzeppelin/openzeppelin-skillsSet up a Stellar/Soroban smart contract project with OpenZeppelin Contracts for Stellar. Use when users need to: (1) install Stellar CLI and Rust toolchain for 296skills.sh installs