domain-entity-creation
Use when creating or changing domain entities, value objects, or their tests.
- License 许可
- AGPL-3.0
- 最近更新
- 2026-11-11
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- domain-entity-creation
- description
- Use when creating or changing domain entities, value objects, or their tests.
03 SKILL.md 正文
Domain Entity Creation
Load
- Folder Responsibility
- Domain Modeling
- Domain Validations And Helpers
- Error Creation
- Readability
- Domain Unit Tests
Entity Pattern
- Entity:
src/domain/<domain>/entities/<name>.entity.ts. - Validations:
src/domain/<domain>/entities/validations/<name>.validation.ts. - Helpers: one default-exported function per
src/domain/<domain>/entities/helpers/<name>.helper.ts. - Tests:
src/domain/<domain>/entities/__tests__/<name>.entity.test.ts. - Freeze returned entities and exported entity objects.
- Delegate reusable validation to the entity's frozen validation object; keep entity methods focused on construction or transition, events, and audits.
- Spread the entity's validation object into the frozen entity API. Import helpers directly and do not re-export them through the entity object.
- Return
[entity, events, audit]for creation/mutation methods when the local pattern does. - Export the frozen entity object as default.
Use nearby entities as the source of truth for exact typing and audit/event shape.
Value Pattern
- Value:
src/domain/<domain>/values/<name>.vo.ts. - Validations:
src/domain/<domain>/values/validations/<name>.validation.ts. - Helpers: one default-exported function per
src/domain/<domain>/values/helpers/<name>.helper.ts. - Validation tests:
src/domain/<domain>/values/validations/__tests__/<name>.validation.test.ts. - Value tests:
src/domain/<domain>/values/__tests__/<name>.vo.test.ts. - Freeze returned values and exported value objects.
- Spread the value's validation object into the frozen value API. Import helpers directly and do not re-export them through the value object.
- Import shared value validations directly when no owning value object exists.
- Keep private construction assertions with their value factory when they do not form a reusable validation API.
Use nearby values as the source of truth for exact typing and immutable result shape.
04 同仓库更多 Skills
testing
Use when adding, changing, or reviewing tests in this repository.
reporting-usecase-creation
Use when creating, changing, or reorganizing reporting use cases and their DTOs, read queries, tests, wiring, or HTTP endpoints. Does not cover accounting reporting-period or reporting-context management.
pr-reviewer
Use when reviewing code changes, pull requests, or branch diffs.
planner
Use whenever the user asks for a plan, implementation plan, approach, roadmap, or planning, and whenever the agent decides to create or present a plan before doing work.
pair-programmer
Use when implementing code changes in this repository.
migration
Use when creating, running, or reviewing database migrations.