use-transactions-for-atomicity

Installation
SKILL.md

Summary

When an operation requires multiple writes (INSERT, UPDATE, DELETE) to the database, wrap them in a Transaction. If any part fails, the entire transaction should be Rolled Back.

Rationale

  • Integrity: Prevents partial updates (e.g., money deducted but item not shipped) which leave the database in an inconsistent state.
  • Concurrency: Transactions (depending on isolation level) help manage concurrent access to the same data.

Guidance

  1. Start: Begin transaction.
  2. Execute: Perform all writes.
  3. Check Error: If any error occurs, ROLLBACK immediately.
  4. Commit: If all succeeded, COMMIT.
  5. Defer: In Go/backend code, ensure Rollback is deferred in case of panics or early returns.

Examples

Installs
1
First Seen
Apr 5, 2026
use-transactions-for-atomicity — mew-ton/coding-guidelines