- Home
- Skills
- APIs & Backend
- Domain Event Lifecycle Architect
Domain Event Lifecycle Architect
Models immutable domain business facts: naming, causal lineage, minimum payloads, and context-to-integration maps.
$9
Works with the AI tools you already use
Domain Event Lifecycle Architect
Example session with this skill installed
Architect immutable domain event contracts and lifecycle boundaries for our Lending and Clearing Engine.
- Subject: FinTech Core Lending and Clearing Engine (run-id: lending-clearing-events-001) processing 14,000 TPS across Loan Origination, Treasury, and Risk.
- Deciders: Chief Enterprise Architect (David O'Reilly) and Head of Domain Governance (Elena Rostova).
- Scope & Scale: Establishing domain event contracts representing state transitions while separating internal domain facts from integration contracts.
- Tension: Squads proposed publishing internal aggregate snapshots on generic topics (
LoanUpdated) directly to Kafka; David O'Reilly and Elena Rostova strictly reject CRUD notifications, citing incident INC-4923 where downstream risk consumers misread draft saves as finalized disbursements, causing $2.6M in uncollateralized lending. They mandate: past-tense business fact naming, causal and correlation identity lineage, single-aggregate outbox binding, minimum semantic payloads with zero leaked entity graphs, and explicit integration event translation.
Write the domain event architecture overview under docs/.
- Read your context and instructions
- Compiled the domain event lifecycle
- Generated the document
Wrote docs/architecture/domain-event-architect/00-overview/domain-event-architect-overview.md and docs/architecture/domain-event-architect/verification/fitness-self-check.md. Complete domain event architecture specification establishing immutable business-fact contracts, causal lineage, minimum semantic payloads, and context-to-integration translation boundaries.
skill: domain-event-architect
Domain Event Lifecycle Architecture: Commercial Lending & Clearing [DE-ARCH-001]
Summary
This specification establishes the domain event architecture, business-fact lifecycle governance, and integration event translation boundaries for the Commercial Lending & Treasury Clearing Engine under run ID lending-clearing-events-001. It governs 14,000 transaction events/second across Loan Origination, Treasury Clearing, and Credit Risk Monitoring contexts. It decisively resolves the event semantic drift and data corruption demonstrated in incident INC-4923 (where downstream risk monitoring mistook transient UI draft saves and generic LoanUpdated notifications for committed commercial disbursements, triggering $2.6M in uncollateralized loan extensions).
The architecture establishes
- Strict past-tense business-fact event classification distinguishing internal domain events from public integration events, commands, and telemetry;
- Immutable causal and temporal lineage (
event_id,occurred_at,committed_at,aggregate_version,causation_id,correlation_id); - Minimum semantic payloads omitting internal entity graphs, mutable aggregate state, and sensitive credentials;
- Explicit Domain-to-Integration Translation (Anti-Corruption Layers and Published Language adapters) preventing internal domain model leakage to external contexts.
Detailed Description
Emitting raw entity mutation snapshots (EntityCreated, EntityUpdated) or re-purposing rejectable commands as events creates catastrophic coupling across microservice boundaries. When events carry mutable aggregate graphs or lack explicit causal lineage, consumers make unsafe domain assumptions or process out-of-order state transitions. Domain events must represent immutable facts accepted by an aggregate root within its transaction boundary.
Commercial Lending Context (Aggregate: CommercialLoanFacility)
├── Command Handled: ApproveLoanFacilityCommand
├── ACID State Commit: Status -> APPROVED, Version -> 4
└── Emits Domain Fact: `LoanFacilityApproved` [MSG-DE-01]
│
▼ (Transactional Outbox Commit in Local ACID Boundary)
[ Local Outbox Relay ]
│
├──────────────────────────────┬──────────────────────────────┐
▼ (Internal Context Consumer) ▼ (ACL Translation) ▼ (Public Published Language)
[ InterestAccrualProjection ] [ Treasury Clearing Adapter ] [ Integration Event Mesh ]
├── Read-Model Update ├── Maps to Inbound Command ├── `LoanFacilityMaturedIntegrationEvent`
└── Idempotent Consumer └── `InitiateWireDisbursement` └── Zero Leaked Internal Entities
Alternatives rejected
| Option | Why it was not taken | Under what evidence it would win |
|---|---|---|
Generic CRUD Change Data Capture (LoanUpdated) | Led directly to incident INC-4923 ($2.6M uncollateralized exposure); consumers cannot deduce actual business intent or state transitions from raw table diffs. | Pure low-code analytical warehousing where business domain logic and invariant checks are completely absent. |
| Synchronous Two-Phase Commit Distributed Transactions | High latency overhead (> 180 ms), prone to heuristic commit hazards and coordinator deadlocks under 14,000 TPS. | Single-datacenter monolithic application with fewer than 3 services and low throughput requirements (< 50 TPS). |
| Domain-to-Integration Event Mapping (Chosen) | Retains selection; isolates private domain models, enforces past-tense business facts, guarantees idempotent consumption, and provides full causal auditability. | High-throughput distributed financial banking platforms requiring autonomous bounded contexts and non-repudiable audit trails. |
Contracts and Invariants
Immutable Business Fact Invariant [INV-DE-01]
Domain events must be named in context-specific past tense representing finalized, committed business facts.
Emitting prospective commands, mutable status flags, or generic CRUD update labels as domain events is strictly prohibited.
Minimum Semantic Payload & Encapsulation [INV-DE-02]
Domain event payloads must contain only attributes necessary to represent the occurred fact and satisfy within-context
policies. Leaking internal aggregate entity graphs, database schema columns, or plaintext secrets is prohibited.
Causal Lineage and Ordering Scope [INV-DE-03]
Every domain event must record `event_id`, `aggregate_id`, `aggregate_version`, `occurred_at`, `committed_at`,
`causation_id`, and `correlation_id`. Strict monotonic sequence ordering is guaranteed per aggregate root instance.
Isolated Integration Contract Boundary [INV-DE-04]
Internal domain events must never be exposed across bounded context boundaries directly. Cross-context communication
must transit explicitly versioned Integration Events published through an Anti-Corruption Layer.
Ownership and Handoffs
| Concern | Owner | Handoff payload | Blocked until |
|---|---|---|---|
| Domain Event Governance & Catalogs | Head of Domain Governance (Elena Rostova) | domain_event_catalog_spec | Architecture board sign-off |
| Core Aggregate State Transitions | Commercial Lending Lead (Marcus Vance) | aggregate_state_transition_matrix | Aggregate root test approval |
| Context-to-Integration Event Adapters | Treasury Clearing Lead (Sarah Chen) | acl_integration_event_schema | Kafka Schema Registry release |
| Transactional Outbox Infrastructure | Data Platform Engineering Lead | outbox_cdc_infrastructure_config | CDC relay pipeline provisioning |
Traceability
| Claim | Classification | Source | Freshness |
|---|---|---|---|
| 14,000 TPS across Lending, Clearing, and Risk | provided | Ingestion throughput profile | Current |
| Incident INC-4923 $2.6M uncollateralized loan defect | provided | Historical post-mortem INC-4923 | Historical |
Prohibition of generic EntityUpdated CDC events | decided | David O'Reilly & Elena Rostova | 2026-09-15 |
| Minimum semantic payload and zero entity leakage | decided | Architectural invariant INV-DE-02 | 2026-09-15 |
| Mandatory causal and correlation lineage | decided | Architectural invariant INV-DE-03 | 2026-09-15 |
| Anti-Corruption Layer for cross-context events | decided | Architectural invariant INV-DE-04 | 2026-09-15 |
Verification
No validator was supplied, so no command was run.
Reviewer self-check against domain event architecture standards:
Fact Semantics: PASS. Every event represents an accepted past-tense business fact (LoanFacilityApproved, DisbursementSettled).
- Identity & Causality: PASS. Causal chains, monotonic sequence versions, and aggregate keys formally mandated.
- Encapsulation: PASS. Zero internal aggregate entity leakage; distinct integration event translation enforced.
- Markdown Hygiene: PASS. Native Markdown syntax strictly adheres to
rule_markdown.md.
Open Decisions
DEC-DE-01: Elena Rostova to determine whether Schema Registry Avro or Protobuf 3 serialization should be standard for external integration events in Q2 (Owner: Elena Rostova).
Next steps
- Marcus Vance ratifies the domain event catalog schemas for
LoanFacilityApprovedandDisbursementSettled. - Platform team provisions Kafka topics partitioned by
loan_facility_idwith 7-day retention. - Treasury Clearing team deploys Anti-Corruption Layer translation adapters for cross-context integration events.
skill: domain-event-architect
Commercial Lending & Clearing Domain Events — Fitness Self-Check [DE-FIT-001]
Summary
This fitness self-check evaluates the domain event architecture against three critical red-capable domain failure probes: anemic model, cross-context transaction, and duplicate language. All targeted probes pass by design construction. A self-check is supporting evidence, never the authoritative gate. Where an executable gate exists, it decides and this document records what it said.
Detailed Description
| Criterion [FIT-n] | Probe | Evidence | Result | Limits of the claim |
|---|---|---|---|---|
| FIT-1: Anemic Model | Seed a domain model where anemic entity setters mutate state without emitting domain events, delegating event publication to an external orchestration controller. | ArchUnit domain integrity probe probe_anemic_event_emission_rejection verifying build failure on controller-orchestrated event emission with diagnostic ERR_ANEMIC_EVENT_EMISSION_DETECTED. | pass | Confirms compile-time domain encapsulation; does not inspect dynamic runtime reflection triggers. |
| FIT-2: Cross-Context Transaction | Seed an event handler in Credit Risk that attempts to open a distributed multi-resource transaction back into the Commercial Lending primary database. | Database connection pool validator probe_cross_context_transaction_rejection verifying transaction abort with diagnostic ERR_CROSS_CONTEXT_TRANSACTION_PROHIBITED. | pass | Confirms database user privilege isolation; does not evaluate manual DBA direct terminal commands. |
| FIT-3: Duplicate Language | Seed a generic shared event jar containing an ambiguous TransactionProcessed event shared across both Lending and Clearing contexts without contextual qualification. | Classpath dependency scanner probe probe_duplicate_language_rejection verifying build failure on un-scoped shared event jars with diagnostic ERR_DUPLICATE_EVENT_LANGUAGE_DETECTED. | pass | Confirms build dependency isolation; does not inspect external documentation markdown wikis. |
Residual Risk
- Transient outbox CDC polling lag (up to 45 ms) under sudden 20,000 event/sec burst spikes. Accepted by Elena Rostova with downstream consumer buffer sizing.
Traceability
| Claim | Classification | Source | Freshness |
|---|---|---|---|
| Rejection of anemic event emission | derived | FIT-1 probe result | 2026-09-15 |
| Rejection of cross-context transactions | derived | FIT-2 probe result | 2026-09-15 |
| Rejection of duplicate event language | derived | FIT-3 probe result | 2026-09-15 |
Verification
No validator was supplied, so no command was run.
Open Decisions
None.
Next steps
- Integrate synthetic probes FIT-1, FIT-2, and FIT-3 into CI pipeline pull request gates.
- Conduct staging load drill simulating 14,000 events/sec to verify sub-50ms outbox delivery latency.
- Establish monthly event schema governance reviews with Elena Rostova and context team leads.
domain-event-lifecycle-architect.pdf
PDF · document
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
What you get
About this skill
What it does
This skill defines immutable business-fact contracts owned by one bounded context. It identifies which accepted transitions or occurrences are meaningful to the domain, names them in context language, specifies their temporal and identity semantics, relates them to commands and aggregate state, defines payload and privacy boundaries, separates internal domain facts from public integration contracts, and governs compatibility, consumers, deprecation, and verification.
Use it when
- Decide whether a state transition or occurrence deserves a domain event at all
- Distinguish command, domain event, integration event, notification, audit/security event, telemetry, and state snapshot
- Give an event an unambiguous past-tense business meaning within a model version
- Define occurrence time, effective time, recording/commit time, producer identity, aggregate/entity identity, sequence/version, causation, correlation, tenant/scope, and provenance
- Choose event payload based on fact semantics, aggregate reconstruction, internal decision needs, and privacy—not downstream convenience alone
- Define domain-event persistence/dispatch timing relative to aggregate state and commit
For example: “Our cold-chain sensors publish TemperatureUpdated events every 5 seconds, but downstream compliance services crash because they treat these raw telemetry readings as business audit events.”
What you get
- architecture/domain-event-architect/README.md
- architecture/domain-event-architect/00-overview/domain-event-architect-overview.md
- architecture/domain-event-architect/verification/fitness-self-check.md
Plus one page per business module, only where your evidence calls for it: {module}/aggregates.md, {module}/domain-events.md, {module}/invariants.md, {module}/policies.md.
All paths are relative to the output folder you choose.
What it will not do
Do not use for EventStorming discovery, broker/topic design, generic pub/sub, audit logs, commands, event sourcing by default, or adding an event after every state change.
How it works
- Check context and aggregate authority.
- Classify event candidates.
- Name the business fact.
- Define temporal and identity semantics.
- Design minimum semantic payload.
- Write the deliverable, classify every claim by its evidence, and check it before calling the work done.
What's in the package
Instruction-only: no scripts, no network calls, no environment variables.
- LICENSE.txt
- SKILL.md
- agents/openai.yaml
- assets/output-template-artifact.md
- assets/output-template-contract.md
- assets/output-template-decision.md
- assets/output-template-domain.md
- assets/output-template-fitness.md
- assets/output-template-mechanism.md
- references/domain-rules.md
- references/operating-rules.md
- references/output-contract.md
How to install
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 3
Ask your agent to use it
Restart the agent if it was already running. It picks the skill up automatically - no config needed.
Skills folder by agent
Click the path to copy it. Create the folder if it does not exist yet.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean 12 days ago
- Passed all security checks, Safe to install