ddd-tactical-patterns – skill Lập trình cho agent AI
Áp dụng các mẫu chiến thuật DDD trong code với entity, value object, aggregate, repository và domain event kèm các bất biến (invariant) rõ ràng.
Cài skill ddd-tactical-patterns bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/ddd-tactical-patterns-4ef20.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /ddd-tactical-patterns – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/ddd-tactical-patterns-4ef20.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $ddd-tactical-patterns – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/ddd-tactical-patterns-4ef20.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /ddd-tactical-patterns – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/ddd-tactical-patterns-4ef20.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /ddd-tactical-patterns – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
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
1. Identify invariants first and design aggregates around them.
2. Model immutable value objects for validated concepts.
3. Keep domain behavior in domain objects, not controllers.
4. Emit domain events for meaningful state transitions.
5. 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 (!Number.isInteger(itemsCount) || 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.
Skill liên quan
- monorepo-navigator – Điều hướng, quản lý và tối ưu monorepo. Bao gồm Turborepo, Nx, pnpm workspaces và Lerna…
- debate-review – Đánh giá PR bằng tranh luận giữa hai mô hình cho GitHub PR, GitLab MR, Azure DevOps PR…
- debug-buttercup – Mọi pod chạy trong namespace crs. Dùng khi pod trong namespace crs ở trạng thái…
- debugger – Chuyên gia gỡ lỗi cho lỗi, test thất bại và hành vi không mong đợi. Chủ động dùng khi…
- debugging-and-error-recovery – Hướng dẫn gỡ lỗi có hệ thống để tìm nguyên nhân gốc rễ. Dùng khi test thất bại, build bị…
- debugging-code – Gỡ lỗi mã nguồn tương tác — đặt breakpoint, chạy từng dòng, kiểm tra trạng thái biến khi…
- debugging-strategies – Biến việc gỡ lỗi từ đoán mò gây bực bội thành giải quyết vấn đề có hệ thống, với các…
- debugging-toolkit – Dùng khi làm việc với debugging toolkit smart debug (Alias cho…