Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
dinerojs avatar

Dinero Best Practices

  • 11 installs
  • 6.8k repo stars
  • Updated August 1, 2026
  • dinerojs/dinero.js

Apply Dinero.js best practices for creating money objects, arithmetic, and precision in JavaScript/TypeScript.

About

Core best practices for the Dinero.js money library covering object creation, arithmetic, precision, and imports. A developer uses it when handling monetary values safely in JavaScript/TypeScript.

  • Object-creation rules: integer minor units, float-conversion helpers, zero-exponent currencies
  • Arithmetic rules: immutability, allocate for splitting, scaled amounts over raw decimals

Dinero Best Practices by the numbers

  • 11 all-time installs (skills.sh)
  • Ranked #798 of 1,106 Finance & Trading skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/dinerojs/dinero.js --skill dinero-best-practices

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs11
repo stars6.8k
Last updatedAugust 1, 2026
Repositorydinerojs/dinero.js

What it does

Apply Dinero.js best practices for creating money objects, arithmetic, and precision in JavaScript/TypeScript.

Files

SKILL.mdMarkdownGitHub ↗

Dinero.js Best Practices

Core rules for working with Dinero.js, the JavaScript/TypeScript library for creating, calculating, and formatting money safely. Contains rules across 4 categories, prioritized by impact.

When to Apply

Reference these guidelines when:

  • Creating Dinero objects from user input, API responses, or database values
  • Performing arithmetic on monetary values (adding, splitting, multiplying)
  • Choosing between number and bigint calculators
  • Importing from dinero.js, dinero.js/currencies, or dinero.js/bigint
  • Working with prices, costs, taxes, or any financial calculation

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Object CreationCRITICALcreation-
2ArithmeticCRITICALarithmetic-
3PrecisionHIGHprecision-
4ImportsMEDIUMimports-

Quick Reference

1. Object Creation (CRITICAL)

  • creation-minor-units - Always pass amounts as integers in minor currency units
  • creation-from-floats - Use a helper to convert float inputs to minor units
  • creation-zero-exponent - Currencies with exponent 0 (e.g., JPY) take major units directly

2. Arithmetic (CRITICAL)

  • arithmetic-immutability - All operations return new objects; capture the return value
  • arithmetic-allocate-not-divide - Use allocate for splitting money, not manual division
  • arithmetic-scaled-amounts - Never multiply by a raw decimal; use scaled amounts
  • arithmetic-percentages - Calculate percentages with allocate or scaled multiply

3. Precision (HIGH)

  • precision-bigint - Use dinero.js/bigint for amounts exceeding Number.MAX_SAFE_INTEGER
  • precision-crypto - Cryptocurrencies require bigint due to high exponents
  • precision-trim-scale - Use trimScale to remove trailing zeros after chained operations

4. Imports (MEDIUM)

  • imports-tree-shaking - Import only what you use; standalone functions enable tree-shaking
  • imports-bigint-currencies - Match calculator type: use dinero.js/bigint/currencies with dinero.js/bigint

How to Use

Read individual rule files for detailed explanations and code examples:

rules/creation-minor-units.md
rules/arithmetic-allocate-not-divide.md

Each rule file contains:

  • Brief explanation of why it matters
  • Incorrect code example with explanation
  • Correct code example with explanation
  • Additional context and references

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.