transaction-consistency

Design minimal transaction boundaries preserving named business invariants.

4|Updated May 16, 2026
One-click install
npx skills add https://github.com/machenjie/rd-skills --skill transaction-consistency
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: transaction-consistency
Source: https://github.com/machenjie/rd-skills/tree/main/src/foundation/capabilities/transaction-consistency
Command: npx skills add https://github.com/machenjie/rd-skills --skill transaction-consistency

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It helps you design transaction boundaries that protect named business invariants while avoiding common causes of contention and inconsistency, such as distributed transactions, remote calls inside database locks, and mismatched isolation/concurrency control.

Core Features & Use Cases

  • Minimal isolation + explicit anomaly prevention: Selects and justifies the isolation level by naming the specific anomaly (dirty read, non-repeatable read, phantom read, write skew) it prevents.
  • Concurrency-safe locking strategy: Uses optimistic or pessimistic concurrency control with defined conflict handling and recovery.
  • Cross-service consistency without 2PC: Prefer Transactional Outbox (event + local atomicity) or Saga compensation when invariants span services.
  • Correct remote-call placement: Ensures external API calls do not occur while holding database locks, preventing lock contention cascades.
  • Testable failure modes: Guides you to plan for deadlocks, lost updates, phantom cases, stuck Sagas, and outbox relay issues.

Quick Start

Use the transaction-consistency capability to produce a complete consistency plan for your change by specifying the named invariants, the relevant data tables, isolation level choice, concurrency control approach, and the Outbox or Saga design for cross-service writes.

Frequently Asked Questions about transaction-consistency

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

FAQPage Schema
How do I design transaction boundaries to protect business invariants without causing lock contention?

To design transaction boundaries that protect business invariants, define minimal transaction scopes, select appropriate isolation levels to prevent specific anomalies, and ensure remote API calls do not occur while holding database locks.

What is the best way to handle distributed consistency across microservices without using 2PC?

For distributed consistency without 2PC, apply the Transactional Outbox pattern for local atomicity with event publishing, or use Saga compensation to roll back multi-step writes when invariants span multiple services.

How do I choose between optimistic and pessimistic concurrency control for concurrent updates?

Choosing between optimistic and pessimistic concurrency control depends on your contention profile; define explicit conflict handling and recovery strategies for lost updates or deadlocks when executing concurrent state transitions.

When do I need explicit isolation levels for multi-step writes like money movement?

You need explicit isolation levels for multi-step writes like money movement when you must prevent specific anomalies such as dirty reads, non-repeatable reads, phantom reads, or write skew during concurrent updates.

What are the common failure modes when applying transactional outbox and saga patterns?

Common failure modes for transactional outbox and saga patterns include stuck Sagas requiring compensation, outbox relay failures, deadlocks, and lost updates, which necessitate explicit testable failure planning.

Why should remote calls not be placed inside database locks during concurrent state transitions?

Remote calls inside database locks should be avoided because external API latency directly expands lock hold times, causing lock contention cascades and severely degrading overall system throughput during concurrent state transitions.