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-19
- Stars
- ★ 0
- 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 资源文件 1
- 参考文档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
wcag-audit-patterns
Comprehensive guide to auditing web content against WCAG 2.2 guidelines with actionable remediation strategies.
unit-testing-test-generate
Generate comprehensive, maintainable unit tests across languages with strong coverage and edge case focus.
testing-qa
Comprehensive testing and QA workflow covering unit testing, integration testing, E2E testing, browser automation, and quality assurance.
test-fixing
Systematically identify and fix all failing tests using smart grouping strategies. Use when explicitly asks to fix tests ("fix these tests", "make tests pass"), reports test failures ("tests are failing", "test suite is broken"), or completes implementation and wants tests passing.
test-driven-development
Use when implementing any feature or bugfix, before writing implementation code
terraform-infrastructure
Terraform infrastructure as code workflow for provisioning cloud resources, creating reusable modules, and managing infrastructure at scale.