domain-fintech

domain-fintech

Beliebt

Use when building fintech apps. Keywords: fintech, trading, decimal, currency, financial, money, transaction, ledger, payment, exchange rate, precision, rounding, accounting, 金融, 交易系统, 货币, 支付

534Sterne
53Forks
Aktualisiert 1/24/2026
SKILL.md
readonlyread-only
name
domain-fintech
description

"Use when building fintech apps. Keywords: fintech, trading, decimal, currency, financial, money, transaction, ledger, payment, exchange rate, precision, rounding, accounting, 金融, 交易系统, 货币, 支付"

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

You Might Also Like

Related Skills

coding-agent

coding-agent

179Kdev-codegen

Run Codex CLI, Claude Code, OpenCode, or Pi Coding Agent via background process for programmatic control.

openclaw avataropenclaw
Holen
add-uint-support

add-uint-support

97Kdev-codegen

Add unsigned integer (uint) type support to PyTorch operators by updating AT_DISPATCH macros. Use when adding support for uint16, uint32, uint64 types to operators, kernels, or when user mentions enabling unsigned types, barebones unsigned types, or uint support.

pytorch avatarpytorch
Holen
at-dispatch-v2

at-dispatch-v2

97Kdev-codegen

Convert PyTorch AT_DISPATCH macros to AT_DISPATCH_V2 format in ATen C++ code. Use when porting AT_DISPATCH_ALL_TYPES_AND*, AT_DISPATCH_FLOATING_TYPES*, or other dispatch macros to the new v2 API. For ATen kernel files, CUDA kernels, and native operator implementations.

pytorch avatarpytorch
Holen
skill-writer

skill-writer

97Kdev-codegen

Guide users through creating Agent Skills for Claude Code. Use when the user wants to create, write, author, or design a new Skill, or needs help with SKILL.md files, frontmatter, or skill structure.

pytorch avatarpytorch
Holen

Implements JavaScript classes in C++ using JavaScriptCore. Use when creating new JS classes with C++ bindings, prototypes, or constructors.

oven-sh avataroven-sh
Holen

Creates JavaScript classes using Bun's Zig bindings generator (.classes.ts). Use when implementing new JS APIs in Zig with JSC integration.

oven-sh avataroven-sh
Holen