Agent skill

Domain Driven Design

by rrezartprebreza in rrezartprebreza/spring-boot-skills

A skill your agent uses when evolving aggregate invariants, value objects or domain events in an existing DDD-style Spring Boot 3 application, or when DDD is explicitly requested.

MITAuto-check passedDevelopment

Install Domain Driven Design

skills CLI
$ npx skills add rrezartprebreza/spring-boot-skills --skill domain-driven-design -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install rrezartprebreza/spring-boot-skills domain-driven-design --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/rrezartprebreza/spring-boot-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/spring-boot-3/domain-driven-design .claude/skills/domain-driven-design && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
domain-driven-design
GitHub stars
301
Token cost
~2.1k tokens
SKILL.md length
403 words
Files
6
Skills in repo
51
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when evolving aggregate invariants, value objects or domain events in an existing DDD-style Spring Boot 3 application, or when DDD is explicitly requested.

  • Evolving aggregate invariants
  • SKILL.md covers Aggregate Rules, Value Objects, Domain Events and Specifications (complex queries), plus 4 more sections
  • Runs Java scripts from its folder
  • Domain events in an existing DDD-style Spring Boot 3 application

What it does

Domain Driven Design is an agent skill from rrezartprebreza/spring-boot-skills. Use when evolving aggregate invariants, value objects or domain events in an existing DDD-style Spring Boot 3 application, or when DDD is explicitly requested. Preserve existing API identifiers and architecture when changing domain behavior.

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files (for example `agents/openai.yaml`).

It sits in Development, covering Domain-driven design and Backend development. It works with Spring Boot. The repository describes itself as: Production-grade Claude Code and Codex skills for Spring Boot developers. The licence is MIT.

When your agent uses it

  • Evolving aggregate invariants
  • Domain events in an existing DDD-style Spring Boot 3 application
  • DDD is explicitly requested

Example prompts

  • “/domain-driven-design”

What it can do on your machine

Read from SKILL.md and the folder at commit f0c06a0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Java), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • docs.spring.io

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Domain Driven Design loads about 2.1k tokens when it runs. Until then it costs about 66 tokens; SKILL.md has 403 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~66
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from rrezartprebreza/spring-boot-skills at commit f0c06a0, republished under its MIT licence (© rrezartprebreza). 403 words, ~2,085 tokens.

Download SKILL.mdSave it as .claude/skills/domain-driven-design/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
domain-driven-design
description
Use when evolving aggregate invariants, value objects or domain events in an existing DDD-style Spring Boot 3 application, or when DDD is explicitly requested. Preserve existing API identifiers and architecture when changing domain behavior.

Domain-Driven Design

Aggregate Rules

  • One repository per aggregate root
  • External code only accesses aggregate through root — never child entities directly
  • Prefer references by ID across aggregate boundaries; preserve deliberate mappings.
  • Choose boundaries from invariants that must commit atomically and expected contention, not a fixed number of child entities. Splitting requires an explicit consistency plan.

The snippets are illustrative and require the application's domain types and imports. Keep existing public identifiers and persistence mappings unless the task includes a migration.

java
// ✅ Aggregate root controls all access to children
order.addItem(productId, quantity); // through root
order.removeItem(itemId);           // through root

// ❌ Direct child access from outside
order.getItems().add(new OrderItem(...)); // bypasses invariants

Value Objects

Immutable, no identity, equality by value:

java
public record Money(BigDecimal amount, Currency currency) {
    public Money {
        if (amount.compareTo(BigDecimal.ZERO) < 0)
            throw new IllegalArgumentException("Amount cannot be negative");
        Objects.requireNonNull(currency);
    }

    public Money add(Money other) {
        if (!currency.equals(other.currency))
            throw new CurrencyMismatchException(currency, other.currency);
        return new Money(amount.add(other.amount), currency);
    }

    public static Money of(String amount, String currency) {
        return new Money(new BigDecimal(amount), Currency.getInstance(currency));
    }
}

public record EmailAddress(String value) {
    public EmailAddress {
        if (!value.matches("^[\\w.-]+@[\\w.-]+\\.[a-z]{2,}$"))
            throw new InvalidEmailException(value);
    }
}

