Logo System Decomposition

System Decomposition

Cộng đồng
sethdford
system-decomposition

Break complex systems into bounded contexts with DDD. Map business capabilities to service boundaries, define ubiquitous language, assess cohesion/coupling. Use when refactoring monoliths or designing new architectures.

Tổng quan

Nhà phát hànhsethdford
Kho mãclaude-skills
Tên kỹ năngsystem-decomposition
Sao
48
Bản fork
9
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Đầy đủ trong hướng dẫn

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được sethdford công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI System Decomposition trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/sethdford/claude-skills/tree/main/architect/system-design/skills/system-decomposition
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/sethdford/claude-skills.git /tmp/claude-skills
mkdir -p .claude/skills
cp -r /tmp/claude-skills/architect/system-design/skills/system-decomposition .claude/skills/system-decomposition
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật System Decomposition trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải System Decomposition ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên System Decomposition không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

System Decomposition

Systematically decompose complex systems using Domain-Driven Design: identify business capabilities, define bounded contexts, evaluate cohesion/coupling, design integration patterns.

Context

You are decomposing a system into services or modules. Your role is to:

  • Map business capabilities (not technical layers)
  • Define bounded contexts with explicit boundaries
  • Establish ubiquitous language (shared vocabulary per context)
  • Assess cohesion (focus) and coupling (dependencies)
  • Design integration patterns (sync API vs async events)

Good decomposition follows business domains, not technology layers. Anti-pattern: UserService, OrderService, PaymentService (implementation detail names) instead of Auth Realm, Commerce Hub, Payment Platform (domain names).

Domain Context

Based on Eric Evans' Domain-Driven Design and Sam Newman's Building Microservices:

  • Bounded Context: Explicit boundary around business capability. Each context has its own domain model.
  • Ubiquitous Language: Shared vocabulary within context (Order, Customer, Invoice). Prevents translation errors.
  • Aggregate: Entity cluster within context. Single consistency boundary. Example: Order + OrderItems as one aggregate.
  • Integration: How contexts communicate (Sync via API, Async via events, Shared database)
  • Cohesion: Does everything in the context serve one purpose?
  • Coupling: How many other services must it call?

When to Use This Skill

  • Breaking monolith into services
  • Designing new system architecture
  • Refactoring tight coupling
  • Aligning engineering teams to services
  • Preparing for independent scaling/deployment

Prerequisites

  • Understand business domains and pain points
  • Know current system architecture (if refactoring)
  • Have stakeholders available to discuss domain
  • Can draw diagrams (whiteboard, miro, draw.io)

Instructions (Detailed)

1. Identify Business Capabilities

Ask: "What does the business do?"

Example (E-commerce):

  • Authentication (who are you?)
  • Commerce (what do you want?)
  • Payment (how much does it cost?)
  • Fulfillment (ship it)
  • Analytics (understand customers)
  • Support (help customers)

Each capability can become a bounded context.

2. Define Bounded Contexts

For each capability, establish boundary with explicit name and responsibilities.

Example:

Auth Realm (Authentication)
- User registration, login, session management
- Produces: authenticated identity tokens
- Language: User, Credential, Session, Auth Token

Commerce Hub (Order Processing)
- Order creation, cart management, inventory
- Consumes: Auth tokens
- Produces: Order events
- Language: Order, Customer, Product, Cart, OrderItem

Payment Platform (Payment Processing)
- Payment processing, refunds, accounting
- Consumes: Order events
- Produces: Payment status events
- Language: Payment, Invoice, Transaction, Settlement

3. Map Ubiquitous Language

Define key terms within each context:

Auth Realm:
- "User" = identity with credentials
- "Session" = authenticated connection

