Backend Distributed Locking

Use when the user asks about a distributed lock, two workers processing the same job, Redis lock (SET NX PX), Redlock, pg_advisory_lock, leases or fencing tokens. Produces a lock design with TTLs, fencing and failure handling. Not for job deduplication via idempotency keys (use backend-idempotency).

45 stars 6 forksSoftware Development

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add j4flmao/agent-skills --skill backend-distributed-locking
Manual install
git clone --depth 1 https://github.com/j4flmao/agent-skills.git /tmp/agent-skills
mkdir -p ~/.claude/skills
cp -r /tmp/agent-skills/skills/backend/universal/distributed-locking ~/.claude/skills/backend-distributed-locking

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Backend Distributed Locking

## Purpose
Coordinate access to shared resources across multiple service instances using distributed locks with guaranteed safety properties.

## Agent Protocol

### Trigger
Exact user phrases: "distributed lock", "Redis lock", "Redlock", "ZooKeeper lock", "advisory lock", "PostgreSQL lock", "pg_advisory_lock", "lease", "distributed mutex", "fencing token", "lock timeout".

### Input Context
- Resource being protected.
- Available infrastructure (Redis, PostgreSQL, ZooKeeper, etcd).
- Number of competing instances.
- Duration of the critical section.

### Output Artifact
Lock configuration or implementation code. No file unless requested.

### Response Format
```
Provider: {Redis|PostgreSQL|ZooKeeper|etcd}
Strategy: {Redlock|Advisory|Ephemeral|Lease}
TTL: {duration}
Safety: {fencing?}
```

### Completion Criteria
- [ ] Lock acquisition and release implemented correctly.
- [ ] Lock timeout (TTL) configured.
- [ ] Fencing token mechanism in place for critical resources.
- [ ] Deadlock prevention: no nested locks.
- [ ] Graceful degradation: lock acquisition failure does not crash the service.

### Max Response Length
4 lines per lock configuration. 20 lines for implementation.

## Architecture Decision Tree

### Which Lock Provider?
Read the full skill on GitHub

Details

Skill name
backend-distributed-locking
Path
skills/backend/universal/distributed-locking/SKILL.md
License
MIT
Repo updated
17 November 2026

FAQ

What does the Backend Distributed Locking skill do?

Use when the user asks about a distributed lock, two workers processing the same job, Redis lock (SET NX PX), Redlock, pg_advisory_lock, leases or fencing tokens. Produces a lock design with TTLs, fencing and failure handling. Not for job deduplication via idempotency keys (use backend-idempotency).

How do I install the Backend Distributed Locking skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add j4flmao/agent-skills --skill backend-distributed-locking. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Backend Distributed Locking popular?

It lives in j4flmao/agent-skills, which has 45 GitHub stars and 6 forks.

Related skills

Agent Observability

45

j4flmao/agent-skills

Use when the user asks about agent observability, tracing agent reasoning, debugging an agent loop, OpenTelemetry GenAI spans for LLM calls, LLM cost tracking per agent, agent audit logs or hallucination/eval monitoring in production. Produces instrumentation config, trace schema, dashboards, alerts and cost attribution. Not for generic service tracing without LLMs (use devops-opentelemetry).

DevOps & Cloud

AI Agent Architectures

45

j4flmao/agent-skills

Use when the user asks to build an AI agent, design an agent that calls tools and keeps memory, write an agent system prompt or pick an agent framework (Claude Agent SDK, OpenAI Agents SDK, LangGraph). Produces an architecture brief covering loop, tools, memory, guardrails and evals, routing depth to child skills. Not for workflow patterns (use ai-agentic-workflows).

AI, LLMs & Agents

AI Agent Core Loop

45

j4flmao/agent-skills

Use when the user asks about the agent loop, ReAct vs plan-and-solve, re-planning, Reflexion, an agent stuck in a loop, max iterations or termination conditions. Produces a loop spec or patch with state, success predicate, caps and no-progress detection. Not for overall agent design (use ai-agent-architectures) or tool schemas (use tool-calling-principles).

AI, LLMs & Agents

Backend Elixir

45

j4flmao/agent-skills

Use when the user asks about Phoenix, Phoenix LiveView, Ecto schemas and changesets, GenServer state, OTP supervision trees, Oban jobs or Phoenix PubSub. Produces Phoenix/Elixir backend code organized by contexts. Not for Elixir language basics (use lang-elixir).

Software Development

Backend Data Masking

45

j4flmao/agent-skills

Use when the user asks about PII masking, redaction, field-level encryption, tokenization, anonymization or pseudonymization, GDPR erasure or masking production data for test environments. Produces a data protection plan with code. Not for encryption at rest and key management (use security-data-security).

Software Development

Backend Event Driven

45

j4flmao/agent-skills

Use when the user asks about event-driven architecture, domain vs integration events, publishing events between services, Kafka or RabbitMQ consumers, event schema versioning, DLQs or sagas. Produces event catalog, topology and consumer code. Not for event stores (use backend-event-sourcing) or broker operations (use backend-message-queue).

Software Development

Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.