Event-Driven Architecture taste — ChatGPT prompt: what it does
Sets architectural guidelines for distributed systems: past-tense domain events, transactional outbox patterns, idempotent consumers, and sagas over two-phase commits.
Open on GitHubWhat Event-Driven Architecture taste does
This prompt sets design criteria with explicit confidence ratings for asynchronous service architectures. It strictly distinguishes facts from commands: past-tense events report what happened (OrderPlaced), while commands target a single owner (ChargeCard). Schemas require versioning through Avro, Protobuf, or JSON Schema alongside backward compatibility checks in CI.
Reliable message delivery relies on the transactional outbox pattern to prevent data divergence between databases and brokers. Consumers must handle at-least-once delivery with deduplication keys, while poison messages route to dead-letter queues after bounded retries with exponential backoff and jitter. Complex multi-step workflows switch from choreography to sagas with explicit compensating steps.
Without correlation identifiers and trace context passed in message headers, tracking requests across service boundaries breaks down.
What it helps with
- separate domain events from command requests across microservices
- prevent state divergence using the transactional outbox pattern
- design idempotent consumers with explicit deduplication keys
- replace distributed transactions with sagas and compensating actions
Example prompts for the agent
- Review this service architecture and apply the event-driven taste guidelines.
- Design an idempotent event consumer for order processing using outbox and deduplication keys.
- Structure an event envelope schema including correlation and causation identifiers.
How to install Event-Driven Architecture taste
How to use
Paste the text at the start of a chat or into project instructions
Manually: put the files in place
.claude/commands/prompts.csv.mdQuestions about Event-Driven Architecture taste
How to install Event-Driven Architecture taste in Claude Code?
Add the command to .claude/commands/prompts.csv.md. For ChatGPT, copy and paste the prompt guidelines directly into your chat or custom instructions.
What does Event-Driven Architecture taste do?
It guides models on distributed systems design, enforcing transactional outbox patterns, schema compatibility checks, deduplication keys, and sagas.
What metadata must be included in every event envelope?
Every envelope must contain the event id, type, version, timestamp, correlation id, and causation id.
Source text
prompts.csv · CC0-1.0
# Event-Driven Architecture taste of a distributed systems engineer - Use events to announce facts that already happened (OrderPlaced), and commands only for requests to a single owner (ChargeCard). Confidence: 0.90 - Name events in the past tense using domain language, never after the producing table or service. Confidence: 0.85 - Define every event with a versioned schema (Avro, Protobuf or JSON Schema) in a registry and check compatibility in CI. Confidence: 0.90 - Evolve schemas only with backward-compatible changes; publish a new event type for breaking changes. Confidence: 0.85 - Assume at-least-once delivery and make every consumer idempotent with a deduplication key. Confidence: 0.95 - Publish events through the transactional outbox pattern so database writes and messages never diverge. Confidence: 0.90 - Include event id, type, version, timestamp, correlation id and causation id in every envelope. Confidence: 0.85 - Keep event payloads self-contained enough for common consumers, but do not dump whole aggregates. Confidence: 0.75 - Partition by aggregate id when ordering matters, and never rely on global ordering. Confidence: 0.85 - Route poison messages to a dead-letter queue after bounded retries with exponential backoff and jitter. Confidence: 0.90 - Alert on consumer lag and dead-letter queue depth, not just on broker health. Confidence: 0.90 - Propagate trace context through message headers so one request can be followed across services. Confidence: 0.85 - Use sagas with explicit compensating actions for multi-service workflows instead of distributed transactions. Confidence: 0.80 - Prefer choreography for simple flows and a dedicated orchestrator once a workflow has more than a few steps. Confidence: 0.70 - Reach for event sourcing only where an audit trail or temporal queries are real requirements. Confidence: 0.75 - Make replays safe: consumers must tolerate reprocessing history from any offset. Confidence: 0.80 - Set retention to match how long consumers might need to rebuild state, and document it per topic. Confidence: 0.70 - Give each topic one owning team that controls its schema and lifecycle. Confidence: 0.85 - Keep synchronous calls for queries that need an immediate answer; do not force request-response through a queue. Confidence: 0.80 - Test consumers with contract tests against the registered schema and producers with outbox integration tests. Confidence: 0.80 - Keep a living catalog (AsyncAPI or similar) of topics, producers and consumers. Confidence: 0.75
© f · CC0-1.0 · f/prompts.chat