Domain Events

java
// Event — immutable record
public record OrderPlaced(OrderId orderId, CustomerId customerId, Money total, Instant occurredAt) {
    public static OrderPlaced of(Order order) {
        return new OrderPlaced(order.getId(), order.getCustomerId(), order.getTotal(), Instant.now());
    }
}

// Collect events in aggregate, publish after save
@Entity
public class Order {
    @Transient
    private final List<Object> domainEvents = new ArrayList<>();

    public void place() {
        this.status = OrderStatus.PLACED;
        domainEvents.add(OrderPlaced.of(this));
    }

    public List<Object> pullDomainEvents() {
        var events = List.copyOf(domainEvents);
        domainEvents.clear();
        return events;
    }
}

// Publish inside the transaction; save() is not commit.
@Service
@RequiredArgsConstructor
public class OrderApplicationService {
    private final OrderRepository orderRepository;
    private final ApplicationEventPublisher eventPublisher;

    @Transactional
    public Order placeOrder(PlaceOrderCommand command) {
        Order order = orderRepository.findById(command.orderId()).orElseThrow();
        order.place();
        Order saved = orderRepository.save(order);
        saved.pullDomainEvents().forEach(eventPublisher::publishEvent); // commit-bound listener below
        return saved;
    }
}

// Listen to events — bind to commit, not just publish.
// @EventListener fires synchronously inside the TX; if the TX later rolls back you've
// already sent the email. AFTER_COMMIT avoids rollback delivery but is best effort.
@Component
@RequiredArgsConstructor
public class OrderPlacedHandler {
    private final EmailService emailService;

    @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
    public void onOrderPlaced(OrderPlaced event) {
        emailService.sendOrderConfirmation(event.customerId(), event.orderId());
    }
}

Let Spring Data publish for you. Instead of calling pullDomainEvents() by hand, expose a @DomainEvents method (returns the collected events) and an @AfterDomainEventPublication method (clears them) on the aggregate root. Spring Data's repository drains and publishes them automatically on every save() — no manual wiring in the service.

Neither publication mechanism guarantees durable delivery. For required external effects, persist an outbox entry with the aggregate change or use a persistent publication registry, with idempotent consumers and retry/recovery. @Async changes execution, not durability. Post-commit database writes need a new transaction because the original resources may still be bound after completion. See transaction boundaries, messaging and Modulith.

Specifications (complex queries)

java
public class OrderSpecifications {
    public static Specification<Order> byStatus(OrderStatus status) {
        return (root, query, cb) -> cb.equal(root.get("status"), status);
    }

    public static Specification<Order> byCustomer(UUID customerId) {
        return (root, query, cb) -> cb.equal(root.get("customerId"), customerId);
    }

    public static Specification<Order> placedAfter(Instant date) {
        return (root, query, cb) -> cb.greaterThan(root.get("placedAt"), date);
    }
}

// Compose
Specification<Order> spec = OrderSpecifications.byStatus(PLACED)
    .and(OrderSpecifications.byCustomer(customerId))
    .and(OrderSpecifications.placedAfter(lastWeek));

orderRepository.findAll(spec, pageable);

Anti-Corruption Layer (ACL)

  • When integrating with external systems or legacy code, don't let their models leak into your domain
  • Create an ACL — a translation layer that converts external data to your domain language
  • ACL lives in infrastructure layer, not domain
java
// ✅ GOOD — ACL translates external payment API to domain concepts
@Component
@RequiredArgsConstructor
public class PaymentGatewayAdapter implements PaymentPort {

    private final ExternalPaymentClient client;  // third-party SDK

    @Override
    public PaymentConfirmation charge(OrderId orderId, Money amount) {
        // Translate domain → external
        PaymentApiRequest apiRequest = new PaymentApiRequest(
            orderId.value().toString(),
            amount.amount(), // illustrative provider accepts BigDecimal
            amount.currency().getCurrencyCode());

        // Call external system
        PaymentApiResponse apiResponse = client.charge(apiRequest);

        // Translate external → domain
        return new PaymentConfirmation(
            PaymentId.of(apiResponse.getTransactionId()),
            apiResponse.isSuccessful() ? PaymentStatus.CONFIRMED : PaymentStatus.DECLINED);
    }
}

