Logo vun System Decomposition

System Decomposition

Communautéit
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.

Iwwersiicht

Editeursethdford
Repositoryclaude-skills
Skill-Nummsystem-decomposition
Stären
48
Forks
9
Matgeliwwert Fichieren
Nëmmen Instruktiounen
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    Vum sethdford op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill System Decomposition an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/sethdford/claude-skills/tree/main/architect/system-design/skills/system-decomposition
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

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
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert System Decomposition an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet System Decomposition automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass System Decomposition net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

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

Heefeg gestallte Froen

Wat mécht de KI-Skill 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.

Firwat System Decomposition op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. System Decomposition besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech System Decomposition an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/sethdford/claude-skills/tree/main/architect/system-design/skills/system-decomposition an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen System Decomposition benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat System Decomposition benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir System Decomposition domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill System Decomposition gratis?

Jo. De Skill gëtt vum sethdford ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