Use when you have a written implementation plan to execute in a separate session with review checkpoints
npx skills add DonggangChen/antigravity-agentic-skills --skill "event_driven"
Install specific skill from multi-skill repository
# Description
Structure systems around asynchronous, event-based communication to decouple producers and consumers for improved scalability and resilience. Use when building loosely coupled systems with asynchronous message-based communication.
# SKILL.md
name: event_driven
router_kit: FullStackKit
description: Structure systems around asynchronous, event-based communication to decouple producers and consumers for improved scalability and resilience. Use when building loosely coupled systems with asynchronous message-based communication.
version: 1.0.0
category: architectural-pattern
tags: [architecture, asynchronous, automation, best practices, clean code, coding, collaboration, compliance, debugging, decoupling, design patterns, development, documentation, efficiency, event driven, event-driven, git, optimization, productivity, programming, project management, quality assurance, refactoring, resilience, scalability, software engineering, standards, testing, utilities, version control, workflow]
dependencies: []
tools: [message-broker, event-stream-processor, distributed-tracing]
usage_patterns:
- paradigm-implementation
- real-time-processing
- system-extensibility
complexity: high
estimated_tokens: 800
metadata:
skillport:
category: auto-healed
tags:
- event_driven
- event_driven
The Event-Driven Architecture Paradigm
When to Employ This Paradigm
- For real-time or bursty workloads (e.g., IoT, financial trading, logistics) where loose coupling and asynchronous processing are beneficial.
- When multiple, distinct subsystems must react to the same business or domain events.
- When system extensibility is a high priority, allowing new components to be added without modifying existing services.
Adoption Steps
- Model the Events: Define canonical event schemas, establish a clear versioning strategy, and assign ownership for each event type.
- Select the Right Topology: For each data flow, make a deliberate choice between choreography (e.g., a simple pub/sub model) and orchestration (e.g., a central controller or saga orchestrator).
- Engineer the Event Platform: Choose the appropriate event brokers or message meshes. Configure critical parameters such as message ordering, topic partitions, and data retention policies.
- Plan for Failure Handling: Implement robust mechanisms for handling message failures, including Dead-Letter Queues (DLQs), automated retry logic, idempotent consumers, and tools for replaying events.
- Instrument for Observability: Implement comprehensive monitoring to track key metrics such as consumer lag, message throughput, schema validation failures, and the health of individual consumer applications.
Key Deliverables
- An Architecture Decision Record (ADR) that documents the event taxonomy, the chosen broker technology, and the governance policies (e.g., for naming, versioning, and retention).
- A centralized schema repository with automated CI validation and consumer-driven contract tests.
- Operational dashboards for monitoring system-wide throughput, consumer lag, and DLQ depth.
Risks & Mitigations
- Hidden Coupling through Events:
- Mitigation: Consumers may implicitly depend on undocumented event semantics or data fields. Publish a formal event catalog or schema registry and use linting tools to enforce event structure.
- Operational Complexity and "Noise":
- Mitigation: Without strong observability, diagnosing failed or "stuck" consumers is extremely difficult. Enforce the use of distributed tracing and standardized alerting across all event-driven components.
- "Event Storming" Analysis Paralysis:
- Mitigation: While event storming workshops are valuable, they can become unproductive if not properly managed. Keep modeling sessions time-boxed and focused on high-value business contexts first.
Event Driven v1.1 - Enhanced
π Workflow
Source: Enterprise Integration Patterns & AWS Event-Driven Guide
Phase 1: Event Design
- [ ] Schema: Define and version (
v1) the event payload (JSON). - [ ] Granularity: Decide between "OrderCreated" (Fat) vs "OrderReference" (Thin).
- [ ] Idempotency: Add unique
event_idto every event.
Phase 2: Architecture Setup
- [ ] Producer: Determine event trigger point (After transaction?).
- [ ] Broker: Select Kafka/RabbitMQ/SQS based on load/latency needs.
- [ ] Consumer: Set up retry strategy in case of error (DLQ).
Phase 3: Monitoring
- [ ] Tracing: Trace request chain (Producer -> Broker -> Consumer) with OpenTelemetry.
- [ ] Lag: Monitor consumer lag time (Set alarm).
Checkpoints
| Phase | Verification |
|---|---|
| 1 | Is event schema change backward compatible? |
| 2 | Does system break if same event arrives twice? |
| 3 | Are there lost messages when system crashes and restarts? |
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.