d9e5668cec
Fixes and improvements from exhaustive audit: Consistency fixes in SKILL.md: - 'Pipe & Filter' → 'Pipe and Filter' (one stray '&' found and corrected) - 'Singleton for factory instance' → clarified to 'register factory as singleton-scoped via DI container' (less misleading wording) - Documentation Format section updated with note that SKILL.md itself is the authoritative source for related-pattern combinations Coverage fix — Related Patterns sections: - Added '## Related Patterns' to ALL 94 pattern files (was 0/94) - Each section lists 3–6 related patterns with relationship descriptions - Covers: why they're related, when to prefer one vs the other, and which are often confused SOLID principles → Creational → Structural → Behavioral → Architectural → Concurrency → Functional → Resilience → Data Access → Messaging → Testing → Error Handling → Microservice — all 13 categories covered Code verification: - Python: 0 failures (all 85 testable blocks pass) - Go: 0 failures (all 76 testable blocks pass) - JavaScript: 0 failures (all 78 testable blocks pass) - All 239 code blocks verified correct after edits Final skill state: - 108 files, 36,524 lines across 13 reference categories - 94/94 pattern files have Related Patterns sections - 2,815-line SKILL.md with 67 decision trees, 23 scenarios, 0 broken references, 0 naming inconsistencies
Messaging Patterns
Messaging patterns define how components communicate asynchronously — decoupling producers from consumers in time, space, and implementation. They are fundamental to event-driven architectures, microservices, and any system that needs to handle work without blocking the caller.
Pattern Comparison
| Pattern | Delivery | Coupling | Consumers | Use Case |
|---|---|---|---|---|
| Publish-Subscribe | Fan-out to all subscribers | Low (topic-based) | Many | Notifications, event broadcasting |
| Message Queue | Point-to-point, one consumer | Low | One (competing consumers) | Work distribution, task processing |
| Event Bus | In-process fan-out | Low (in-process) | Many (in-process) | Modular monolith, plugin systems |
| Request-Reply | Correlated request/response | Medium | One | RPC over messaging, async queries |
| Dead Letter Queue | Failed message routing | Low | One (error handler) | Error handling, poison messages |
Decision Guide
Is communication within a single process?
├─ Yes → Event Bus
└─ No → Is it broadcast (many consumers)?
├─ Yes → Publish-Subscribe
└─ No → Is it fire-and-forget work?
├─ Yes → Message Queue
│ └─ Handle failures → Dead Letter Queue
└─ No → Need a response?
└─ Yes → Request-Reply
Combining Patterns
Messaging patterns layer naturally:
Producer
└─ Publishes to Topic (Pub/Sub)
├─ Subscriber A → Message Queue (work distribution)
│ └─ Failures → Dead Letter Queue
├─ Subscriber B → Request-Reply (enrichment)
└─ Subscriber C → Event Bus (in-process dispatch)
Key Principles
- Decouple producers and consumers — Neither should know about the other's implementation.
- Make messages self-describing — Include enough context to process without callbacks.
- Handle failures explicitly — Dead letter queues prevent poison messages from blocking processing.
- Idempotency — Consumers must handle duplicate messages gracefully.
- Ordering matters — Know whether your messaging system guarantees order, and design accordingly.