ddd-tactical-patterns
Apply DDD tactical patterns in code using entities, value objects, aggregates, repositories, and domain events with explicit invariants.
- License 许可
- MIT
- 最近更新
- 2026-04-11
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- ddd-tactical-patterns
- risk
- safe
- tags
- [ddd, tactical, aggregates, value-objects, domain-events]
- source
- self
- date_added
- 2026-02-27
- description
- Apply DDD tactical patterns in code using entities, value objects, aggregates, repositories, and domain events with explicit invariants.
02 资源文件 2
- 参考文档.openskills.json273 B
- 参考文档references/tactical-checklist.md611 B
03 SKILL.md 正文
DDD Tactical Patterns
Use this skill when
- Translating domain rules into code structures.
- Designing aggregate boundaries and invariants.
- Refactoring an anemic model into behavior-rich domain objects.
- Defining repository contracts and domain event boundaries.
Do not use this skill when
- You are still defining strategic boundaries.
- The task is only API documentation or UI layout.
- Full DDD complexity is not justified.
Instructions
- Identify invariants first and design aggregates around them.
- Model immutable value objects for validated concepts.
- Keep domain behavior in domain objects, not controllers.
- Emit domain events for meaningful state transitions.
- Keep repositories at aggregate root boundaries.
If detailed checklists are needed, open references/tactical-checklist.md.
Example
class Order {
private status: "draft" | "submitted" = "draft";
submit(itemsCount: number): void {
if (itemsCount === 0) throw new Error("Order cannot be submitted empty");
if (this.status !== "draft") throw new Error("Order already submitted");
this.status = "submitted";
}
}
Limitations
- This skill does not define deployment architecture.
- It does not choose databases or transport protocols.
- It should be paired with testing patterns for invariant coverage.
04 同仓库更多 Skills
tdd-workflows-tdd-refactor
Use when working with tdd workflows tdd refactor
tdd-workflows-tdd-red
Generate failing tests for the TDD red phase to define expected behavior and edge cases.
tdd-workflows-tdd-green
Implement the minimal code needed to make failing tests pass in the TDD green phase.
tdd-workflows-tdd-cycle
Use when working with tdd workflows tdd cycle
tdd-workflow
Use this skill when writing new features, fixing bugs, or refactoring code. Enforces test-driven development with 80%+ coverage including unit, integration, and E2E tests.
tdd-orchestrator
Master TDD orchestrator specializing in red-green-refactor discipline, multi-agent workflow coordination, and comprehensive test-driven development practices.