skills/distributed-transaction-manager/SKILL.md
Saga patterns, compensating actions, and two-phase commit for distributed transactions. Activate on: distributed transaction, saga, compensating action, two-phase commit, eventual consistency, cross-service transaction. NOT for: single-database transactions (use database-connection-pool-manager), event sourcing (use cqrs-event-sourcing-architect).
npx skillsauth add curiositech/windags-skills distributed-transaction-managerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Design and implement reliable cross-service transactions using saga patterns, compensating actions, and orchestrated workflows.
Activate on: "distributed transaction", "saga pattern", "compensating action", "two-phase commit", "eventual consistency", "cross-service transaction", "Temporal workflow", "rollback across services"
NOT for: Single-database ACID transactions → database-connection-pool-manager | Event sourcing → cqrs-event-sourcing-architect | Message queue setup → event-driven-architecture-expert
| Domain | Technologies | |--------|-------------| | Orchestration | Temporal 1.25+, Step Functions, Conductor | | Choreography | Kafka events, RabbitMQ, Redis Streams | | Frameworks | NestJS Saga, MassTransit (.NET), Axon (JVM) | | State Machines | XState 5.x, custom saga state tables | | Monitoring | Temporal UI, saga state dashboards |
Saga Orchestrator (Temporal Workflow)
│
├─→ Step 1: Reserve Inventory ──fail──→ (no compensation needed)
│ ↓ success
├─→ Step 2: Charge Payment ──fail──→ Compensate: Release Inventory
│ ↓ success
├─→ Step 3: Create Shipment ──fail──→ Compensate: Refund Payment
│ ↓ success Compensate: Release Inventory
└─→ COMPLETE
// Temporal workflow definition
import { proxyActivities } from '@temporalio/workflow';
const { reserveInventory, releaseInventory,
chargePayment, refundPayment,
createShipment } = proxyActivities<Activities>({
startToCloseTimeout: '30s',
retry: { maximumAttempts: 3 },
});
export async function orderSaga(order: Order): Promise<OrderResult> {
// Step 1
await reserveInventory(order.items);
try {
// Step 2
const paymentId = await chargePayment(order.payment);
try {
// Step 3
const shipmentId = await createShipment(order.shipping);
return { status: 'completed', paymentId, shipmentId };
} catch {
await refundPayment(paymentId);
throw new Error('Shipment failed');
}
} catch {
await releaseInventory(order.items);
throw new Error('Order saga failed');
}
}
Order Service Inventory Service Payment Service
│ │ │
├─ OrderCreated ───────→│ │
│ ├─ InventoryReserved ──→│
│ │ ├─ PaymentCharged
│←── OrderCompleted ────┤←── PaymentConfirmed ──┤
│ │ │
│ On failure at any step, each service │
│ listens for failure events and compensates │
STARTED → INVENTORY_RESERVED → PAYMENT_CHARGED → SHIPMENT_CREATED → COMPLETED
│ │ │ │
└→ FAILED COMPENSATING ←─── COMPENSATING ←─── COMPENSATING
│
COMPENSATED (terminal)
data-ai
license: Apache-2.0 NOT for unrelated tasks outside this domain.
development
Use when designing caching strategies (cache-aside, write-through, write-behind), implementing distributed locks, building rate limiters, leaderboards, real-time streams (XADD/consumer groups), pub/sub, or tuning eviction policies. Triggers: thundering-herd on cache miss, dogpile on key expiry, Redlock vs SET-NX-PX choice, sliding-window rate limiter, hot-key on a single cluster slot, big-key blowup, MULTI/EXEC across slots, KEYS in production. NOT for Redis Cluster operations/admin (different domain), embedded KV (SQLite, leveldb), in-process LRU caches, or Memcached.
tools
Drawing the `'use client'` boundary correctly in React Server Components apps (Next.js App Router, RSC frameworks) — leaf-pushing, slot composition, serialization rules, and environment poisoning prevention. Grounded in react.dev and Next.js 16 docs.
development
Use when designing rate limiting for an API, choosing between token bucket / sliding window / leaky bucket / fixed window, implementing it in Redis, deciding edge (Cloudflare/Upstash) vs origin enforcement, sizing per-user vs per-IP vs per-endpoint quotas, returning the right 429 response with Retry-After, or fixing the boundary-burst bug in fixed-window limiters. Triggers: 429 too many requests, INCR + EXPIRE, ZADD + ZREMRANGEBYSCORE + ZCARD, X-RateLimit-Remaining header, Cloudflare WAF rate limiting rules, Upstash @upstash/ratelimit, leaky bucket shaping vs policing, distributed rate limiter consistency. NOT for DDoS mitigation specifically (different scale), CAPTCHA / bot management, full WAF design, or per-user quota billing.