Skip to content
OpenAgentSkill
Browsing is open · Catalog captured 2026-11-21 · Automatic updates and account services are paused.
Productivity

domain-model

Creates or modifies domain types in src/domain/ — value objects, discriminant unions, and aggregate roots. Use when adding a new domain concept, defining invariants for an existing type, or placing a shared discriminant union that is used across multiple use-cases. Do NOT use for orchestrating I/O or business logic — use `use-case` instead. Do NOT use for infrastructure concerns — use `adapter` instead.

ai-driven-dev · AI review on file

Installation

Read the source and dependencies before running a command. Copying does not install or execute anything.

npx skills add ai-driven-dev/framework --skill domain-model

About this skill


name: domain-model description: > Creates or modifies domain types in src/domain/ — value objects, discriminant unions, and aggregate roots. Use when adding a new domain concept, defining invariants for an existing type, or placing a shared discriminant union that is used across multiple use-cases. Do NOT use for orchestrating I/O or business logic — use use-case instead. Do NOT use for infrastructure concerns — use adapter instead.

Domain Model

Builds and places the typed vocabulary of the application: value objects, discriminant types, and aggregate roots that live in src/domain/models/. The domain layer must never import from application/ or infrastructure/.

Available actions

#ActionRoleInput
01choose-shapeDecide between value object, discriminant type, or aggregateconcept description
02define-invariantsEncode readonly fields, validation, factorychosen shape from 01
03placePick canonical file location, add named exportdefined type from 02
04testWrite unit tests for the domain typeplaced type from 03

Default flow

01 → 02 → 03 → 04

Transversal rules

  • All domain types must be free of application/ and infrastructure/ imports.
  • All fields are readonly; return new instances for mutations.
  • Never inline a discriminant union used in ≥2 use-cases; place it in src/domain/models/.
  • Named export only, no default export.
  • File name is kebab-case.ts.
  • Validate invariants in constructor or static factory; throw a typed domain error on invalid input.
  • Module-level const in CONSTANT_CASE for any literal used more than once.

References

  • references/value-objects.md — value object conventions (readonly, equals, constructor params)
  • references/discriminant-types.md — discriminant union placement rules and canonical locations
  • references/manifest.md — aggregate root conventions for the Manifest model

Invariant rules

  • references/value-objects.md — authoritative value object rules
  • references/discriminant-types.md — authoritative discriminant type rules