AgentStack
SKILL verified Apache-2.0 Self-run

Concurrency Patterns

skill-kentoshimizu-sw-agent-skills-concurrency-patterns · by KentoShimizu

Design and review concurrency strategy for shared state, coordination, and contention control. Use when parallel execution or async coordination introduces race/deadlock/liveness risk and explicit pattern selection is required; do not use for persistence schema or deployment topology decisions.

No reviews yet
0 installs
11 views
0.0% view→install

Install

$ agentstack add skill-kentoshimizu-sw-agent-skills-concurrency-patterns

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Concurrency Patterns? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Concurrency Patterns

Overview

Use this skill to choose concurrency mechanisms that preserve correctness under load and failure.

Scope Boundaries

  • Use this skill when the task matches the trigger condition described in description.
  • Do not use this skill when the primary task falls outside this skill's domain.

Inputs To Gather

  • Shared state model and mutation frequency.
  • Read/write patterns and contention expectations.
  • Ordering, consistency, and latency requirements.
  • Failure/timeout/retry semantics in concurrent flows.

Deliverables

  • Selected concurrency pattern with rationale.
  • Invariant and liveness assumptions.
  • Risk list (race, deadlock, starvation, contention collapse).
  • Verification plan (stress, race, soak, failure-injection tests).

Pattern Selection Cheatsheet

  • single-writer queue/actor: high contention mutable state.
  • fine-grained lock: moderate contention with strict in-process consistency.
  • lock-free/CAS: low-latency hot path with careful ABA/memory-ordering handling.
  • immutable snapshot + swap: read-heavy workloads.
  • idempotent async workflow: distributed coordination with retries.

Quick Example

  • Problem: concurrent balance updates causing lost writes.
  • Anti-pattern: read-modify-write without serialization.
  • Safer options:
  • single-writer actor per account,
  • optimistic concurrency with version check + bounded retry.

Quality Standard

  • Correctness invariants are explicit and testable.
  • Deadlock/starvation prevention strategy is defined.
  • Contention behavior is characterized at expected scale.
  • Timeout/retry/cancellation behavior is deterministic.
  • Selected pattern includes clear operational monitoring signals.

Workflow

  1. Define correctness invariants and liveness constraints.
  2. Map workload and contention profile.
  3. Compare candidate patterns with tradeoffs.
  4. Select pattern and define failure/timeout semantics.
  5. Define targeted stress/race test strategy.

Failure Conditions

  • Stop when invariants cannot be preserved by selected pattern.
  • Stop when deadlock or starvation risk is unbounded.
  • Escalate when required throughput conflicts with safe coordination model.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.