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)
tools
Building resilient distributed systems with circuit breakers, retries with full-jitter exponential backoff, retry budgets (per-request 3-attempt + per-client 10% ratio per Google SRE), deadline propagation, and the cascading-failure math (4 layers × 3 retries = 64x amplification). Grounded in Resilience4j, Microsoft Cloud Patterns, AWS Architecture Blog (Marc Brooker), and Google SRE Book.
testing
Designing HTTP cache headers that work correctly across browsers, CDNs, and shared proxies — `Cache-Control` directives per RFC 9111, `stale-while-revalidate` and `stale-if-error` per RFC 5861, the Vary header for varying responses, and surrogate keys for tag-based purging. Grounded in IETF RFCs and Cloudflare/Fastly docs.
development
Use when designing or fixing a Content Security Policy on a real site, choosing between nonce-based and hash-based CSP, adding strict-dynamic, debugging "Refused to execute inline script" errors, deploying CSP in report-only mode first, configuring report-to / report-uri, or auditing an existing policy for unsafe-inline / unsafe-eval / wildcards. Triggers: "CSP blocks legitimate inline script", strict-dynamic, nonce-{RANDOM}, sha256-{HASH}, object-src none, base-uri none, frame-ancestors, Trusted Types, X-Content-Security-Policy obsolete, report-only vs enforced. NOT for general HTTP security headers (HSTS, COOP/COEP), Trusted Types deep dive, CORS configuration, or building a WAF.
tools
Choosing and operating an HTTP API versioning strategy that doesn't break clients — Stripe's date-based pinned versions, the Deprecation/Sunset header pair (RFC 9745 + RFC 8594), URI vs header vs media-type approaches, and the version-transformer pattern. Grounded in Stripe's published architecture and IETF RFCs.