More screenshots

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Prevent Stale Leader Writes

    1

    Repair distributed systems where an old leader keeps writing after failover, causing duplicate jobs, conflicting state, or split-brain effects.

    $1

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Prevent Stale Leader Writes

    Prevent Stale Leader Writes

    Example session with this skill installed

    Our Kubernetes controller sometimes has two pods acting as leader during rolling updates, causing duplicate resource provisioning. Help us fix the split-brain and add fencing.

    • Read your context and instructions
    • Compiled the prevent stale leader

    I have inspected the Lease object logic. I am adding a monotonic leadership epoch to your CRD status. I will now update the reconciliation loop to include a resourceVersion check and an epoch-based fencing token for all outbound Cloud API calls to ensure stale pods are rejected.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    The problem

    Distributed systems often suffer from split-brain scenarios where an expired leader continues to write data after a failover has occurred. This leads to duplicate job executions, corrupted shared state, and unintended external side effects.

    What it does

    • Identifies unsafe lease renewals and writes that remain possible after a primary process fails.
    • Implements monotonic leadership epochs to ensure only the current leader can mutate resources.
    • Adds fencing tokens to database writes and external API calls to reject stale owner requests.
    • Configures bounded leases and deterministic failover tests to validate recovery behavior.
    • Protects singleton background services and distributed schedulers from concurrent execution.

    Frameworks & tools

    Works with etcd, Consul, ZooKeeper, Kubernetes Lease objects, Redis Redlock, and RDBMS-based locking (PostgreSQL, MySQL). Compatible with distributed task queues and cloud-native controllers.

    Why this beats prompting it yourself

    Detecting race conditions in distributed ownership requires more than just a "isLeader" check. This skill enforces a rigorous fencing contract that carries epochs through asynchronous callbacks and external provider requests, preventing the common "pause-resume" bugs that generic prompts miss.

    Use cases

    • Preventing duplicate billing runs in a distributed cron scheduler.
    • Ensuring only one controller instance manages a specific cloud resource.
    • Repairing split-brain data corruption in primary-follower database architectures.
    • Guarding external payment API calls against delayed execution from old processes.

    Known limitations

    Requires an authoritative time source or atomic sequence generator. Cannot undo external side effects that were already accepted by third-party providers before leadership loss was detected.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Agents & Orchestration.

    Requires an authoritative time source or atomic sequence generator. Local wall-clock checks are treated as hints, not guarantees. External side effects require provider-side idempotency support.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 3 months ago

    Permissions

    Terminal / Shell
    Read Files
    Write Files

    Permissions are limited to the active local workspace and are used to inspect user-supplied or local workspace files; create or modify bounded local fixes, tests, documentation, or review artifacts; run repository-supported local tests, checks, builds, or parsing commands. The skill package does not require bundled credentials, unrestricted external network access, or automatic production changes.

    Listed3 months ago
    Updated9 days ago

    What's inside

    Frequently Asked Questions

    This skill eliminates 'split-brain' scenarios where a former leader continues to process tasks after a failover, preventing data corruption, duplicate billing, and conflicting state changes.

    The skill is designed for backend AI agents and developers working with etcd, Consul, ZooKeeper, Redis, and major RDBMS like PostgreSQL or MySQL.

    You receive the complete logic package, integration documentation, and a suite of deterministic failover test cases to validate the fencing behavior in your specific environment.

    It implements monotonic leadership epochs and fencing tokens, which ensure that even if an old process wakes up from a long pause, its write requests are rejected by the storage layer.

    The skill is designed to be agent-agnostic and can be integrated into most autonomous coding agents or CI/CD pipelines that manage cloud-native infrastructure and distributed services.

    Setup involves configuring your chosen authoritative sequence generator (like a Lease object or atomic counter) and mapping the fencing tokens to your external API or database calls.

    New in Agents & Orchestration