ditto190/crispy-nextjs-turborepo-monorepo/distributed-transactions-sagas
Claude Code and agent skill by ditto190/crispy-nextjs-turborepo-monorepo
- community
Checking that the SKILL.md file is still in the repository.
Imported TRAE skill from backend/Distributed_Transactions_Sagas.md
Install
npx vskill@latest install ditto190/crispy-nextjs-turborepo-monorepo/distributed-transactions-sagasSKILL.md
The same SKILL.md was published earlier as ditto190/crispy-nextjs-turborepo-monorepo/distributed-transactions-sagas.
Skill: Distributed Transactions (Sagas)
Purpose
To maintain data consistency across multiple microservices where local ACID transactions are not possible.
When to Use
- E-commerce order: Payment Service -> Inventory Service -> Shipping Service.
- Any operation spanning multiple databases.
Procedure
1. The Saga Pattern
A sequence of local transactions. If one fails, execute Compensating Transactions to undo changes.
2. Choreography (Event-Based)
Services listen to events and trigger the next step.
- Order Service: Creates Order (Pending). Publishes
OrderCreated. - Payment Service: Listens to
OrderCreated. Charges card. PublishesPaymentProcessedorPaymentFailed. - Inventory Service: Listens to
PaymentProcessed. Reserves stock. PublishesStockReserved. - Order Service: Listens to
StockReserved. Updates Order toConfirmed.
Compensation:
- If Payment fails: Publish
PaymentFailed. - Order Service listens: Cancels Order.
3. Orchestration (Controller-Based)
A central "Saga Orchestrator" tells services what to do.
- Orchestrator: Send "Reserve Stock" command to Inventory.
- Inventory: Responds "Success".
- Orchestrator: Send "Charge Payment" command.
- Payment: Responds "Insufficient Funds".
- Orchestrator: Send "Release Stock" command (Compensation) to Inventory.
4. Implementation
Use frameworks like Temporal.io or custom state machines with message queues (BullMQ/Kafka).
Constraints
- Eventual Consistency: The system is not consistent at every moment. UI must handle "Pending" states.
- Isolation: Sagas lack Isolation (I in ACID). "Dirty reads" can happen. Use semantic locking (e.g., state=PENDING_APPROVAL) to prevent other ops from touching the entity.
Expected Output
A resilient distributed workflow that guarantees the system eventually reaches a consistent state (either Success or Rolled Back).
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/backend/distributed-transactions-sagas/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ditto190/crispy-nextjs-turborepo-monorepo/distributed-transactions-sagas)