Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)81k · #1615

ddd-context

Skill này làm gì

Skill này tạo một cấu trúc thư mục chuẩn cho một bounded context, tức là một lĩnh vực nghiệp vụ tách biệt trong codebase. Nó dành cho lập trình viên chia một ứng dụng lớn thành các phần rõ ràng.

Khi nào nên dùng

  • ✓Khi bạn bắt đầu một lĩnh vực nghiệp vụ mới trong codebase.
  • ✓Khi bạn tách một ứng dụng lớn thành các phần riêng với ranh giới rõ ràng.
  • ✓Khi bạn muốn cùng một bố cục miền, ứng dụng và hạ tầng cho một module mới.

Liên kết skill

https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-ddd/skills/ddd-context/SKILL.md

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-ddd/skills/ddd-context/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Hãy thiết lập một lĩnh vực billing mới trong codebase của tôi với các thư mục chuẩn.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill kiểm tra tên có theo kebab-case và chưa bị dùng không, rồi tạo các thư mục và file index cho các tầng miền, ứng dụng và hạ tầng. Nó cũng ghi lĩnh vực mới vào kho mô hình miền.

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.

Create a bounded context directory structure for the given context name.

Parse $ARGUMENTS as the context name (kebab-case). If empty, list existing contexts.

Steps

  1. Validate name: Ensure the context name is kebab-case and does not already exist under src/.

  2. Create directory structure:

    src/<context-name>/
      domain/
        entities/
        value-objects/
        events/
        services/
        repositories/
      application/
      infrastructure/
    
  3. Generate index files:

    • src/<context-name>/domain/entities/index.ts -- barrel export for entities
    • src/<context-name>/domain/value-objects/index.ts -- barrel export for value objects
    • src/<context-name>/domain/events/index.ts -- barrel export for domain events
    • src/<context-name>/domain/services/index.ts -- barrel export for domain services
    • src/<context-name>/domain/repositories/index.ts -- barrel export for repository interfaces
    • src/<context-name>/domain/index.ts -- re-export all domain submodules
    • src/<context-name>/application/index.ts -- barrel export for application services
    • src/<context-name>/infrastructure/index.ts -- barrel export for infrastructure implementations
    • src/<context-name>/index.ts -- public API of the bounded context (re-exports domain and application only, NOT infrastructure)
  4. Store in domain model graph:

    mcp__plugin_ruflo-core_ruflo__agentdb_hierarchical-store({ key: "domain/context-<context-name>", value: "Bounded context <context-name> (parent: domain)", tier: "semantic" })
    mcp__plugin_ruflo-core_ruflo__agentdb_causal-edge({ sourceId: "entity:domain", targetId: "entity:context-<context-name>", relation: "contains" })
    mcp__plugin_ruflo-core_ruflo__memory_store({ key: "ddd-context-<context-name>", value: "Created bounded context", namespace: "tasks" })
    
  5. Report: Confirm the context was created and list the generated files.

Câu hỏi thường gặp

Tôi nên dùng định dạng tên nào?

Dùng kebab-case, ví dụ billing-invoices, và đảm bảo chưa có thư mục nào cùng tên.

Index công khai để lộ những gì?

Nó chỉ xuất lại các tầng miền và ứng dụng, không xuất tầng hạ tầng.

Chuyện gì xảy ra nếu tôi chạy mà không có tên?

Nó liệt kê các context hiện có thay vì tạo cái mới.

Chi tiết

Mô tả gốc của tác giả

Create and manage a DDD bounded context with standard directory structure. Use when starting a new subdomain, splitting a monolith into bounded contexts, or scaffolding the domain/application/infrastructure layout for a fresh module.

repo: ruvnet/ruflo

Độ phổ biến

Sao GitHub
81k
Vị trí xếp hạng
#1615
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự