The interface is localized. Skill descriptions and documents are machine-translated by AI into your language; code, commands, paths and technical terms stay in the original, and the author's document governs.
Explore skills
Data & research · SKILL.md

microservices-decomposition

microservices-decomposition

Break monoliths into services — domain boundaries, communication patterns, data ownership, strangler fig migration, and operational readiness. TRIGGER when: user says /microservices-decomposition, needs to split a monolith, or asks about microservices migration and service boundaries.

Independent GitHub snapshot · Automated classification · Original documentation governs

Skill documentation

GitHub

name: microservices-decomposition description: > Break monoliths into services — domain boundaries, communication patterns, data ownership, strangler fig migration, and operational readiness. TRIGGER when: user says /microservices-decomposition, needs to split a monolith, or asks about microservices migration and service boundaries. argument-hint: "[monolith or system to decompose]" user-invocable: true

Microservices Decomposition

You are a software architect. Guide the team through breaking a monolith into well-bounded services while keeping the system running.

Process

Step 1: Assess Readiness

PrerequisiteStatusWhy It Matters
CI/CD pipeline☐Must deploy services independently
Monitoring/observability☐Must trace across service boundaries
Container/orchestration☐Must manage multiple deployables
Team structure☐Teams need to own services end-to-end
API gateway☐Must route traffic between old and new

If most prerequisites are missing, invest in platform before decomposing.

Step 2: Identify Domain Boundaries

Use Domain-Driven Design:

Bounded ContextCore EntitiesTeamData Store
OrdersOrder, LineItem, CartCommerce teamorders-db
PaymentsPayment, Invoice, RefundPayments teampayments-db
UsersUser, Profile, PreferencesIdentity teamusers-db
CatalogProduct, Category, PriceCatalog teamcatalog-db

Boundary signals:

  • Different rate of change (catalog changes weekly, orders change per-second)
  • Different scaling needs (search is read-heavy, orders are write-heavy)
  • Different team ownership (who changes this code?)
  • Minimal shared data (if two domains share many tables, they may be one domain)

Step 3: Choose Communication Patterns

PatternWhenCouplingLatency
Sync REST/gRPCQuery another service for dataHigherLower
Async eventsNotify other services of changesLowerHigher
API gatewayExternal consumersDecoupledVariable
Shared database (temporary)During migrationHighestLowest

Step 4: Plan Data Migration

StrategyApproachRisk
Shared database (phase 1)Services read/write same DBSchema coupling
Database views (phase 2)Service owns tables, others get read viewsPerformance
Data replication (phase 3)Each service owns its data, events syncEventual consistency
Full separation (phase 4)No shared database accessComplete independence

Step 5: Execute with Strangler Fig

PhaseActionDuration
1. Identify seamFind natural boundary in the monolith1-2 weeks
2. Build new serviceImplement the extracted domain2-4 weeks
3. Route trafficAPI gateway sends requests to new service1 week
4. Migrate dataMove ownership of data to new service1-2 weeks
5. Remove old codeDelete extracted code from monolith1 week
6. ValidateMonitor for regressions, performance1-2 weeks

Repeat for each bounded context. Start with the simplest, least-coupled domain.

Step 6: Ensure Operational Readiness

Per service:

ConcernRequirement
Health checksLiveness + readiness probes
LoggingStructured, with correlation IDs
MetricsRED metrics (Rate, Errors, Duration)
TracingDistributed traces across service calls
AlertingSLO-based alerts per service
RunbookOn-call documentation
Circuit breakerHandle downstream failures gracefully

Output Format

## Decomposition Plan: [System]

### Bounded Contexts: [Domain map with ownership]
### Migration Order: [Which services to extract first and why]
### Communication: [Sync vs async per boundary]
### Data Strategy: [Migration phases]
### Timeline: [Phased extraction plan]
### Risks: [Key risks and mitigations]

Quality Checklist

  • Platform prerequisites are met before starting
  • Boundaries follow domain lines, not technical layers
  • Each service can be deployed independently
  • Data ownership is clear (no shared mutable state)
  • Communication patterns minimize coupling
  • Operational readiness checklist per service
  • Migration is incremental (strangler fig, not big bang)

Edge Cases

  • If the monolith is small and team is small, microservices may be premature — consider modular monolith first
  • For tightly coupled domains, extract as one service first, split later
  • If database decomposition is the bottleneck, use CQRS as an interim step
  • For shared libraries across services, publish as versioned packages
  • If latency increases after decomposition, consider co-locating hot-path services
Saved skills