# m09-domain

Domain-driven design guide for structuring Rust code. Helps your coding agent organize entities, aggregates, and value objects under Rust ownership.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 3300 installs · ★ 1545
- Author: actionbook
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/actionbook/rust-skills/tree/HEAD/skills/m09-domain/SKILL.md
- Updated: 2026-08-23
- HTML: https://affpapa.org/en/nevibecode/skills/m09-domain

## What it does

This skill translates DDD patterns into idiomatic Rust constructs. It directs the assistant to represent entities with unique IDs, wrap plain data into validated Newtypes, and keep aggregate boundaries tight inside dedicated modules. The root struct owns its child items directly instead of leaking references outside.

Inside, repository patterns translate to traits, domain state transitions map to the type-state pattern, and domain events become enums. The guidelines actively warn the assistant against primitive obsession, public fields that bypass invariants, and exposed aggregate internals.

Notice that this skill is configured as non-user-invocable. You do not trigger it with a slash command; the agent activates it on its own when domain concepts, business invariants, or aggregate design enter the conversation.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill m09-domain -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/m09-domain/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/m09-domain/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill m09-domain -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/m09-domain/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill m09-domain -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/m09-domain/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install actionbook/rust-skills m09-domain
```

2. **Manually: put the files in place**
- File: `.github/skills/m09-domain/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill m09-domain -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/actionbook/rust-skills --path skills/m09-domain
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/m09-domain/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill m09-domain -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/actionbook/rust-skills/tree/HEAD/skills/m09-domain/SKILL.md

## When to use it
- model domain entities and value objects in Rust
- enforce aggregate boundaries and clear data ownership
- protect domain invariants through validated constructors
- abstract persistence layers with repository traits

## Example prompts
- Design an Order aggregate with OrderItem lines using DDD principles
- Create an Email value object with validation in the constructor
- How do I enforce state transitions for this entity with type states?

## Similar
- [domain-driven-design](https://affpapa.org/en/nevibecode/skills/orchestkit-domain-driven-design.md) — skill · 1300 installs
- [domain-analysis](https://affpapa.org/en/nevibecode/skills/domain-analysis.md) — skill · 358 installs
- [ddd-aggregate](https://affpapa.org/en/nevibecode/skills/ddd-aggregate.md) — skill · 749 installs
- [layers-domain](https://affpapa.org/en/nevibecode/skills/layers-domain.md) — skill · 1900 installs
- [ddd](https://affpapa.org/en/nevibecode/skills/ddd.md) — skill · 2900 installs
- [design-code-architecture](https://affpapa.org/en/nevibecode/skills/design-code-architecture.md) — skill · 2300 installs

From the same set: [actionbook/rust-skills](https://affpapa.org/en/nevibecode/by/actionbook/rust-skills.md) — 35 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
