concurrency-consistency
Design and diagnose database concurrency using explicit invariants, transaction boundaries, isolation, locking or optimistic control, retries, deadlock…
от Dadmin88★ 52 звезды на GitHub
Установить concurrency-consistency в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Concurrency and Consistency
Use when concurrent requests, workers, jobs, or replicas can observe or modify the same persistent state and correctness depends on ordering or atomicity.
Procedure
- State the invariant that concurrency must preserve in plain language and identify which rows/documents/keys or aggregates participate.
- Define the transaction boundary and what must be atomic. Avoid spreading one invariant across independent transactions unless compensation/reconciliation is an accepted part of the domain.
- Understand the database engine's actual isolation and concurrency semantics, including snapshot behavior, write conflicts, gap/range locks, serializable anomalies, replica reads, or conditional writes as relevant.
- Choose the simplest concurrency control that preserves the invariant: unique/constraint enforcement, atomic update, compare-and-swap/version column, optimistic retry, row/key lock, advisory/application lock, serializable transaction, or single-owner serialization.
- Keep lock scope and duration bounded. Establish a consistent acquisition order when multiple resources must be locked to reduce deadlock risk.
- Treat deadlocks/serialization failures as expected concurrency outcomes when the engine documents them that way. Retry only the full safe transaction with bounded attempts and fresh reads.
- Account for idempotency when client/job retries can repeat a transaction after an uncertain result.
- Distinguish primary consistency from replica/read-lag semantics. Do not promise read-your-write or uniqueness based on eventually consistent replicas unless the architecture provides it.
- Test overlapping operations intentionally using barriers/concurrent workers rather than hoping ordinary tests produce the race. Assert the invariant and final persisted state.
- Measure contention, lock waits, abort/retry rates, hot keys/rows, and transaction duration under realistic concurrency before scaling the pattern broadly.
Decision rules
- Application
ifchecks do not protect an invariant from concurrent writers without an atomic database guarantee. - Stronger isolation can simplify correctness but may reduce concurrency; choose from the invariant outward.
- Locks are not inherently bad, but hidden or long-lived locks create operational risk.
- Distributed coordination outside the database belongs to Systems/Infrastructure architecture when the invariant spans multiple independent stores or services.
Quality gate
The design is correct when the invariant and atomic boundary are explicit, the chosen engine primitive actually provides the required guarantee, retries and uncertain outcomes are safe, deadlock/contention behavior is understood, and deterministic concurrent tests demonstrate that invalid final states cannot be produced.
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл concurrency-consistency?
Design and diagnose database concurrency using explicit invariants, transaction boundaries, isolation, locking or optimistic control, retries, deadlock handling, and consistency guarantees.
Как установить скилл concurrency-consistency?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл concurrency-consistency запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
AnthropicGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
webapp-testing
AnthropicToolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
brand-guidelines
AnthropicApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
web-artifacts-builder
AnthropicSuite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…