principle-concurrency

Diagnose concurrency bugs and select synchronization primitives for concurrent systems.

2|8|Updated Apr 20, 2026
One-click install
npx skills add https://github.com/lugassawan/swe-workbench --skill principle-concurrency
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: principle-concurrency
Source: https://github.com/lugassawan/swe-workbench/tree/main/skills/principle-concurrency
Command: npx skills add https://github.com/lugassawan/swe-workbench --skill principle-concurrency

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you prevent subtle concurrency failures by teaching principled approaches to races, deadlocks, cancellation, and backpressure before they become production incidents.

Core Features & Use Cases

  • Failure mode guidance: Recognize and fix race conditions, deadlocks, livelocks, starvation, lost wakeups, and ABA/CAS pitfalls.
  • Structured concurrency rules: Ensure child lifetimes nest under parent lifetimes with clear error propagation and no orphan work.
  • Practical primitive selection: Choose between mutex, channel, actor, semaphore, and atomics/CAS based on ownership, performance, and correctness.

Quick Start

Ask the AI: “How should I structure cancellation propagation and backpressure in my concurrent worker pipeline, and which synchronization primitive should I use to avoid races and deadlocks?”

Frequently Asked Questions about principle-concurrency

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent race conditions and deadlocks in concurrent worker pipelines?

Prevent race conditions and deadlocks by applying structured concurrency rules, ensuring child lifetimes nest under parents with clear error propagation, and selecting appropriate synchronization primitives like mutexes or channels to manage shared state safely.

What is the best way to choose between mutex, channel, and actor models for synchronization?

Choose between mutex, channel, actor, semaphore, and atomics based on ownership semantics, performance requirements, and correctness needs, ensuring the selected primitive aligns with your concurrent system's specific data access patterns.

How does structured concurrency handle cooperative cancellation propagation?

Structured concurrency handles cooperative cancellation by enforcing lifetime rules where child tasks nest under parent lifetimes, ensuring no orphan work remains and errors propagate cleanly through the cancellation tree without lost wakeups.

When do I need backpressure in producer consumer pipelines?

You need backpressure in producer consumer pipelines when production rates exceed consumption capacity, requiring synchronization strategies to pause or slow producers, preventing unbounded queue growth and subsequent system instability.

Why does my concurrent code suffer from starvation or livelocks instead of crashing?

Concurrent code suffers from starvation or livelocks when synchronization primitives are poorly selected, causing threads to indefinitely wait or repeatedly change states without progressing, requiring a correctness-first framework to diagnose.

Does this concurrency framework apply to both threads and goroutines?

Yes, this concurrency framework applies across both threads and goroutines, providing a correctness-first approach to diagnosing issues like ABA problems, selecting appropriate primitives, and structuring cancellation trees regardless of the runtime.