Use the provider's exact monetary representation. For integer minor units, convert with the currency's fraction digits and exact arithmetic; do not silently round or convert money to binary floating point.

Show full SKILL.md (137 more words)Show less

Verification

Test aggregate invariants, rollback preventing external notification, and recovery from a crash after commit for durable publication. Verify that existing API IDs and database relationships remain compatible with the requested change.

Gotchas

  • Agent creates anemic models with only getters/setters — put behavior on domain objects
  • Agent replaces existing Long/UUID API IDs with value objects - preserve the public contract; map internal types explicitly.
  • Agent puts domain logic in services — services should orchestrate, not decide
  • Agent accesses child entities directly from outside — always go through aggregate root
  • Agent confuses save with commit - publish in the transaction and select listener/durable delivery semantics deliberately.
  • Agent splits an aggregate at an arbitrary child count - derive boundaries from business invariants.
  • Agent lets external API models into domain — use an Anti-Corruption Layer to translate

Official sources

© rrezartprebreza, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files in skills/spring-boot-3/domain-driven-design of rrezartprebreza/spring-boot-skills.

  • SKILL.md
  • agents/openai.yaml
  • examples/bad-aggregate.java
  • examples/good-aggregate.java
  • templates/DomainEvent.java
  • templates/Money.java

Open the folder on GitHubat commit f0c06a0

Compare with similar skills

Domain Driven Design next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Domain Driven Design compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Domain Driven Design this skillrrezartprebreza/spring-boot-skills301—~2.1kAutomated safety check: PassMIT
Clean Architecturegiuseppe-trisciuoglio/developer-kit357—~4kAutomated safety check: NotesMIT
Spring Boot Project Creatorgiuseppe-trisciuoglio/developer-kit357—~3.4kAutomated safety check: NotesMIT
Groovy 5 Developer Guideapache/grails-core2.9k—~3kAutomated safety check: PassApache-2.0
Bootui Java Developmentjdubois/boot-ui314—~1.3kAutomated safety check: PassApache-2.0
Ij Debuggerxpinjection/test-driven-spring-boot112—~6.4kAutomated safety check: PassMIT

Similar skills

  • Clean Architecture

    giuseppe-trisciuoglio/developer-kit

    Provides implementation patterns for Clean Architecture, Hexagonal Architecture (Ports & Adapters), and Domain-Driven Design in Java 21+ Spring Boot 3.5+ applications.

    357 GitHub stars~4k tokensUpdated 1 mo ago
    DevelopmentAuto-check: notes
  • Spring Boot Project Creator

    giuseppe-trisciuoglio/developer-kit

    Creates and scaffolds a new Spring Boot project (3.x or 4.x) by downloading from Spring Initializr, generating package structure (DDD or Layered architecture), configuring JPA, SpringDoc OpenAPI…

    357 GitHub stars~3.4k tokensUpdated 1 mo ago
    Backend & APIsAuto-check: notes
  • Groovy 5 Developer Guide

    apache/grails-core

    Guidance for Groovy 5 work in Grails projects: syntax, closures, traits, DSLs, metaprogramming, Spock tests, static compilation and Java 21 integration.

    2.9k GitHub stars~3k tokensUpdated today
    DevelopmentAuto-check passed
  • A skill your agent uses when implementing, debugging, refactoring, or testing existing BootUI Java code, including framework-neutral engine logic, Spring MVC and WebFlux adapters, Quarkus runtime…

    314 GitHub stars~1.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Ij Debugger

    xpinjection/test-driven-spring-boot

    Debugger-first runtime root-cause analysis for JVM code in IntelliJ IDEA.

    112 GitHub stars~6.4k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Readme Generate

    Juncai22/spring-ai-agent-learning

    Generates comprehensive README.md files for Spring Boot modules based on task specification requirements

    124 GitHub stars~2.2k tokensUpdated 2 mo ago
    DevelopmentAuto-check passed

More from rrezartprebreza/spring-boot-skills

