- Home
- Skills
- Finance & Accounting
- Multi-Currency Ledger & Financial Invariant Auditor
Multi-Currency Ledger & Financial Invariant Auditor
Static Python/SQLAlchemy financial AST scanner and multi-currency split-tender ledger auditor.
$15
Multi-Currency Ledger & Financial Invariant Auditor
Example session with this skill installed
Scan the ./backend/orders directory for financial float leaks and insecure Decimal usage, then provide a fix for any detected PG-001 or FIN-002 errors.
- Read your context and instructions
- Compiled the multi-currency ledger
I have completed the static AST scan of the ./backend/orders directory. The audit identified two critical financial invariants violations: a Float column definition in the SQLAlchemy model and an unsafe Decimal constructor using a float literal.
Financial Audit Results
| Rule ID | Severity | File | Line | Finding |
|---|---|---|---|---|
| PG-001 | High | models.py | 42 | Column(Float) used for unit_price |
| FIN-002 | High | services/calc.py | 89 | Decimal(19.99) detected (binary float drift) |
| SEC-001 | Medium | schemas.py | 115 | gross_margin found in ProductPublicOut |
Recommended Fixes
# models.py - Replace Float with Numeric
from sqlalchemy import Numeric
# Change: unit_price = Column(Float)
unit_price = Column(Numeric(18, 4), nullable=False)
# services/calc.py - Replace float literals with strings
from decimal import Decimal
# Change: tax = Decimal(19.99)
tax = Decimal("19.99")
# schemas.py - Isolate margin from public DTOs
class ProductPublicOut(BaseModel):
id: int
name: str
price: Decimal
# Remove: gross_margin: Decimal
Next steps
- Run
python3 scripts/scan_ledger_code.py ./backend/orders --jsonto verify the fixes. - Apply the
NUMERIC(18, 4)migration to your PostgreSQL database using the provided DDL templates. - Review
references/financial-concurrency-invariants.mdto ensureORDER BY sku ASCis added to all checkout queries.
Connects securely to your tools. The creator never sees your data.
About this skill
Financial systems fail silently when binary floats cause rounding drift or race conditions lead to deadlocks. This skill audits Python and SQLAlchemy backends to enforce strict monetary invariants and deterministic concurrency patterns in multi-currency ledgers.
What it does
- AST Code Scanning identifies high-risk
floatusage, unsafeDecimal(float)constructors, and incorrect SQLAlchemy column types for monetary data. - Multi-currency Settlement Auditing validates JSON invoice exports to ensure conservation of value across USD, EUR, and crypto tenders while blocking split-rounding pumping.
- Concurrency Enforcement detects multi-row
FOR UPDATElocks missing deterministicORDER BYclauses to prevent PostgreSQL and SQLite deadlocks. - Schema Boundary Checks flags internal cost, margin, and wholesale fields accidentally exposed in public or seller Pydantic/response DTOs.
- Transaction Logic Validation ensures duplicate SKUs are aggregated before stock checks to prevent inventory bypass exploits.
How it works
- Static Analysis runs the
scan_ledger_code.pytool on your Python repository to detectFIN-001throughERR-001violations. - Settlement Review uses
audit_settlement.pyto process multi-currency invoice fixtures and verify rounding logic and FX conversions. - DDL Implementation applies provided PostgreSQL or SQLite schema templates that use
NUMERICtypes and identity columns. - Concurrency Hardening implements the global lock hierarchy (invoice -> payments -> products sorted by SKU) using the provided SQL references.
Frameworks & tools
This skill is built for Python 3.10+ environments using SQLAlchemy, PostgreSQL, and SQLite WAL. It integrates with Pydantic for DTO validation and uses standard library AST parsing for zero-dependency static analysis.
Why this beats prompting it yourself
Prompting alone often misses subtle IEEE-754 precision errors or complex row-level locking orders that lead to race conditions. This skill provides a specialized AST scanner and deterministic audit scripts that catch financial edge cases a general LLM might overlook during a standard code review.
Use cases
- Audit a multi-currency checkout pipeline for precision loss and FX rounding errors.
- Scan a legacy SQLAlchemy codebase to migrate unsafe Float columns to Numeric.
- Harden a POS backend against deadlock errors under high concurrent load.
- Validate that internal margin data is isolated from public catalog API responses.
Known limitations
The scanner requires Python 3.10 or higher. It only analyzes static code patterns and cannot detect runtime logic errors that occur outside the audited AST or JSON structures.
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 8 days ago
- Software
Python 3.10+
Permissions
What's inside
Frequently Asked Questions
New in Finance & Accounting
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.