Commerce Hub:
- "Order" = customer purchase request
- "Customer" = entity that places orders (different from Auth's User)

Payment Platform:
- "Invoice" = billable entity (different from Order)
- "Settlement" = final accounting status

Contexts use same words differently. Clear boundaries prevent confusion.

4. Assess Cohesion & Coupling

Cohesion (within context):

  • Do all functions serve one purpose? (high = good)
  • Would we change them for the same business reason? (yes = high cohesion)

Coupling (between contexts):

  • How many services must this call to complete a request?
  • Sync vs Async: Sync = tight coupling, Async = loose coupling
  • Target: Cohesion >80%, Coupling <3 sync calls/request

5. Design Integration Patterns

Synchronous (API call):

  • Used for immediate results
  • Tightly coupled
  • Simple debugging
  • Example: User creates order → Commerce Hub calls Payment Platform → charge card immediately

Asynchronous (event):

  • Fire-and-forget
  • Loosely coupled
  • Difficult debugging
  • Example: Order created → event published → Payment Platform subscribes and processes later

6. Create Context Diagram

Boxes = Contexts, Arrows = Synchronous calls, Events = Asynchronous communication.

┌──────────────┐        ┌──────────────┐        ┌──────────────┐
│  Auth Realm  │        │Commerce Hub  │        │   Payment    │
│              │        │              │        │  Platform    │
│ - Register   │──API───│ - Order      │───API──│ - Process    │
│ - Login      │        │   creation   │        │   payment    │
│ - Session    │        │ - Inventory  │        │ - Refund     │
└──────────────┘        │              │        └──────────────┘
                        │ Order Created│
                        │ Event ────────────────┐
                        └──────────────┘        │
                                        Event Handler
                                        (async payment)

7. Verify Against Anti-Patterns

  • Distributed monolith: Services so tightly coupled they act as one → redraw boundaries
  • Service per table: Data-driven decomposition (wrong) instead of domain-driven (right)
  • Chatty services: Need >10 calls to complete request → larger bounded contexts
  • God context: One service does everything → split into multiple contexts

Output Format

When decomposing, deliver:

  1. Business Capabilities: What the system does
  2. Bounded Contexts: Explicit boundaries with names
  3. Context Diagram: Visual showing contexts and integration
  4. Ubiquitous Language: Key terms per context
  5. Integration Patterns: Sync/Async by integration point
  6. Cohesion/Coupling Assessment: Scores for each context
  7. Deployment Plan: How to implement decomposition

Worked Example

Monolith: Single "UserService" handling everything (100K lines)

Issues:

  • Changes to UI tier require payment code changes
  • Teams can't deploy independently
  • Database contention

Decomposition:

Bounded Contexts:
1. Auth Realm: Registration, login, profiles
2. Commerce Hub: Orders, cart, inventory
3. Payment Platform: Payments, invoicing, settlements
4. Analytics: User behavior, metrics

Cohesion Scores:

  • Auth Realm: 95% (all about identity)
  • Commerce Hub: 85% (order-related, but inventory is borderline)
  • Payment Platform: 90% (all about money)

Coupling Analysis:

  • Commerce → Payment (sync): Payment::charge(amount)
  • Order Created → Analytics (async): Event subscriber

Integration:

Commerce Hub: POST /payment/charge with Order details
Response: Payment ID + status
On failure: Rollback order

Analytics: Subscribes to "OrderCreated" event
No coupling: Order doesn't wait for analytics

Decision Framework

  • One large context or many small?: Start coarse; split when pain emerges
  • Sync or Async?: Sync if needs immediate response (payment); Async if fire-and-forget (notifications)
  • Shared data or separate databases?: Separate per context (independence); shared only for atomic transactions
  • Communication overhead?: If sync calls >3 per request, reconsider boundaries

Anti-Patterns

  • Premature Microservices: Break before understanding domains
  • Technology-Driven: "Python team" vs "Python-for-ML domain"
  • Ignoring Coupling: Services talk to every other service
  • No Ubiquitous Language: Same word means different things

Quality Checklist

  • Each context has single business responsibility
  • Contexts named after domain (not tech: "Auth Realm" not "UserService")
  • Ubiquitous language documented per context
  • Cohesion >80% for each context
  • Coupling <3 sync calls per request
  • Integration patterns clear (sync/async)
  • Deployment independence verified
  • Teams can own individual contexts

Further Reading

  • Eric Evans, Domain-Driven Design (2003) — Foundational
  • Sam Newman, Building Microservices (2nd ed., 2021) — Practical decomposition
  • Dora et al., Accelerate — Impact of decomposition on deployment frequency

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

Kỹ năng AI System Decomposition làm được gì?

Break complex systems into bounded contexts with DDD. Map business capabilities to service boundaries, define ubiquitous language, assess cohesion/coupling. Use when refactoring monoliths or designing new architectures.

Vì sao nên dùng System Decomposition trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. System Decomposition là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài System Decomposition trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/sethdford/claude-skills/tree/main/architect/system-design/skills/system-decomposition. TypingMind đọc tệp SKILL.md và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng System Decomposition?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng System Decomposition với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng System Decomposition với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI System Decomposition có miễn phí không?

Có. Kỹ năng này được sethdford phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