ddd-validate
Skill này làm gì
Skill này kiểm tra một codebase theo domain-driven design để tìm rò rỉ ranh giới, tức là khi một lĩnh vực nghiệp vụ import file nội bộ của lĩnh vực khác. Nó dành cho nhóm muốn giữ cấu trúc mã gọn gàng.
Khi nào nên dùng
- ✓Khi bạn muốn kiểm tra codebase xem có rò rỉ giữa các lĩnh vực nghiệp vụ không.
- ✓Khi bạn sắp hợp nhất một thay đổi chạm vào nhiều lĩnh vực.
- ✓Khi bạn muốn một kiểm tra tự động bắt sớm các vấn đề về ranh giới.
Liên kết skill
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-ddd/skills/ddd-validate/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Hãy kiểm tra codebase của tôi xem có đoạn mã nào chạm vào file nội bộ của lĩnh vực khác không.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill tìm từng lĩnh vực nghiệp vụ, quét các file để tìm import đi vào thư mục nội bộ của lĩnh vực khác, rồi kiểm tra các quy tắc về entity, tên sự kiện và vị trí của repository. Sau đó nó báo cáo từng vấn đề tìm được.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Validate domain boundary integrity across all bounded contexts.
Steps
Discover contexts: Scan
src/*/domain/to find all bounded contexts.Check cross-boundary violations:
- For each context, scan all
.tsfiles for import statements - Flag any import that reaches into another context's
domain/directory directly - Allowed: importing from another context's public
index.ts(application layer) - Violation: importing from
src/<other-context>/domain/entities/...directly
# Find cross-boundary imports for ctx in $(find src -maxdepth 2 -name "domain" -type d | sed 's|src/||;s|/domain||'); do grep -rn "from ['\"].*src/" "src/$ctx/" --include="*.ts" | grep -v "src/$ctx/" || true done- For each context, scan all
Check aggregate invariant enforcement:
- Scan aggregate root entities for public setters that bypass validation
- Flag mutable public properties without invariant checks
- Verify that child entities are not directly accessible (must go through aggregate root)
Check event naming conventions:
- Domain events should be past-tense named (e.g.,
OrderCreated, notCreateOrder) - Events should be immutable (no public setters)
- Events should carry the aggregate ID
- Domain events should be past-tense named (e.g.,
Check repository patterns:
- Repository interfaces should exist in
domain/repositories/, notinfrastructure/ - Repository implementations should exist in
infrastructure/, notdomain/ - Each aggregate root should have exactly one repository
- Repository interfaces should exist in
Report findings:
- Output a table of violations with file path, line number, violation type, and suggestion
- Categorize as:
BOUNDARY,INVARIANT,EVENT,REPOSITORY - Exit with summary: total violations, by category, severity
Store results:
npx @claude-flow/cli@latest memory store --key "ddd-validation-TIMESTAMP" --value "RESULTS_SUMMARY" --namespace tasks npx @claude-flow/cli@latest hooks post-task --task-id "ddd-validate" --success true --store-results true
Câu hỏi thường gặp
Thế nào là vi phạm?
Import đi thẳng vào thư mục miền của lĩnh vực khác sẽ bị đánh dấu. Import từ index công khai của lĩnh vực khác thì được phép.
Skill có tự sửa lỗi không?
Các bước tập trung vào việc tìm và báo cáo vấn đề, nên bạn hãy xem báo cáo và quyết định cần sửa gì.
Quy tắc đặt tên nào áp dụng cho sự kiện?
Sự kiện miền nên đặt ở thì quá khứ, ví dụ OrderCreated thay vì CreateOrder.
Chi tiết
Mô tả gốc của tác giả
Validate domain boundaries -- detect cross-context import violations and aggregate invariant issues. Use when auditing a DDD codebase for leaks between bounded contexts, before merging cross-cutting changes, or as a CI gate to catch boundary erosion early.
repo: ruvnet/ruflo
Độ phổ biến
- Sao GitHub
- 81k
- Vị trí xếp hạng
- #1616
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
agent-adaptive-coordinator
81kGiúp agent của bạn chia và cân bằng lại một nhóm agent AI khi khối lượng công việc thay đổi, chọn bố cục phù hợp với tác vụ.
agent-agent
81kDạy agent của bạn biến một mục tiêu lớn thành kế hoạch hành động có thứ tự, và lập lại kế hoạch khi điều kiện thay đổi.
agent-agentic-payments
81kGiúp agent của bạn quản lý ủy quyền chi tiêu cho mua sắm bằng AI, với hạn mức chi, khung thời gian, quy tắc người bán và phê duyệt có chữ ký.
agent-analyze-code-quality
81kGiúp agent của bạn rà soát chất lượng mã, tìm code smell, nợ kỹ thuật và gợi ý tái cấu trúc mà không thay đổi các file.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.