- Home
- Skills
- APIs & Backend
- CQRS Event Sourcing Architect`
Works with the AI Agents you already use
CQRS Event Sourcing Architect`
Architect CQRS and Event Sourcing systems with separate read/write models and immutable event stores.
$15
CQRS Event Sourcing Architect`
Example session with this skill installed
Architect a CQRS system for a library management tool. I need to handle book checkouts and track availability for high-volume searches.
- Read your context and instructions
- Compiled the cqrs event sourcing
I have deconstructed the library management domain into a CQRS and Event Sourcing architecture. This includes the Command side for processing checkouts and the Query side for optimized availability searches.
Library Management Architecture
// --- Domain Events (Immutable) ---
interface BookCheckedOut {
type: 'BookCheckedOut';
version: number;
occurredAt: Date;
data: {
bookId: string;
memberId: string;
dueDate: Date;
};
}
// --- Aggregate Root (Write Side) ---
class BookAggregate {
private id: string;
private isAvailable: boolean = true;
handleCheckout(command: CheckoutBook): BookCheckedOut {
if (!this.isAvailable) throw new Error('Book is already checked out');
return {
type: 'BookCheckedOut',
version: Date.now(),
occurredAt: new Date(),
data: { bookId: command.bookId, memberId: command.memberId, dueDate: command.dueDate }
};
}
}
// --- Projection Handler (Read Side) ---
class AvailabilityProjection {
async handle(event: BookCheckedOut): Promise<void> {
await db.queryStore.update(event.data.bookId, {
status: 'CheckedOut',
lastUpdated: event.occurredAt
});
}
}
Next steps
- Implement the Event Store repository to persist the
BookCheckedOutevents. - Configure a message broker to dispatch events from the Aggregate to the Projection Handler.
- Define the
BookRestoredevent to handle returns and update the availability search index.
Connects securely to your tools. The creator never sees your data.
About this skill
Designing distributed systems with strong consistency and high read performance is difficult. This skill provides the architectural scaffolding to implement Command Query Responsibility Segregation (CQRS) and Event Sourcing without the usual boilerplate overhead.
What it does
- Separates Concerns: Deconstructs domains into Commands for write intent and Queries for data projection.
- Defines Domain Events: Models immutable events like
OrderPlacedorPaymentReceivedwith global sequence numbers. - Enforces Invariants: Implements Aggregate Roots to ensure business logic remains consistent during state changes.
- Optimizes Reads: Builds asynchronous Projection Handlers to maintain denormalized read models in fast query stores.
How it works
- Domain Deconstruction: Identify specific write actions and read requirements within your project scope.
- Event Modeling: Define the schema for your immutable event store and sequence logic.
- Logic Implementation: Generate Aggregate Roots that handle commands and emit events.
- Projection Building: Create the handlers that update your read-side databases based on emitted events.
Frameworks & tools
This skill focuses on TypeScript domain entities and event store definitions. It is designed for enterprise backend environments utilizing microservices and event-driven architectures.
Why this beats prompting it yourself
Generic prompts often fail to maintain the strict separation between write and read models or miss the nuances of event immutability. This skill follows a deterministic workflow to ensure every Aggregate and Projection aligns with Domain-Driven Design (DDD) principles.
Use cases
- Transitioning a monolith to a distributed event-driven microservice.
- Building high-auditability systems where every state change must be logged.
- Creating read-heavy dashboards that require denormalized data for performance.
- Scaling complex business logic where write-side invariants are frequently updated.
Known limitations
This skill produces architectural definitions and TypeScript entities, but does not handle infrastructure provisioning or physical database deployment.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.
Produces TypeScript entities and architectural definitions. Does not provision cloud infrastructure or deploy physical databases. Restricted to the active project workspace.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 3 days ago
- Software
- Zero global installationorelevated privileges required.
File System Read/Write (strictly scoped to current project workspace `./`).
Permissions
Target Use Cases: - Architect a CQRS and Event Sourcing model in TypeScript. - Design read/write model separation with domain events. - Create an Event Sourced aggregate root with projection handlers.