All 51 skills in this repo
  • AI Observability

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when adding Spring AI-specific model observations, token usage, latency, externally configured cost attribution, advisor telemetry, or protected prompt and completion logging.

    301 GitHub stars~1.6k tokensUpdated 19 days ago
    Auto-check passed
  • API Versioning

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when versioning Spring MVC or WebFlux APIs in Spring Boot 3 / Spring Framework 6.

    301 GitHub stars~516 tokensUpdated 19 days ago
    Auto-check passed
  • API Versioning

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when versioning Spring MVC or WebFlux APIs in Spring Boot 4 / Spring Framework 7.

    301 GitHub stars~643 tokensUpdated 19 days ago
    Auto-check passed
  • Container Native Deployment

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when packaging a Spring Boot 3 application as an OCI image or GraalVM native executable.

    301 GitHub stars~781 tokensUpdated 19 days ago
    Auto-check passed
  • Container Native Deployment

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when packaging Spring Boot 4 as an OCI image, JVM container, AOT application, or GraalVM native executable.

    301 GitHub stars~706 tokensUpdated 19 days ago
    Auto-check passed
  • Domain Driven Design

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when evolving aggregate invariants, value objects or domain events in an existing DDD-style Spring Boot 4 application, or when DDD is explicitly requested.

    301 GitHub stars~2.1k tokensUpdated 19 days ago
    Auto-check passed

Works with

Questions about Domain Driven Design

What does Domain Driven Design do?

A skill your agent uses when evolving aggregate invariants, value objects or domain events in an existing DDD-style Spring Boot 3 application, or when DDD is explicitly requested. Domain Driven Design is an agent skill from rrezartprebreza/spring-boot-skills. Use when evolving aggregate invariants, value objects or domain events in an existing DDD-style Spring Boot 3 application, or when DDD is explicitly requested.

When should I use Domain Driven Design?

Domain Driven Design fits situations like: evolving aggregate invariants; domain events in an existing DDD-style Spring Boot 3 application; DDD is explicitly requested.

How do I install Domain Driven Design in Claude Code?

Run `npx skills add rrezartprebreza/spring-boot-skills --skill domain-driven-design -a claude-code`. Or copy the skill folder (skills/spring-boot-3/domain-driven-design in rrezartprebreza/spring-boot-skills) into .claude/skills/domain-driven-design in your project. Claude Code loads it when a task matches its description.

How do I install Domain Driven Design in Codex?

Run `npx skills add rrezartprebreza/spring-boot-skills --skill domain-driven-design -a codex`. Or copy the skill folder (skills/spring-boot-3/domain-driven-design in rrezartprebreza/spring-boot-skills) into .agents/skills/domain-driven-design in your project. Codex loads it when a task matches its description.

Can I use Domain Driven Design in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add rrezartprebreza/spring-boot-skills --skill domain-driven-design -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/domain-driven-design, .gemini/skills/domain-driven-design, .github/skills/domain-driven-design and .opencode/skills/domain-driven-design in your project.

What does Domain Driven Design need to run?

Going by SKILL.md and its folder, Domain Driven Design needs Java for the scripts in its folder.

Does Domain Driven Design access the network?

SKILL.md names 1 domain. As links in the text: docs.spring.io. This is read from the text; nothing was executed.

Is Domain Driven Design safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Domain Driven Design use?

Domain Driven Design is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Domain Driven Design use?

About 2.1k tokens (SKILL.md is roughly 8.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Domain Driven Design?

Skills that share tags, products or a category with Domain Driven Design: Clean Architecture (giuseppe-trisciuoglio/developer-kit, 357 stars), Spring Boot Project Creator (giuseppe-trisciuoglio/developer-kit, 357 stars), Groovy 5 Developer Guide (apache/grails-core, 2.9k stars) and Bootui Java Development (jdubois/boot-ui, 314 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Domain Driven Design?

rrezartprebreza (a GitHub user) maintains it in rrezartprebreza/spring-boot-skills, which has 301 GitHub stars. The repository holds 51 skills in this directory. The repository was last updated on September 21, 2026.

Source: rrezartprebreza/spring-boot-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.