ledger
Financial ledger - transactions, audit trails. Use when tracking money.
When & Why to Use This Skill
This Claude skill provides a high-integrity framework for building and managing financial ledgers with a focus on transaction accuracy and auditability. It leverages a modern tech stack (Stripe, Neon, Drizzle) to implement append-only ledgers, ensuring that financial records are immutable, idempotent, and easily reconcilable. By enforcing deterministic precision and preventing floating-point errors, it solves the critical problem of maintaining trust and consistency in digital wallet, credit, and payment systems.
Use Cases
- Case 1: Building a bulletproof credit or virtual wallet system for SaaS platforms that requires an immutable audit trail for every transaction.
- Case 2: Implementing idempotent financial mutations to prevent double-spending or data corruption during concurrent API calls or network failures.
- Case 3: Reconciling internal database balances with external payment processors like Stripe to detect and fix balance drifts or missing entries.
- Case 4: Designing a regulatory-compliant financial architecture that allows for full replaying of the ledger to prove account balances at any point in time.
| name | ledger |
|---|---|
| description | Financial ledger - transactions, audit trails. Use when tracking money. |
Ledger Guideline
Tech Stack
- Payments: Stripe
- Database: Neon (Postgres)
- ORM: Drizzle
Non-Negotiables
- Balances must be immutable ledger (append-only), not mutable fields
- No floating-point for money (use deterministic precision)
- All financial mutations must be idempotent
- Monetary flows must be reconcilable with Stripe
Context
Financial systems are unforgiving. A bug that creates or destroys money — even briefly — is a serious incident. Users trust us with their money; that trust is easily lost and hard to regain.
If balance/credits/wallet exists, it must be bulletproof. If it doesn't exist yet, consider whether the current design would support adding it correctly. Retrofitting financial integrity is painful.
Driving Questions
- Does a balance/credits system exist, and is it implemented correctly?
- Where could money be created or destroyed by a bug?
- What happens during concurrent transactions?
- How would we detect if balances drifted from reality?
- Can we prove every balance by replaying the ledger?
- What financial edge cases (refunds, disputes, chargebacks) aren't handled?