More screenshots

    Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseOpenClawOpenClaw+21 more

    Repair Resource Lifecycle Race Bugs

    1

    Diagnose and repair asynchronous resource create/update/delete races, tombstones, late callbacks, retries, and reconciliation.

    $8.99

    Secure checkout via Stripe

    30-day refund guarantee

    Converts to your local currency at checkout

    Security scanned
    Repair Resource Lifecycle Race Bugs

    Repair Resource Lifecycle Race Bugs

    Example session with this skill installed

    A delete event for 'user-123' arrived at 10:00:01, but the late 'create' callback finished at 10:00:05, resurrecting the resource. Help me fix this lifecycle race.

    • Read your context and instructions
    • Compiled the repair resource lifecycle

    The issue is a classic resurrection race where the system lacks a terminal state (tombstone) to prevent late-arriving create confirmations from overwriting a completed deletion.

    Diagnosis

    • Identity: user-123
    • Conflict: The delete operation finished locally, but the provider's create callback was still in flight.

    Root Cause: The system treats the absence of a record as "not yet created" rather than "already deleted," allowing the late callback to insert a stale record.

    Implementation: Tombstone Pattern

    Replace the hard delete with a soft-delete tombstone that includes a deleted_at timestamp or a monotonically increasing version ID to discard late-arriving operations.

    interface ResourceState {
      id: string;
      status: 'active' | 'deleted';
      version: number;
      deletedAt?: Date;
    }
    
    async function handleCreateCallback(providerResult: any) {
      const { id, version } = providerResult;
      
      // Atomic check-and-set or transaction
      const existing = await db.resources.find(id);
      
      if (existing && (existing.status === 'deleted' || existing.version >= version)) {
        console.log(`[Lifecycle] Ignoring late callback for ${id}. Resource already terminal.`);
        // Cleanup provider resource if necessary
        await provider.cleanup(id);
        return;
      }
    
      await db.resources.upsert({
        id,
        status: 'active',
        version,
        updatedAt: new Date()
      });
    }
    

    Deterministic Test Plan

    it('should discard create callback if delete occurred during flight', async () => {
      const store = new MockStore();
      const lifecycle = new LifecycleManager(store);
    
      // 1. Start creation
      const createPromise = lifecycle.create('res-1');
      
      // 2. Immediate delete before callback returns
      await lifecycle.delete('res-1');
      
      // 3. Resolve late create callback
      await mockProvider.resolveCreate('res-1');
    
      // 4. Invariant: Store must still reflect 'deleted' state
      const finalState = await store.get('res-1');
      expect(finalState.status).toBe('deleted');
    });
    

    Next steps

    1. Update your database schema to include a version or deleted_at column.
    2. Modify the delete handler to write the tombstone instead of purging the row.
    3. Add a background TTL task to purge expired tombstones after your max-retry window.

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

    What you get

    Design idempotent resource lifecycles for distributed systems.Implement tombstone logic to prevent resource resurrection.Audit reconciler loops for race conditions and terminal state handling.Create deterministic tests for flaky asynchronous workflows.

    About this skill

    Repair Resource Lifecycle Race Bugs targets production and repository defects around diagnose and repair asynchronous resource create/update/delete races, tombstones, late callbacks, retries, and reconciliation.. It examines resource generation/operation identity, create versus delete ordering, late provider callbacks, tombstone and terminal-state semantics, retry/idempotency behavior, cleanup ownership, reconciler authority, mixed-version rollout and observability, then establishes one explicit repair contract and focused deterministic validation.

    The skill works from repository access or partial evidence such as snippets, logs, configuration, traces, and architecture notes. It preserves existing product/security policy, avoids invented execution claims, and keeps production systems, real credentials, and deployment outside the validation path.

    How to install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean 1 month ago

    • Passed all security checks, Safe to install

    Listed1 month ago

    What's inside

    Frequently Asked Questions