- Home
- Skills
- Finance & Accounting
- Payments Ledger Test Suite: Catch Double Charges & Races
Works with the AI Agents you already use
Payments Ledger Test Suite: Catch Double Charges & Races
Drop-in tests for any double-entry ledger: idempotency, concurrency, overdraft races and crash safety, proven against real databases.
$29
Payments Ledger Test Suite: Catch Double Charges & Races
Example session with this skill installed
Prove our ledger can't double-charge or overdraw under concurrent retries.
- Read your context and instructions
- Compiled the payments ledger test
I wired the kit's adapter to the ledger's service layer and ran it against a file-backed database.
$ python -m pytest tests/test_ledger_kit.py -q
FAILED test_concurrent_duplicate_key_posts_once
AssertionError: one idempotency key produced several transfers
FAILED test_overdraft_race_cannot_breach_floor
AssertionError: 16 transfers of 60 succeeded from a balance of 100
2 failed, 2 passed, 1 skipped
Verdict: LEDGER: AT RISK
| Finding | Root cause | Fix |
|---|---|---|
| Duplicate retries post twice | the idempotency key is checked, then inserted, in separate steps | claim the key with a unique-constraint insert inside the write transaction |
| Overdraft race | the balance check runs outside the lock | read the balance and write both postings under one lock |
The property-based model (random transfers, replays, refusals) passed: single-threaded logic is correct; the defects are concurrency only. Re-run after the fixes to get LEDGER: SOUND.
(Run against the kit's deliberately broken demo ledger, trimmed.)
Connects securely to your tools. The creator never sees your data.
About this skill
Payments, wallets, credits and billing fail the same few ways: a retried request charges twice, two transfers both pass the balance check, a lock timeout becomes a 500, a crash leaves half a transfer. Unit tests don't catch these. This kit does.
What you get
- One test file plus a small adapter (about 60 lines for SQLite). It proves: books always balance, an idempotency key posts once under 16 concurrent retries, no lost updates, no overdraft race succeeds, lock contention returns a clean 503.
- Tests with teeth: each concurrency test was verified to fail on a deliberately broken ledger and pass on a correct one.
- 8 design rules with SQLite, Postgres and MySQL mappings, plus a Postgres schema with immutable postings.
- Review mode: a checklist ending in LEDGER: SOUND or LEDGER: AT RISK, every flag backed by a test.
- Porting notes for fast-check, jqwik, rapid and proptest.
Why this beats asking an AI to "write tests for my ledger" Generated tests usually run one request at a time, so they never see a race. These run 16 concurrent retries against a real file-backed database, and each was proven to fail on a ledger with the exact bug it names.
Use cases
- Before launching payments, wallets, credits or billing
- Reviewing a ledger an AI agent wrote
- Adding regression tests after a double-charge incident
Known limitations
- The test file is Python (Hypothesis); other stacks need a port, with notes included.
- You write a small adapter to your own service layer (about 60 lines for SQLite).
- It tests ledger invariants, not your payment provider or UI.
From the author of agent-forge, whose payments ledger is public with its full history.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Finance & Accounting.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 28 days ago
- Software
Python