rust-fintech
Skill1 starsChanged 41 days agoMITView on GitHub
Financial/money code in Rust — exact decimal arithmetic (never floats), a Money type with currency, rounding modes, splitting without losing cents, idempotency, and double-entry ledgers. Use when handling money, prices, currencies, payments, or accounting, where rounding and exactness are correctness-critical. Triggers: decimal, rust_decimal, banker's rounding, idempotency, ledger, double-entry.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- adxptived/Rust-Skillstheir own version, first seen Oct 17, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- adxptived/Rust-Skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository42 other files it gives its agents.
- AGENTS.mdAGENTS.md
- addressing-findingsSkill
- auditSkill
- codebase-onboardingSkill
- codex-reviewSkill
- compatibilitySkill
- debuggingSkill
- developSkill
- distributed-racesSkill
- memorySkill
- nix-dev-envSkill
- nix-flakesSkill
- nixosSkill
- nix-packagingSkill
- nix-reviewSkill
- refactoringSkill
- retroSkill
- review-initSkill
- review-rulesSkill
- rust-architecture-reviewSkill
- rust-architectureSkill
- rust-cliSkill
- rust-cloud-nativeSkill
- rust-concurrencySkill
- rust-ecosystemSkill
- rust-embeddedSkill
- rust-errorsSkill
- rust-idiomsSkill
- rust-macrosSkill
- rust-mlSkill
- rust-navigationSkill
- rust-ownershipSkill
- rust-performanceSkill
- rust-pluginsSkill
- rust-reviewSkill
- rust-securitySkill
- rust-testingSkill
- rust-traitsSkill
- rust-unsafeSkill
- rust-webSkill
- specsSkill
- sql-reviewSkill
The file
Files
Rust Fintech
In money code, rounding and exactness are correctness — a fraction of a cent lost per transaction is a real bug. The domain's non-negotiable rules and the Rust types that enforce them. Deep dives in the sub-files.
When to Use
- Representing or computing money, prices, currencies
- Payments, billing, accounting, trading
- Anywhere a rounding error or lost cent is a defect
The cardinal rule: never f64 for money
Floating point can't represent 0.10 exactly — 0.1 + 0.2 != 0.3. Money must be exact
decimal. Use rust_decimal::Decimal (128-bit fixed-scale) or integer minor units (cents), never
f32/f64.
// Bad — silent rounding error, accumulates
let total: f64 = 0.1 + 0.2; // 0.30000000000000004
// Good — exact
use rust_decimal::{Decimal, dec};
let total: Decimal = dec!(0.1) + dec!(0.2); // exactly 0.3[dependencies]
# `macros` re-exports the dec! macro from rust_decimal itself;
# `serde` backs the string-serialization advice in money.md.
rust_decimal = { version = "1", features = ["macros", "serde"] }The separate rust_decimal_macros crate still works (use rust_decimal_macros::dec;), but the
macros feature keeps everything under one crate.
Treating money as a float is the #1 fintech bug — flag it in review like an unwrap on a hot
path (→ rust-review).
Model money as a type, not a number
A bare Decimal lets you add dollars to euros. Wrap amount and currency in a newtype so
illegal operations don't compile (→ rust-traits newtype / illegal-states):
pub struct Money { amount: Decimal, currency: Currency }Adding two Money of different currencies must be a domain error, not a silent bug. Construction,
arithmetic, rounding, and splitting → money.md.
Rounding is a decision, state it explicitly
There is no "default" correct rounding — the domain dictates it (tax rules, exchange conventions). Make it explicit at every point where precision is reduced:
- Banker's rounding (round-half-to-even) is common for finance — it avoids the upward bias of round-half-up over many operations.
- Round once, at the boundary (display, settlement), not on every intermediate — rounding intermediates compounds error.
- Splitting a total across N parties must conserve the total to the cent (allocate remainders deterministically) — see money.md.
Integrity: money systems must not lose or double-count
Beyond arithmetic, the domain demands:
- Idempotency — a retried payment must not charge twice (idempotency keys).
- Double-entry — every movement is balanced debits = credits; the ledger is append-only and auditable.
- Exactness end-to-end — store
Decimal/integer in the DB (e.g.NUMERIC), neverfloatcolumns.
Patterns in integrity.md.
Testing money code
Exactness bugs hide in edge cases — assert invariants with property tests (→ rust-testing
proptest): "split then sum equals the original", "round-trip serialize preserves value", "no
operation creates or destroys money". These catch lost-cent bugs that example tests miss.
Boundaries
- The
Moneynewtype technique and "make illegal states unrepresentable" →rust-traits. - Domain errors (
InsufficientFunds,CurrencyMismatch) →rust-errors(and they're the running example there). - Property-based invariant testing →
rust-testing.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

