distributed-locking
Installation
SKILL.md
Distributed Locking
Use this skill when
- Guarding a resource across multiple instances
- Implementing leader election and job fencing
- Choosing Redis/ZooKeeper/DB-based locks
Do not use this skill when
- Single-node apps (an in-process lock is enough)
- Where eventual semantics suffice
Instructions
- Prefer idempotent design over locking where possible.
- If you must lock, use TTL-based leases with renewal.
- Include fencing tokens so stale lock holders cannot act.
- Handle lock expiry: fail safe, never assume the lock is held.
- Choose the store by correctness needs (DB for strong, Redis for speed).
- Make lock acquisition idempotent and reentrant-aware.
- Detect and alert on lock contention and abandoned locks.