Loading...
Loading...
Identifies domain modules, ownership boundaries, dependencies, and interfaces using Domain-Driven Design principles. Provides domain maps, bounded contexts, refactor recommendations. Use for "DDD", "domain modeling", "bounded contexts", or "service boundaries".
npx skill4agent add patricio0312rev/skills domain-model-boundaries-mapper# Domain Map: E-Commerce Platform
## Bounded Contexts
### 1. Customer Management
**Core Domain:** User accounts, profiles, preferences
**Owner:** Customer Team
**Ubiquitous Language:**
- Customer: Registered user with account
- Profile: Customer personal information
- Preferences: User settings and choices
**Entities:**
- Customer (id, email, name)
- Address (id, customer_id, street, city)
- PaymentMethod (id, customer_id, type, token)
**Bounded Context Diagram:**
### 2. Order Management
**Core Domain:** Order processing, fulfillment
**Owner:** Orders Team
**Ubiquitous Language:**
- Order: Purchase request with line items
- LineItem: Product quantity in order
- Fulfillment: Physical delivery of order
**Entities:**
- Order (id, customer_id, status, total)
- LineItem (id, order_id, product_id, quantity)
- Shipment (id, order_id, tracking_number)
### 3. Product Catalog
**Core Domain:** Product information, inventory
**Owner:** Catalog Team
**Ubiquitous Language:**
- Product: Sellable item
- SKU: Stock keeping unit
- Inventory: Available stock
**Entities:**
- Product (id, name, price, description)
- Inventory (sku, quantity, warehouse_id)
## Context Relationships
## Anti-Corruption Layers
### Order Management → Customer Management
**Problem:** Orders need customer data but shouldn't depend on Customer domain model
**Solution:** Customer Adapter
```typescript
// Order domain's view of customer
interface CustomerForOrder {
id: string;
shippingAddress: Address;
billingAddress: Address;
}
// Adapter translates Customer domain to Order domain
class CustomerAdapter {
async getCustomerForOrder(customerId: string): Promise<CustomerForOrder> {
const customer = await customerService.getCustomer(customerId);
return {
id: customer.id,
shippingAddress: this.toOrderAddress(customer.defaultShippingAddress),
billingAddress: this.toOrderAddress(customer.defaultBillingAddress),
};
}
}┌──────────────┐
│ Customer │
└──────┬───────┘
│
▼
┌──────────────┐ ┌────────────┐
│ Orders │─────▶│ Products │
└──────┬───────┘ └────────────┘
│
▼
┌──────────────┐
│ Fulfillment │
└──────────────┘// Public interface exposed by Customer domain
interface CustomerService {
getCustomer(id: string): Promise<Customer>;
getCustomerAddresses(id: string): Promise<Address[]>;
}
// Events published
interface CustomerUpdated {
customerId: string;
email: string;
name: string;
}interface ProductService {
getProduct(id: string): Promise<Product>;
checkAvailability(sku: string, quantity: number): Promise<boolean>;
reserveInventory(items: ReservationRequest[]): Promise<Reservation>;
}// ❌ Before: Direct database access
const customer = await db.customers.findById(customerId);
// ✅ After: API call through adapter
const customer = await customerAdapter.getCustomerForOrder(customerId);User// Customer context
interface Customer {
id: string;
email: string;
profile: CustomerProfile;
preferences: CustomerPreferences;
}
// Order context (different model!)
interface OrderCustomer {
id: string;
shippingAddress: Address;
billingAddress: Address;
}OrderService// Shared kernel (minimal!)
class Money {
constructor(public amount: number, public currency: string) {}
}interface ProductCreated {
productId: string;
name: string;
price: Money;
publishedAt: Date;
}