with one click
concurrency-and-threading-principles
// Concurrency/parallelism patterns: race prevention, deadlock avoidance, message passing, async/channels/mutexes/worker pools.
// Concurrency/parallelism patterns: race prevention, deadlock avoidance, message passing, async/channels/mutexes/worker pools.
WCAG accessibility: semantic HTML, ARIA, keyboard nav, contrast, screen readers. For all user-facing interfaces.
Document architectural decisions using ADR format. Use during research when choosing approaches, introducing deps/patterns, or changing arch.
REST/HTTP API design: resource naming, status codes, error formats, versioning, pagination.
Kubernetes deployment and GitOps patterns: rolling/blue-green/canary strategies, ArgoCD/Flux manifests, K8s secrets management. Supplement to ci-cd-principles.
CI/CD pipeline patterns: stages, Dockerfile, GitHub Actions, artifact management, environment promotion, rollback. Layered by deployment complexity.
Structured code review protocol: inspect against full rule set. Use for audit workflows, code reviews, or when user requests review. Produces findings document with severity tags.
| name | concurrency-and-threading-principles |
| description | Concurrency/parallelism patterns: race prevention, deadlock avoidance, message passing, async/channels/mutexes/worker pools. |
| user-invocable | false |
Multiple threads + shared data + write + no sync = race.
Prevention: locks/mutexes, immutability, message passing, thread-local storage.
Detection: Go=-race, Rust=Miri, C/C++=TSan, Java=JCStress/FindBugs.
Two+ threads waiting for each other. Four conditions (ALL required): mutual exclusion, hold-and-wait, no preemption, circular wait.
Prevention (break any one): lock ordering (same order always), try_lock with timeout, avoid nested locks, lock-free data structures.
Immutable = thread-safe. No sync needed. Share freely. If must change → message passing.
"Share memory by communicating" (Go proverb). Channels/queues instead of shared memory. Reduces lock need. Easier to reason about and test.
Timeouts, retries, circuit breakers. Don't crash app on one thread failure. Supervisors for fault tolerance. Backpressure for producer-consumer.