Files
freemo d9e5668cec fix(skills): comprehensive final audit pass for programming-patterns skill
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
2026-04-15 13:22:13 -04:00
..

Concurrency Patterns

Overview

Concurrency patterns address the challenges of executing multiple computations simultaneously, managing shared resources, synchronizing threads, and structuring asynchronous workflows. These patterns are essential for building responsive, high-throughput systems.

Patterns in This Category

Pattern Purpose Key Mechanism
Producer-Consumer Decouple data production from consumption Shared bounded queue
Read-Write Lock Allow concurrent reads, exclusive writes RWMutex / RWLock
Thread Pool Reuse a fixed set of workers Worker pool with task queue
Future / Promise Represent a value not yet available Async result placeholder
Actor Model Isolate state behind message-passing actors Mailbox queues
Reactor Demultiplex I/O events on a single thread Event loop + handlers
Monitor Protect shared state with mutex + conditions Condition variables
Active Object Decouple method invocation from execution Request queue + scheduler

When to Use Concurrency Patterns

  • I/O-bound workloads: Reactor, Future/Promise, Actor Model
  • CPU-bound workloads: Thread Pool, Producer-Consumer
  • Shared mutable state: Monitor, Read-Write Lock
  • Message-driven architectures: Actor Model, Active Object
  • Event-driven systems: Reactor

General Principles

  1. Prefer message passing over shared memory when possible.
  2. Minimize critical sections to reduce contention.
  3. Avoid nested locks to prevent deadlocks.
  4. Use bounded queues to apply backpressure.
  5. Design for cancellation and timeout in all async operations.