db-transaction-design

Define transaction policies for concurrent read/write workloads.

7|Updated Feb 14, 2026
One-click install
npx skills add https://github.com/KentoShimizu/sw-agent-skills --skill db-transaction-design
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: db-transaction-design
Source: https://github.com/KentoShimizu/sw-agent-skills/tree/main/skills/db-transaction-design
Command: npx skills add https://github.com/KentoShimizu/sw-agent-skills --skill db-transaction-design

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps design transaction behavior that protects invariants while avoiding unnecessary contention and deadlocks in concurrent read/write workloads.

Core Features & Use Cases

  • Define atomic boundaries and determine which operations must be executed within a transaction.
  • Select appropriate isolation levels and locking strategies based on anomaly tolerance.
  • Specify retry and idempotency rules to recover gracefully from deadlocks or timeouts.

Quick Start

Provide a high-concurrency scenario and request a complete transactional design with boundaries, isolation level, locking strategy, and retry policy.

Frequently Asked Questions about db-transaction-design

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

FAQPage Schema
How do I design database transactions to prevent deadlocks in concurrent workloads?

To prevent deadlocks in concurrent database transactions, you must define a transaction policy that specifies locking strategies, atomic boundaries, and retry rules to protect invariants while avoiding unnecessary contention.

What isolation level should I use for concurrent read and write operations?

Selecting an isolation level for concurrent read and write operations depends on your anomaly tolerance, requiring you to evaluate trade-offs between strict consistency and concurrency to determine appropriate locking strategies.

How do I ensure idempotency when retrying failed database transactions?

Ensuring idempotency during database transaction retries involves specifying explicit retry and idempotency rules that allow the system to gracefully recover from deadlocks or timeouts without violating atomic boundaries.

How do I determine which operations must be executed within a database transaction boundary?

Determining transaction boundaries requires evaluating concurrent workflows to identify operations where correctness depends on atomicity, ensuring only operations necessary for invariant protection are grouped together.

What is the best way to handle transaction anomalies under high concurrency?

Handling transaction anomalies under high concurrency requires a comprehensive design that selects appropriate isolation levels, applies targeted locking strategies, and implements anomaly handling specifications to satisfy safety and reliability.

When should I not use a single atomic transaction for concurrent database operations?

You should avoid a single atomic transaction when concurrent workloads cause excessive contention, instead defining precise boundaries and applying isolation levels that balance anomaly tolerance with throughput requirements.