FoundationDB .NET Transactions
Helps you write FoundationDB transactions in .NET that retry safely, avoid conflicts and stay within limits.
Claude's review
8/10 Precise FoundationDB .NET retry loop, idempotency, limits, atomic mutation and watch guidance, including the little endian Min/Max trap.
We asked Claude the question you would ask: would I be glad I installed this? Two separate reviews, the second blind to the first, must both rate a skill 7 or higher before we sell it.
In detail
How to correctly run transactions with the FoundationDB .NET client (FoundationDB.Client / SnowBank): the db.ReadAsync / WriteAsync / ReadWriteAsync retry loop and why a handler must be safe to run more than once, the 5-second and size limits, conflicts and how to avoid them, snapshot reads, explicit conflict ranges, atomic mutations (AtomicAdd32/64, AtomicIncrement, AtomicMin/Max and the lexicographic ByteMin/ByteMax, AtomicAnd/Or/Xor, AtomicCompareAndClear, AtomicAppendIfFits), and watches. Use whenever code opens a transaction or calls BeginTransaction, writes a read-modify-write, increments a counter, waits on a key with a watch, pages a large range scan across transactions, or hits an FdbException: NotCommitted, TransactionTooOld ("Transaction is too old to perform reads"), CommitUnknownResult, TransactionTimedOut, transaction_too_large. Also use it for "why does my transaction keep retrying / conflict / run twice", for high-contention or write-hot keys, and before deciding that a value must be read and
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: foundationdb-transactions
description: >-
How to correctly run transactions with the FoundationDB .NET client (FoundationDB.Client / SnowBank): the
db.ReadAsync / WriteAsync / ReadWriteAsync retry loop and why a handler must be safe to run more than once,
the 5-second and size limits, conflicts and how to avoid them, snapshot reads, explicit conflict ranges,
atomic mutations (AtomicAdd32/64, AtomicIncrement, AtomicMin/Max and the lexicographic ByteMin/ByteMax,
AtomicAnd/Or/Xor, AtomicCompareAndClear, AtomicAppendIfFits), and watches. Use whenever code opens a
transaction or calls BeginTransaction, writes a read-modify-write, increments a counter, waits on a key with
a watch, pages a large range scan across transactions, or hits an FdbException: NotCommitted,
TransactionTooOld ("Transaction is too old to perform reads"), CommitUnknownResult, TransactionTimedOut,
transaction_too_large. Also use it for "why does my transaction keep retrying / conflict / run twice", for
high-contention or write-hot keys, and before deciding that a value must be read and written back. Pairs
with the foundationdb-keys-and-layers skill.
---
# FoundationDB .NET — Transactions & the Retry Loop
FoundationDB gives you **serializable, ACID transactions** over the whole keyspace. The catch: a transaction may **conflict** and need to be retried, and it has hard limits (time and size). The .NET client handles retries for you via a **retry loop** — but only if you use it correctly. The single biggest source of bugs is writing a transaction handler that is **not safe to run more than once**.
If you are encoding keys/values inside the transaction, read the **`foundationdb-keys-and-layers`** skill too.
---
## 1. Always use the retry loop
Don't manually `BeginTransaction` / `CommitAsync` in application code. Use the retryable methods on `IFdbDatabase` (or `IFdbDatabaseProvider`). Pick the narrowest one:
| Method | Transaction type | Use for |
|---|---|---|
| `db.ReadAsync(handler, ct)` | `IFdbReadOnlyTransaction` | reads only; returns a result |
| `db.WriteAsync(handler, ct)` | `IFdbTransaction` | mutations that return **nothing** (the handler may still read — its transaction is a full read/write one) |
| `db.ReadWriteAsync(handler, ct)` | `IFdbTransaction` | mutations that must **return a value** out of the transaction |
> The split between `WriteAsync` and `ReadWriteAsync` is about the **return value**, not about whether you read. Both hand you a full `IFdbTransaction`. `ReadWriteAsync` has no "returns nothing" overload — if your handler returns no value, use `WriteAsync`.
```csharp
// READ
Book? book = await db.ReadAsync(async tr =>
{
...From SnowBankSDK's repository, BSD-3-Clause licence.
Related skills
-
Checked
Supabase auth and database
Builds with Supabase auth, database, storage and edge functions while avoiding common security traps.
8/101 credit -
Checked
AWS schema conversion
Runs AWS DMS Schema Conversion projects to move database schemas between engines and convert SQL to match.
7/101 credit -
Checked
Firebase Done Right
Builds Firebase apps with safe security rules, data models that scale and reliable Cloud Functions.
7/101 credit -
Checked
Google Workspace API Setup
Connects your server code to Gmail, Drive, Calendar and Sheets with safe service accounts and fewer quota errors.
7/101 credit -
Checked
Supabase Backend Security
Wires up Supabase auth, row level security, storage and realtime so your data stays private and queries stay fast.
8/101 credit -
Checked
NestJS API endpoints
Adds NestJS endpoints with proper validation, status codes and the traps that break startup fixed.
8/101 credit