ワンクリックで
event-driven-design
When designing loosely coupled systems that react to state changes asynchronously.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
When designing loosely coupled systems that react to state changes asynchronously.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
When improving read performance and reducing database load.
When setting up telemetry, debugging distributed systems, or standardizing application output.
When creating or extending an HTTP API for client consumption.
When addressing slow application endpoints, high database CPU usage, or standardizing data access patterns.
When designing how a system recovers from and reports failures.
When asynchronously reviewing peer code before merging into the main branch.
| name | event-driven-design |
| description | When designing loosely coupled systems that react to state changes asynchronously. |
| version | 2.0.0 |
| category | architecture |
| tags | ["architecture","events","async"] |
| skill_type | architecture |
| author | skiLLM |
| license | MIT |
| compatible_agents | ["claude-code","cursor","copilot","codex"] |
| estimated_context_tokens | 2000 |
| dangerous | false |
| requires_review | true |
| security_level | review-required |
| dependencies | [] |
| triggers | ["event","async","decoupling","event bus","message broker"] |
| permissions | {"filesystem":{"read":true,"write":true},"network":{"outbound":true},"shell":{"execute":false}} |
| input_requirements | ["microservices or monolithic architecture","message broker setup"] |
| output_contract | ["immutable events","idempotent consumers","dead letter queues"] |
| failure_conditions | ["event loss","duplicate processing","synchronous coupling"] |
| last_updated | "2026-05-15T00:00:00.000Z" |
Tightly coupled systems break and scale poorly. Event-driven architectures decouple producers from consumers by using immutable, timestamped facts as the communication mechanism. This enables systems to evolve independently, scale horizontally, and handle distributed failures gracefully.
OrderPlaced, UserRegistered, PaymentProcessed)OrderPlaced not PlaceOrder)SendEmailEvent) rather than facts (UserCreated)❌ Anti-pattern (Commands as events, synchronous coupling, no idempotency):
// WRONG: Command not event
publishEvent('SendEmail', { userId, subject });
// WRONG: Synchronous dependency
async function handleOrderPlaced(event) {
const order = await orderService.fetch(event.orderId); // Blocks on external service
await emailService.send(order.email); // Fails if service is down
}
// WRONG: No idempotency tracking - processes duplicate
async function handleUserCreated(event) {
await database.createUser(event); // Processes same event twice = duplicate user
}
✅ Correct pattern (Events, async, idempotent):
// CORRECT: Past-tense event with minimal payload
publishEvent({
type: 'UserCreated',
id: uuid(),
timestamp: new Date(),
payload: {
userId: event.userId,
email: event.email
}
});
// CORRECT: Asynchronous, idempotent consumer
async function handleUserCreated(event) {
// 1. Track processed events (idempotency)
const alreadyProcessed = await cache.get(`processed:${event.id}`);
if (alreadyProcessed) return; // Skip duplicate
// 2. Process without waiting for external services
await emailQueue.enqueue({
email: event.payload.email,
template: 'welcome'
});
// 3. Mark as processed
await cache.set(`processed:${event.id}`, true, { ttl: 86400 });
}
// 4. Dead Letter Queue for failed events
async function handleFailedEvent(event, error) {
await dlq.store({
originalEvent: event,
error: error.message,
timestamp: new Date(),
retryCount: 0
});
}