rrezartprebreza/spring-boot-skills / skills/spring-boot-4/domain-driven-design
domain-driven-design
VerifiedUse when evolving aggregate invariants, value objects or domain events in an existing DDD-style Spring Boot 4 application, or when DDD is explicitly requested. Preserve existing API identifiers and architecture when changing domain behavior.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.4 KB |
| agents/openai.yaml | config | 205 B |
| examples/bad-aggregate.java | other | 1.5 KB |
| examples/good-aggregate.java | other | 3.2 KB |
| templates/DomainEvent.java | other | 1.3 KB |
| templates/Money.java | other | 2.6 KB |
templates/DomainEvent.java
View on GitHubpackage com.example.common.domain;
import java.time.Instant;
import java.util.UUID;
/**
* Base interface for all domain events.
* Events are immutable facts about something that happened in the domain.
*/
public interface DomainEvent {
UUID eventId();
Instant occurredAt();
}
// --- Concrete domain events as records ---
package com.example.order.domain.event;
import com.example.common.domain.DomainEvent;
import com.example.order.domain.model.CustomerId;
import com.example.order.domain.model.Money;
import com.example.order.domain.model.OrderId;
import java.time.Instant;
import java.util.UUID;
public record OrderPlaced(
UUID eventId,
Instant occurredAt,
OrderId orderId,
CustomerId customerId,
Money total
) implements DomainEvent {
public static OrderPlaced of(Order order) {
return new OrderPlaced(
UUID.randomUUID(),
Instant.now(),
order.getId(),
order.getCustomerId(),
order.getTotal()
);
}
}
public record OrderCancelled(
UUID eventId,
Instant occurredAt,
OrderId orderId,
CustomerId customerId,
String reason
) implements DomainEvent {
public OrderCancelled(OrderId orderId, CustomerId customerId, String reason, Instant occurredAt) {
this(UUID.randomUUID(), occurredAt, orderId, customerId, reason);
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |