Implement DDD patterns in Quarkus alongside the relevant ddd-* skills, never instead of them. Use when implementing or reviewing aggregates, value objects, repositories, application services, domain events, or bounded contexts in a Quarkus/Jakarta codebase. Covers package layout and ArchUnit boundary tests, JPA mirrors behind Panache repositories, CDI wiring, @Transactional on application services, @Version locking and HTTP 409 mapping, after-commit CDI TransactionPhase observers, transactional outbox to Kafka, and test tiers. Also trigger on PanacheEntity or @Entity on a domain type, a PanacheRepository used as the domain repository interface, QuarkusTransaction or @Transactional outside application services, Emitter or CDI Event injected into the domain, or @QuarkusTest on a domain test. Not for DDD design rules (the ddd-* skills) or for project creation, versions, and extension management (quarkus-app).
97%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
The Quarkus tier under the ddd-* skills. Those skills decide what (layers, aggregate shape, repository contract, who owns the transaction, when events are delivered). This skill decides how Quarkus does it. If a rule here appears to conflict with a ddd-* rule, the ddd-* rule wins and this file has a bug.
Load order. quarkus-app first (the project exists, extensions are aligned), then the ddd-* skill for the concern at hand, then this file, then exactly one reference file from references/ for the concern being implemented.
Red Flags — STOP if you find yourself thinking:
PanacheEntity." (The aggregate is a plain object; Panache belongs on the infrastructure side.)PanacheRepository<OrderEntity> alone is the repository." (The domain interface is hand-written and speaks domain types; the infrastructure class implements both it and PanacheRepositoryBase.)persist call in QuarkusTransaction.requiringNew() and publish the event afterwards." (The transaction is the application-service method; delivery is after commit by mechanism, not by call ordering.)@Transactional on the repository method, to be safe." (Repositories never demarcate — ddd-persistence Rule 12.)@QuarkusTest." (If it does, the domain type has a framework dependency; fix the type.)@Entity with an @Id." (A value object has no identity — @Embeddable or columns on the mirror.)| Concern | Default | Alternative (say why) |
|---|---|---|
| Java | 25 (per quarkus-app) | — |
| HTTP | Quarkus REST + Jackson (rest-jackson) | Reactive routes |
| Persistence | Hibernate ORM with Panache (hibernate-orm-panache, jdbc-postgresql): the infrastructure repository class implements the domain interface and PanacheRepositoryBase<Record, UUID> | getEntityManager() for the one verb Panache lacks (merge); never a Panache-only repository as the domain contract |
| Events in-process | CDI Event<T> fired by the application service; handlers @Observes(during = TransactionPhase.AFTER_SUCCESS) | — |
| Events cross-service | Transactional outbox row → @Scheduled relay → Reactive Messaging Emitter (messaging-kafka, scheduler) | Debezium outbox extension |
| Tests | JUnit 5; @QuarkusTest + Dev Services; REST Assured | Testcontainers directly |
| Boundary enforcement | ArchUnit test per bounded context (archunit-junit5, test scope) | Maven multi-module, one module per layer |
Extension bundle for a DDD-shaped service — add via quarkus ext add, never by hand (quarkus-app):
rest-jackson, hibernate-orm-panache, jdbc-postgresql, plus messaging-kafka, scheduler when events leave the service. hibernate-validator is for api-layer request types only; value objects validate themselves (ddd-value-objects).
Single Maven module; packages mirror the ddd-foundations layers exactly:
{base}.{bc}.domain # aggregates, value objects, domain services, repository interfaces, events
{base}.{bc}.application # application services, commands, DTOs
{base}.{bc}.infrastructure # JPA mirrors, Panache-backed repository implementations, outbox, Kafka adapters
{base}.{bc}.api # Quarkus REST resources, request/response types, exception mappersNo persistence/ package and no domain/services/ package: ddd-foundations has four layers and this skill does not add a fifth. Boundaries are enforced by an ArchUnit test (references/architecture-tests.md), not by review.
@jakarta.transaction.Transactional on the public method of a *ApplicationService in application. Nowhere else: not on resources, repositories, domain services, or aggregates. Prefer the annotation over QuarkusTransaction; use the programmatic API only for a boundary the annotation cannot express, and say why in a comment.@ApplicationScoped on application services, domain services, and repository implementations; constructor injection. Domain types other than domain services carry no CDI annotations.@Entity, @Table, @Id UUID, @Version long, column mappings go on OrderRecord in infrastructure; fields private, with static fromDomain(Order) and toDomain() beside them. Value objects map to @Embeddable types or to columns — never to their own @Entity with an @Id (ddd-value-objects Rule 7).class OrderRepository implements com.example.orders.domain.OrderRepository, PanacheRepositoryBase<OrderRecord, UUID> (same simple name as the interface — ddd-persistence Rule 3). Domain methods are implemented with Panache verbs: findByIdOptional, deleteById, findAll(Sort)…page(...).list(), count(), update("… where id = ?1", id). toDomain() calls the aggregate's rehydrate(...). The two findById/persist overloads (domain-typed vs Panache-typed) coexist on the class; only the domain-typed ones are on the interface.merge + flush. persist(Order) maps to a detached mirror carrying the aggregate's version, then getEntityManager().merge(record) (Panache has no merge verb) and flush(). Flushing inside the repository makes the compare-and-set fail here, in the application service's call, rather than wrapped at commit.jakarta.persistence.OptimisticLockException in the repository implementation and rethrow the bounded context's domain ConcurrencyConflictException (ddd-persistence Rule 7); an @ServerExceptionMapper in api maps it to 409 Conflict. The domain exception is the only thing that crosses layers, and the mapper is the one api type allowed to name it (the ArchUnit test ignores exactly that dependency).pullPendingEvents() and fires each through CDI Event<DomainEvent> inside its transaction. In-process handlers observe with during = TransactionPhase.AFTER_SUCCESS and delegate to an application service whose method is @Transactional(REQUIRES_NEW) — during AFTER_SUCCESS the completed publisher transaction is still associated with the thread, so plain REQUIRED would join it instead of opening the handler's own. Right timing, but in-memory: a crash after commit loses the event, so use it only where that is tolerable. Cross-service delivery, and any event that must not be lost, writes an outbox row in the same transaction; a relay publishes via Emitter. Never Emitter.send(...) from application.application.properties (mp.messaging.outgoing.{bc}.*). Topic payloads are integration events (ddd-domain-events Rule 9), mapped from domain events in infrastructure — the domain event type is not the wire format.domain: plain JUnit 5, no Quarkus. application: @QuarkusTest with Dev Services PostgreSQL and the real repository implementation. api: @QuarkusTest + REST Assured. A domain type never needs @QuarkusTest; if it does, it has a framework dependency — fix the type.api and infrastructure. io.quarkus.logging.Log at DEBUG at adapter boundaries; nothing in domain or application.Load exactly one, for the concern being implemented. Each exercises the numbered Core Rules of the matching ddd-* skill and cites them.
| Implementing… | Read | Pairs with |
|---|---|---|
| A new bounded context's package tree, resource, application service, repository wiring | references/foundations.md | ddd-foundations |
| An application-service / domain-service split, transaction and event hand-off | references/services.md | ddd-services |
A repository, mirror, @Version, 409 mapping, use-case-optimal query | references/persistence.md | ddd-persistence |
Event delivery: AFTER_SUCCESS observers, outbox, Kafka config, integration events | references/domain-events.md | ddd-domain-events |
| The ArchUnit layer test for a bounded context | references/architecture-tests.md | ddd-foundations |
Aggregate and value-object code is stack-neutral Java and stays in ddd-aggregates/references/canonical-example-java.md and ddd-value-objects/references/canonical-example-java.md.
@Transactional appears only on *ApplicationService methods in application.jakarta.persistence, io.quarkus, org.eclipse.microprofile, jakarta.ws.rs, or jakarta.transaction import under domain (ArchUnit enforces).PanacheRepositoryBase appears only on the infrastructure class that implements it, under the same simple name.@Embeddable or columns; no @Entity with its own @Id for a value object.persist = merge + flush; OptimisticLockException is translated in infrastructure; api maps the domain exception to 409.Event<T> with AFTER_SUCCESS observers or an outbox; no Emitter.send in application.@QuarkusTest.ddd-foundations, ddd-aggregates, ddd-value-objects, ddd-services, ddd-persistence, ddd-domain-events — the design rules this skill implements. Written against ddd-skills 1.x; Core Rule numbers cited in references/ refer to that version.quarkus-app — creating the project, choosing the platform version, adding extensions.jeremyrdavis/agentic-skills-for-quarkus
c0aa65a
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.