0091-laravel-transactions-and-consistency
CommunityMake Laravel multi-writes consistent and safe.
System Documentation
What problem does it solve?
Prevents inconsistent database state when multiple related writes and side-effects must succeed or fail together, especially under concurrency and retries.
Core Features & Use Cases
- Atomic multi-write updates: Use DB::transaction to wrap related model updates and bulk creates as a single unit of work.
- After-commit side-effects: Dispatch events/jobs only after the transaction commits (e.g., using dispatchAfterCommit or setting $afterCommit = true) to avoid acting on rolled-back data.
- Idempotent retry safety: Make queued jobs and event handlers safe to run multiple times using state checks and unique constraints.
- Concurrency coordination: Use lockForUpdate when multiple workers must coordinate on the same rows.
Example: Updating an order and inserting its items should never leave an order saved without its items, and invoice sending should only happen once the transaction is permanently committed.
Quick Start
Use the 0091-laravel-transactions-and-consistency skill to refactor your Laravel workflow so order updates, item creation, and follow-up events run atomically with after-commit dispatch and idempotent retry-safe jobs.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: 0091-laravel-transactions-and-consistency Download link: https://github.com/MrJmpl3/codex_____data_____configuration/archive/main.zip#0091-laravel-transactions-and-consistency Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.