Skip to content
Agent

07-scaling-patterns

by pluginagentmarketplace

AI Summary

An enterprise-focused AI agent that guides architects and engineers through scaling patterns including microservices, event-driven architecture, and distributed systems design. Ideal for teams building scalable applications who need systematic guidance on architectural decisions.

Install

Copy this and paste it into Claude Code, Cursor, or any AI assistant:

I want to set up the "07-scaling-patterns" agent in my project.

Please run this command in my terminal:
# Add AGENTS.md to your project root
curl --retry 3 --retry-delay 2 --retry-all-errors -o AGENTS.md "https://raw.githubusercontent.com/pluginagentmarketplace/custom-plugin-api-design/main/agents/07-scaling-patterns.md"

Then explain what the agent does and how to invoke it.

Description

Enterprise patterns for scaling - microservices, async operations, AI agents, event-driven architecture aligned with Software Design & Architecture, AI Agents, System Design roles

Role & Responsibility Boundaries

Primary Role: Design and implement patterns for distributed, scalable systems. Boundaries: • ✅ Microservices, event-driven architecture, distributed patterns • ✅ AI agent integration, message queues, resilience patterns • ❌ Individual service implementation (delegate to Agent 02) • ❌ Database optimization (delegate to Agent 03) • ❌ Infrastructure deployment (delegate to Agent 04)

Service Decomposition

` ┌──────────────────────────────────────────────────────────────────┐ │ Microservices Decomposition │ ├──────────────────────────────────────────────────────────────────┤ │ │ │ Monolith → Microservices │ │ ┌─────────────────┐ ┌─────────────────┐ │ │ │ User Module │ │ User Service │ (Node.js) │ │ │ Order Module │ → │ Order Service │ (Python) │ │ │ Payment Module │ │ Payment Service │ (Go) │ │ │ Inventory Module│ │ Inventory Svc │ (Java) │ │ │ Notification │ │ Notification Svc│ (Node.js) │ │ └─────────────────┘ └─────────────────┘ │ │ │ │ Bounded Contexts: │ │ - Each service owns its data │ │ - Clear API contracts between services │ │ - Independent deployment lifecycle │ │ │ └──────────────────────────────────────────────────────────────────┘ `

Service Communication

`typescript // Synchronous (REST/gRPC) - Use for queries async function getUser(userId: string): Promise<User> { const response = await fetch(http://user-service/users/${userId}, { headers: { 'X-Request-ID': requestId, 'Authorization': Bearer ${serviceToken}, }, timeout: 5000, // Always set timeout }); if (!response.ok) { throw new ServiceError('user-service', response.status); } return response.json(); } // Asynchronous (Events) - Use for commands/state changes async function createOrder(order: CreateOrderDto): Promise<Order> { // Save to local database const savedOrder = await orderRepository.save(order); // Publish event for other services await eventBus.publish('order.created', { orderId: savedOrder.id, userId: savedOrder.userId, items: savedOrder.items, total: savedOrder.total, timestamp: new Date().toISOString(), }); return savedOrder; } `

Event Bus Implementation

`typescript import { Kafka, Producer, Consumer } from 'kafkajs'; class EventBus { private producer: Producer; private consumer: Consumer; private handlers: Map<string, ((event: any) => Promise<void>)[]> = new Map(); constructor(private kafka: Kafka) { this.producer = kafka.producer(); this.consumer = kafka.consumer({ groupId: process.env.SERVICE_NAME! }); } async connect() { await this.producer.connect(); await this.consumer.connect(); } async publish<T>(topic: string, event: T): Promise<void> { await this.producer.send({ topic, messages: [ { key: (event as any).id || crypto.randomUUID(), value: JSON.stringify({ ...event, metadata: { timestamp: new Date().toISOString(), source: process.env.SERVICE_NAME, correlationId: asyncLocalStorage.getStore()?.correlationId, }, }), }, ], }); } async subscribe(topic: string, handler: (event: any) => Promise<void>): Promise<void> { const handlers = this.handlers.get(topic) || []; handlers.push(handler); this.handlers.set(topic, handlers); await this.consumer.subscribe({ topic, fromBeginning: false }); } async start(): Promise<void> { await this.consumer.run({ eachMessage: async ({ topic, message }) => { const handlers = this.handlers.get(topic) || []; const event = JSON.parse(message.value!.toString()); for (const handler of handlers) { try { await handler(event); } catch (error) { console.error(Error handling event on ${topic}:, error); // Dead letter queue for failed events await this.publish(${topic}.dlq, { originalEvent: event, error: String(error) }); } } }, }); } } // Usage const eventBus = new EventBus(kafka); eventBus.subscribe('order.created', async (event) => { await paymentService.processPayment(event.orderId, event.total); }); eventBus.subscribe('payment.completed', async (event) => { await inventoryService.reserveItems(event.orderId); }); `

Discussion

0/2000
Loading comments...

Health Signals

MaintenanceCommitted 3mo ago
Stale
AdoptionUnder 100 stars
1 ★ · Niche
DocsREADME + description
Well-documented

GitHub Signals

Stars1
Issues0
Updated3mo ago
View on GitHub
No License

My Fox Den

Community Rating

Sign in to rate this booster

Works With

Claude Code
Claude.ai