agent-instructions
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when designing systems around events and message queues. Covers event schema design, delivery guarantees, idempotent consumers, ordering, dead-letter handling, and event sourcing.
$ npx -y skills add nimadorostkar/Claude-Skills-collection --skill event-driven-architecture --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/event-driven-architectureContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when designing systems around events and message queues. Covers event schema design, delivery guarantees, idempotent consumers, ordering, dead-letter handling, and event sourcing.
name: event-driven-architecture description: Use when designing systems around events and message queues. Covers event schema design, delivery guarantees, idempotent consumers, ordering, dead-letter handling, and event sourcing. metadata: category: backend version: 1.0.0 tags: [events, kafka, queues, messaging, idempotency]
Design event flows that survive redelivery, reordering, and consumer failure — because all three will happen, and the broker's guarantees are weaker than most designs assume.
1. **Name events in the past tense** — `OrderPlaced`, `PaymentFailed`. An event is a fact that happened, not a command to do something. 2. **Design the payload for consumers you do not control** — Include enough context that a consumer does not have to call back for the basics; do not include so much that every field change breaks someone. 3. **Assume at-least-once** — Every consumer must be idempotent. Deduplicate on an event ID, or make the operation naturally idempotent. 4. **Partition for ordering** — Ordering is guaranteed only within a partition. Key by the entity whose order matters (usually the aggregate ID). 5. **Handle poison messages** — A message that always fails must land in a DLQ after N attempts, not retry forever and block the partition. 6. **Version from the start** — Additive changes only; a new required field is a new event version.
**Idempotent consumer keyed on event ID:**
async def handle(event: Event, conn: Connection) -> None:
async with conn.transaction():
# Insert the marker first. If this event was already processed,
# the unique constraint rejects it and we skip the side effect.
inserted = await conn.execute(
"INSERT INTO processed_events (event_id, consumer) VALUES ($1, $2) "
"ON CONFLICT DO NOTHING RETURNING 1",
event.id, CONSUMER_NAME,
)
if not inserted:
logger.info("duplicate_event_skipped", extra={"event_id": event.id})
return
await apply_side_effect(event, conn) # same transaction as the markerThe marker and the side effect commit together. Redelivery is a no-op; a crash mid-transaction rolls back both and the message is redelivered cleanly.
A curated library of 137 production-grade skills for Claude and other AI coding agents. Every skill follows one structure, speaks with one voice, and earns its place by changing what the agent does.
Repo: nimadorostkar/Claude-Skills-collection
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when an agent needs state that survives a session or a context compaction. Covers what to persist, file-based memory, structuring notes for retrieval, and…
Use when automating agent behavior with lifecycle hooks. Covers hook events, deterministic enforcement of rules the model should not be trusted to remember,…
Use when packaging skills, commands, hooks, and MCP servers into a distributable plugin. Covers manifest structure, bundling, versioning, testing, and…
Use when writing a new skill for an AI agent. Covers scoping, description writing for reliable triggering, progressive disclosure, and the difference between a…
Use when reviewing or improving an existing agent skill. Covers triggering accuracy, content quality, redundancy with the base model, and measuring whether the…