AI can accelerate event-driven design significantly -- but it has specific blind spots you need to know about.
Where AI helps vs. where it struggles
| Task | AI quality | Why |
|---|---|---|
| Generating event schema definitions | High | Well-defined structure, lots of training examples |
| Writing boilerplate consumers | High | Repetitive pattern, AI has seen thousands |
| Mapping a business flow to saga steps | Medium-High | Good at decomposition, may miss edge cases |
| Choosing orchestration vs choreography | Medium | Gives reasonable advice but may not weigh your team's specific context |
| Designing idempotency strategies | Medium | Knows the patterns but may not catch all duplicate scenarios |
| Predicting failure modes | Low-Medium | Tends toward happy path, underestimates real-world chaos |
| Handling eventual consistency in UI | Low | Context-dependent, requires understanding of user expectations |
| Sizing partitions, choosing retention | Low | Requires production data and workload knowledge AI doesn't have |
Prompt: designing event schemas
I'm building an e-commerce order system with these services:
- Order Service (creates and manages orders)
- Payment Service (processes payments)
- Inventory Service (manages stock)
- Notification Service (sends emails/SMS)
Design the domain events for the order lifecycle from placement to delivery.
For each event, include:
- Event name (past tense)
- Payload fields with types
- Which service produces it
- Which services consume it
Use TypeScript interfaces. Include metadata fields
(id, timestamp, correlationId, version).What to verify: Check that each event payloadWhat is payload?The data sent in the body of an HTTP request, such as the JSON object you include when creating a resource through a POST request. has enough data for consumers to work independently (event-carried state transfer). Also check that it included failure events (PaymentFailed, InventoryReservationFailed), not just the happy path.
Prompt: implementing a sagaWhat is saga?A pattern for coordinating multi-service operations where each step has a compensating undo action that runs if a later step fails. orchestrator
I need a Saga orchestrator for this order flow:
1. Create order (Order Service)
2. Process payment (Payment Service)
3. Reserve inventory (Inventory Service)
4. Send confirmation (Notification Service)
Requirements:
- Each step can fail
- On failure, compensate all completed steps in reverse
- Log every step for debugging
- Handle compensation failures (alert ops team)
Write the orchestrator in TypeScript. Include the compensation
logic for each step.What to verify:
- Does it handle compensation failures? If the refund fails during compensation, does it retry or alert?
- Does it persist saga state? If the orchestrator crashes mid-execution, can it resume?
- Does it handle timeouts? What if the payment service takes 30 seconds to respond?
Prompt: choosing orchestration vs choreography
I have this business flow for user onboarding:
1. Create user account
2. Send welcome email
3. Create default workspace
4. Initialize billing (free trial)
5. Track analytics event
Should I use saga orchestration or choreography?
Consider: team size (4 developers), services (3 microservices),
expected changes (steps may be added/removed quarterly).
Give me the tradeoffs for this specific case.Push back and ask "what would go wrong with the other approach?" to get a balanced view.
What to verify: AI overlooks team dynamics. If your team of 4 developers owns all 3 services, choreography's decoupling benefit matters less because the same people write all the services. Orchestration might be simpler for a small team.
What AI gets wrong about event systems
1. Happy-path bias
AI designs work perfectly on the happy path. Ask "what happens if PaymentProcessed arrives before OrderPlaced?" and the design often has no answer.
Fix: After AI generates a design, ask: "List every way this system can fail, including duplicate delivery, out-of-order events, and service crashes. For each failure, show how the system recovers."
2. Over-engineering
Ask for a simple notification system and you might get full CQRSWhat is cqrs?Command Query Responsibility Segregation - using separate models for read and write operations so each can be optimized independently. with event sourcing and three message brokers. A RESTWhat is rest?An architectural style for web APIs where URLs represent resources (nouns) and HTTP methods (GET, POST, PUT, DELETE) represent actions on those resources. call might be perfectly adequate for a startup with 100 users.
Fix: Include constraints: "This system handles 50 orders per day. We have 2 developers. Recommend the simplest architecture that works."
3. Missing operational concerns
AI rarely addresses: Who monitors the dead letter queueWhat is dead letter queue?A holding area for messages that failed processing too many times, letting you inspect and fix them later without blocking the main flow.? What alerts fire when consumer lag exceeds 5 seconds? How do you replay events after a bug fix?
Fix: Ask separately: "What monitoring, alerting, and operational runbooks do I need for this event-driven system?"
Hybrid workflow: designing event systems with AI
Step 1: Business flow mapping (you) -- Write out the flow in plain language. Identify services, data needs, and order of operations. This is domain knowledge AI cannot generate.
Step 2: SchemaWhat is schema?A formal definition of the structure your data must follow - which fields exist, what types they have, and which are required. generation (AI) -- Give AI the business flow and ask for event schemas, sagaWhat is saga?A pattern for coordinating multi-service operations where each step has a compensating undo action that runs if a later step fails. steps, and consumer skeletons. This is where AI saves you the most time.
Step 3: Failure mode analysis (you + AI) -- List every failure scenario you can think of. Then ask AI: "What other failure modes am I missing?" Review critically.
Step 4: Consistency strategy (you) -- Decide which reads can tolerate eventual consistencyWhat is eventual consistency?A guarantee that all copies of data will converge to the same value given enough time, rather than being instantly synchronized after every write. and which need strong consistency. This requires product knowledge AI does not have.
Step 5: Code review (AI) -- Have AI review your consumer implementations for idempotency, error handling, and edge cases.
Step 6: Operational planning (you + AI) -- Ask AI to suggest monitoring and alerting. Filter through your team's operational capacity.
The pattern: AI generates structure and boilerplateWhat is boilerplate?Repetitive, standardized code that follows a known pattern and appears in nearly every project - like setting up a server or wiring up database connections., you make design decisions that require business context. Together, you move faster than either could alone.