patterns
Provides information on system design patterns. Helps understand how to build systems in an organized and effective way.
What it does
This document is a reference for design patterns used in programming, such as CQRS, Event Sourcing, and Saga. It explains what they are, when to use them, and how they work.
When to use it
- ✓When you want to learn about design patterns.
- ✓To understand how to organize complex systems.
- ✓When looking for solutions to common software problems.
Example of what to ask your AI
“Explain the Circuit Breaker pattern to me.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
This document lists and describes various software design patterns. For each pattern, it details what it is, when it's useful, how to implement it, and its pros and cons.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add sickn33/agentic-awesome-skills --skill patternsOr download just the file:
curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/monopoly/patterns/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
MONOPOLY — Design Patterns Deep Dive
When to Use
- Use this skill when the task matches this description: Reference document for monopoly patterns.
Table of Contents
- CQRS
- Event Sourcing
- Saga Pattern
- Circuit Breaker
- Bulkhead
- Strangler Fig
- Sidecar / Service Mesh
- Outbox Pattern
- Consistent Hashing
- Backpressure
- Leader Election
- Two-Phase Commit
1. CQRS (Command Query Responsibility Segregation)
What it is: Separate the read model (Query) from the write model (Command) into distinct services, databases, or code paths.
When to use:
- Read load is 10×+ write load (most web apps)
- Read queries are complex aggregations over write data
- Need to optimize read and write paths independently
- Domain model is complex (DDD contexts)
Implementation:
Write Path: Client → Command API → Write DB (normalized, PostgreSQL)
Read Path: Client → Query API → Read DB (denormalized, Redis / Elasticsearch)
Sync: Write DB → CDC (Debezium) → Message Queue → Read DB updater
Trade-offs:
- ✅ Independent scaling of read and write
- ✅ Optimized schemas for each operation type
- ❌ Eventual consistency between write and read models
- ❌ Increased complexity; two models to maintain
Real-world users: Amazon (order service), LinkedIn (feed)
2. Event Sourcing
What it is: Store state as a sequence of immutable events rather than current state. Rebuild current state by replaying events.
When to use:
- Full audit trail is a regulatory requirement (fintech, healthcare)
- Need to replay history for debugging or analytics
- Complex domain with many state transitions
- Need to derive multiple read projections from same data
Implementation:
Event Store: append-only log (Kafka, EventStoreDB)
Snapshots: periodic snapshots to speed up state rebuild
Projections: consumers build read models from events
Trade-offs:
- ✅ Complete audit history; perfect for compliance
- ✅ Replay and time-travel debugging
- ❌ Querying current state requires projection maintenance
- ❌ Event schema evolution is hard
- ❌ High storage overhead over time
3. Saga Pattern
What it is: Manage distributed transactions across microservices via a sequence of local transactions, each publishing an event. If a step fails, compensating transactions undo previous steps.
Two variants:
- Choreography: Services react to events autonomously (decentralized)
- Orchestration: A central Saga Orchestrator coordinates steps (centralized)
When to use:
- Multi-service workflows where ACID across services is impossible
- Long-running business transactions (order → payment → inventory → shipping)
- Need rollback across service boundaries
Choreography Example:
OrderService creates order →
[event: OrderCreated] →
PaymentService charges card →
[event: PaymentProcessed] →
InventoryService reserves stock →
[event: StockReserved] →
ShippingService books courier
Compensating Transactions (on failure):
ShippingService fails →
[event: ShippingFailed] →
InventoryService releases stock →
PaymentService refunds card →
OrderService marks order failed
Trade-offs:
- ✅ No distributed locking; high availability
- ✅ Scales well across services
- ❌ Hard to debug; distributed trace required
- ❌ Compensating transactions are complex to implement correctly
4. Circuit Breaker
What it is: A proxy that monitors calls to a service. If failure rate exceeds threshold, the circuit "opens" and calls fail fast instead of waiting for timeout.
States:
CLOSED → calls pass through; monitor failure rate
OPEN → calls fail immediately; no calls to downstream
HALF-OPEN → let a probe call through; if success, close; if fail, stay open
When to use:
- Calling any external service (payment gateway, SMS, email)
- Microservices calling each other
- Preventing timeout cascade when downstream is slow
Implementation tools: Hystrix (deprecated), Resilience4j, Polly (.NET), Envoy proxy
Thresholds (starting point):
- Open after 50% failure rate over 10 requests
- Stay open for 30 seconds
- Half-open: allow 1 probe request
Trade-offs:
- ✅ Prevents cascade failures
- ✅ Gives downstream time to recover
- ❌ Adds latency overhead for monitoring
- ❌ Requires fallback behavior when circuit is open
5. Bulkhead
…
FAQ
What are 'design patterns'?
They are reusable solutions to common problems encountered in software development. They help create more organized, efficient, and maintainable code.
What's the difference between CQRS and Event Sourcing?
CQRS separates read and write operations, while Event Sourcing records all changes as a sequence of events.
What is the 'Saga Pattern'?
It's a way to manage transactions involving multiple services, ensuring everything is completed or rolled back correctly, even if one part fails.
Details
Original description by the author
Reference document for monopoly patterns.
Popularity
- GitHub stars
- 48k
- Ranking position
- #3619
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
00-andruia-consultant
Helps your agent start or improve AI projects. It analyzes code, suggests tools, and creates action plans in Spanish.
sickn33/agentic-awesome-skills
007
Lets your agent perform security audits and threat modeling. It's useful for protecting projects against attacks and vulnerabilities.
sickn33/agentic-awesome-skills
10-andruia-skill-smith
Helps your agent create or improve AI tools. It defines how tools work, writes documentation, and validates the structure.
sickn33/agentic-awesome-skills
20-andruia-niche-intelligence
Lets your agent create a summary about a specific industry. It's useful for understanding the context, rules, usage patterns, and risks of a project, using reliable sources.
sickn33/agentic-awesome-skills
Similar skills
dashboard-builder
Helps your agent create useful monitoring dashboards. It turns data into charts that answer important system questions.
affaan-m/ECC
dev-team
Simulates a collaborative development team where different roles respond to a problem together. It's useful for getting multiple perspectives without manually switching agents.
affaan-m/ECC
ecc-council
Has your agent convene a four-voice council for difficult decisions. It's useful when there are multiple good options and debate is needed before choosing.
affaan-m/ECC