data-consistency-patterns

Guide consistency model selection and anomaly prevention across distributed systems.

Updated Mar 29, 2026
One-click install
npx skills add https://github.com/marquesfelip/agents-and-skills --skill data-consistency-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: data-consistency-patterns
Source: https://github.com/marquesfelip/agents-and-skills/tree/main/skills/data-consistency-patterns
Command: npx skills add https://github.com/marquesfelip/agents-and-skills --skill data-consistency-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Data consistency is hard in distributed and relational systems; this skill provides a framework to reason about consistency guarantees, anomalies, and patterns to ensure correct behavior across services.

Core Features & Use Cases

  • Guidance on selecting isolation levels (Read Committed, Serializable) to prevent anomalies.
  • Strategies for locking (pessimistic/optimistic) and patterns like outbox and sagas for distributed transactions.
  • Use cases include multi-service order processing, inventory reservation, and financial transfers with eventual consistency.

Quick Start

Map a two-service checkout with inventory and payment to a saga-based workflow and outline the compensation steps.

Frequently Asked Questions about data-consistency-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle distributed transactions across microservices?

Distributed transactions across microservices are managed using saga patterns and the outbox pattern to coordinate multi-service workflows. This skill guides mapping a two-service checkout to a saga and defining compensation steps for rollback.

What isolation level do I need to prevent dirty reads and phantom reads?

To prevent anomalies like dirty reads, non-repeatable reads, and phantom reads, you map them to appropriate isolation levels such as Read Committed or Serializable. This skill provides guidance on selecting the correct level for your consistency requirements.

What's the best way to prevent double booking in a reservation system?

Preventing double booking requires correct consistency guarantees and locking strategies. This skill provides guidance on using optimistic or pessimistic locking to ensure correct behavior and inventory reservation across services.

When should I use optimistic locking versus pessimistic locking?

Optimistic and pessimistic locking are chosen based on contention levels and consistency models. This skill helps you reason about ACID vs BASE guarantees to select the appropriate locking strategy for your distributed system.

How do I design a compensation step for a failed payment in a saga?

Compensation steps for failed payments in a saga are designed by outlining the rollback workflow for multi-service order processing. This skill demonstrates how to map service checkouts to saga-based workflows and define the required undo actions.

Does eventual consistency work for financial transfers between services?

Eventual consistency can work for financial transfers by using patterns like sagas to manage distributed transactions. This skill provides a framework to reason about consistency guarantees and ensure correct behavior across services.