Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Payments Ledger Test Suite: Catch Double Charges & Races

    1

    Drop-in tests for any double-entry ledger: idempotency, concurrency, overdraft races and crash safety, proven against real databases.

    $29

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Payments Ledger Test Suite: Catch Double Charges & Races

    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

    FindingRoot causeFix
    Duplicate retries post twicethe idempotency key is checked, then inserted, in separate stepsclaim the key with a unique-constraint insert inside the write transaction
    Overdraft racethe balance check runs outside the lockread 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.

    How to use

    1. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    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

    Requires

    Python

    Permissions

    Terminal / Shell
    Listed28 days ago
    Updated7 days ago

    What's inside

    Frequently Asked Questions

    Drop-in tests for any double-entry ledger: idempotency, concurrency, overdraft races and crash safety, proven against real databases.

    This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

    Connect your AI agent to Agensi through MCP, then ask it to use Payments Ledger Test Suite: Catch Double Charges & Races on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

    New in Finance & Accounting