domain-fintech

zhanghandong/rust-skills · updated Apr 8, 2026

$npx skills add https://github.com/zhanghandong/rust-skills --skill domain-fintech
0 commentsdiscussion
summary

Fintech domain constraints and design patterns for building precise, auditable financial systems in Rust.

  • Enforces decimal precision (never f64) using rust_decimal, immutable transaction records with Arc, and double-entry accounting principles to prevent money loss or inconsistency
  • Provides currency newtypes, transaction aggregates, and audit logging patterns aligned with regulatory compliance and dispute resolution requirements
  • Maps domain rules (precision, audit trails, consistency
skill.md

FinTech Domain

Layer 3: Domain Constraints

Domain Constraints → Design Implications

Domain Rule Design Constraint Rust Implication
Audit trail Immutable records Arc, no mutation
Precision No floating point rust_decimal
Consistency Transaction boundaries Clear ownership
Compliance Complete logging Structured tracing
Reproducibility Deterministic execution No race conditions

Critical Constraints

Financial Precision

RULE: Never use f64 for money
WHY: Floating point loses precision
RUST: Use rust_decimal::Decimal

Audit Requirements

RULE: All transactions must be immutable and traceable
WHY: Regulatory compliance, dispute resolution
RUST: Arc<T> for sharing, event sourcing pattern

Consistency

RULE: Money can't disappear or appear
WHY: Double-entry accounting principles
RUST: Transaction types with validated totals

Trace Down ↓

From constraints to design (Layer 2):

"Need immutable transaction records"
    ↓ m09-domain: Model as Value Objects
    ↓ m01-ownership: Use Arc for shared immutable data

"Need precise decimal math"
    ↓ m05-type-driven: Newtype for Currency/Amount
    ↓ rust_decimal: Use Decimal type

"Need transaction boundaries"
    ↓ m12-lifecycle: RAII for transaction scope
    ↓ m09-domain: Aggregate boundaries

Key Crates

Purpose Crate
Decimal math rust_decimal
Date/time chrono, time
UUID uuid
Serialization serde
Validation validator

Design Patterns

Pattern Purpose Implementation
Currency newtype Type safety struct Amount(Decimal);
Transaction Atomic operations Event sourcing
Audit log Traceability Structured logging with trace IDs
Ledger Double-entry Debit/credit balance

Code Pattern: Currency Type

use rust_decimal::Decimal;

#[derive(Clone, Debug, PartialEq)]
pub struct Amount {
    value: Decimal,
    currency: Currency,
}

impl Amount {
    pub fn new(value: Decimal, currency: Currency) -> Self {
        Self { value, currency }
    }

    pub fn add(&self, other: &Amount) -> Result<Amount, CurrencyMismatch> {
        if self.currency != other.currency {
            return Err(CurrencyMismatch);
        }
        Ok(Amount::new(self.value + other.value, self.currency))
    }
}

Common Mistakes

Mistake Domain Violation Fix
Using f64 Precision loss rust_decimal
Mutable transaction Audit trail broken Immutable + events
String for amount No validation Validated newtype
Silent overflow Money disappears Checked arithmetic

Trace to Layer 1

Constraint Layer 2 Pattern Layer 1 Implementation
Immutable records Event sourcing Arc, Clone
Transaction scope Aggregate Owned children
Precision Value Object rust_decimal newtype
Thread-safe sharing Shared immutable Arc (not Rc)

Related Skills

When See
Value Object design m09-domain
Ownership for immutable m01-ownership
Arc for sharing m02-resource
Error handling m13-domain-error

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.754 reviews
  • Kofi Nasser· Dec 20, 2024

    I recommend domain-fintech for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Kaira Smith· Dec 16, 2024

    domain-fintech reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Ganesh Mohane· Dec 4, 2024

    domain-fintech has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Sakshi Patil· Nov 23, 2024

    Solid pick for teams standardizing on skills: domain-fintech is focused, and the summary matches what you get after install.

  • Nia Shah· Nov 11, 2024

    Useful defaults in domain-fintech — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Luis Chen· Nov 7, 2024

    domain-fintech is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Hassan Dixit· Oct 26, 2024

    Useful defaults in domain-fintech — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Chaitanya Patil· Oct 14, 2024

    We added domain-fintech from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Kofi Park· Oct 2, 2024

    domain-fintech is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Rahul Santra· Sep 21, 2024

    domain-fintech reduced setup friction for our internal harness; good balance of opinion and flexibility.

showing 1-10 of 54

1 / 6