value-objects-money-and-units

value-objects-money-and-units is a skill for Claude Code from zakariaf/Flutter-Skills. It costs 209 tokens per session (4,024 once invoked), scanned A, original, MIT.

A design guide for Dart value objects, small types that represent money, measurements, and times safely. It requires storing money as integer minor units, physical quantities as SI units, and timestamps in UTC, with conversion only for display.

In plain words
What is it for?
Use it to implement or review pure-Dart money, measurement, timestamp, allocation, parsing, and rounding logic.
Why use it?
It prevents rounding errors, mixed currencies, inconsistent units, and time-zone mistakes in stored data. It also keeps the core logic independent of Flutter and platform plugins.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the flutter plugin — 40 skills shipped together

Good fit Use it to implement or review pure-Dart money, measurement, timestamp, allocation, parsing, and rounding logic.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/zakariaf/flutter-skills/value-objects-money-and-units
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add zakariaf/Flutter-Skills --skill value-objects-money-and-units
Clone the repo
git clone --depth 1 https://github.com/zakariaf/Flutter-Skills

Made for: Claude Code.

Or install flutter, the plugin that ships this one along with the rest of its 40 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for value-objects-money-and-units

README.md
[![agentmods](https://agentmods.dev/badge/skills/zakariaf/flutter-skills/value-objects-money-and-units/github.svg)](https://agentmods.dev/skills/zakariaf/flutter-skills/value-objects-money-and-units)
Your own site
<a href="https://agentmods.dev/skills/zakariaf/flutter-skills/value-objects-money-and-units"><img src="https://agentmods.dev/badge/skills/zakariaf/flutter-skills/value-objects-money-and-units/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for value-objects-money-and-units

Your own site · 80×15
<a href="https://agentmods.dev/skills/zakariaf/flutter-skills/value-objects-money-and-units"><img src="https://agentmods.dev/badge/skills/zakariaf/flutter-skills/value-objects-money-and-units.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 209 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,024 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00209 $0.04024
Opus 5 $0.00105 $0.02012
Sonnet 5 $0.00042 $0.00805
Haiku 4.5 $0.00021 $0.00402

Measured 10d ago against content hash 01600049a6e3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

value-objects-money-and-units scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/check-money-violations.sh, scripts/verify-core.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/value-objects-money-and-units/SKILL.md · 317 lines

How it starts

The opening of the file, as written. The whole thing — 317 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Value objects: money & units

Store every quantity once, in one canonical form, and convert only when shown or exported. Money is integer minor units plus a currency; physical quantities are whole SI base units; time is UTC. This is what lets a user flip any display preference (currency symbol, unit system, locale) without corrupting one stored row, and lets "sum of parts == whole" be structural, not hoped-for.

This core is pure Dart — no flutter/*, no intl, no dart:io, no plugins. Formatting and digit normalization happen upstream/downstream, not here. These value objects live in lib/core/, the sanctioned pure-foundation layer (see project-structure-and-packages) — never a utils//common//shared/ grab-bag.

Read the reference for the task at hand:

  • references/allocate-and-splitting.md — the largest-remainder allocate() primitive, its invariants, the two-rounding-sites trap, edge policies, verified test vectors, and the subtotal→tax→tip split pipeline.
  • references/canonical-storage.md — the ISO-4217 exponent rule, the SI unit tables, decimal-based parsing, the cents-accumulator for keypad input, rounding discipline, and the Clock-injected dated-rate / staleness engine.
  • references/domain-model.md — value-type modelling: relationships as id links, derive-don't-store, one currency per aggregate, immutable state with value equality.

Run scripts/check-money-violations.sh and scripts/verify-core.sh before a PR.

Non-negotiable rules

  1. Money is int minor units + a Currency — NEVER double/num/REAL. Binary floats cannot represent 0.01; drift silently corrupts totals the user can never re-derive. No money API accepts or returns double.
  2. Derive minor-units-per-major from the currency's real ISO-4217 exponent — NEVER hardcode * 100, / 100, or "2 decimals". Exponent is 0 for JPY/VND, 2 for USD/EUR, 3 for KWD/BHD/OMR. A hardcoded 100 is a 100× error for a 0-exponent currency and a 10× error for a 3-exponent one. Route through currency.minorPerMajor.
  3. Unknown currency code is a typed failure, never a silent default-to-2. The exponent table lists only shipped currencies; Currency.tryParse returns null and the caller emits a Failure.
  4. One currency per aggregate; cross-currency arithmetic is forbidden. Adding two Money of different currencies is a category error — throw (programmer error) or convert through the FX layer first. Keep currency a fact of the enclosing aggregate so Money arithmetic never has to guard it.
  5. Route EVERY division of money through one allocate(amount, weights) primitive. Shared items, tax proration, tip proration, discounts — all one rounding path, so "parts sum to the whole to the exact minor unit" is proven once and tested once.
  6. There are TWO rounding sites, not one: allocate() AND percent→minor-units. Round a percentage to integer minor units once before feeding allocate(). A naive double percent is a classic off-by-a-cent bug that allocate coverage will not catch.
  7. Never sum independently-rounded parts to get a total. Always allocate() a known integer total and let the parts absorb the residual.
  8. Derive totals; never store them. A denormalized stored total is the classic drift bug. Totals are computed from items + weights on read.
  9. Model relationships as stable-id links, not embedded copies. Give every entity an explicit final id (e.g. a UUID). Editing a price then leaves assignments intact and deleting a participant just drops them from link sets.
  10. Store canonically, convert at the edge. Physical quantities are whole SI base units (int metres / millilitres / minutes); time is a UTC DateTime. .from<DisplayUnit> factories round into canonical; to<DisplayUnit>() getters return a double used only at the presentation edge.
  11. Normalize digits/separators to ASCII BEFORE input reaches this core. Never call int.parse/double.parse/Decimal.parse on raw localized input — it throws on Eastern-Arabic numerals. Fold upstream (see i18n-rtl-l10n).
  12. Parse with decimal; round ONCE with an explicit mode at the boundary. Use package:decimal for exact division/parsing, apply an explicit RoundingMode (default half-even/banker's) once at the parse or final-total boundary — never on intermediate sums (accumulates bias).
  13. Inject package:clock's Clock; NEVER call DateTime.now(), never roll a bespoke ClockService. Every time-reading class in this pure core takes a Clock constructor arg; Riverpod/feature code injects the same Clock through a clockProvider (see service-boundary-and-native) so the two vocabularies compose. Fixed clocks / fake_async then make time-dependent logic deterministic in tests.
  14. The core stays Flutter-free and IO-free. Deps are only decimal and clock. Formatting lives in the presentation layer; storage in the data layer.

Read the full file on GitHub · 317 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 317 lines · 209 tokens per session scan A 01600049a6e3

Subscribe to this mod's changes

value-objects-money-and-units is a skill published in the GitHub repository zakariaf/Flutter-Skills (2 stars, last pushed 12d ago), licensed MIT. It adds 209 tokens to every session and 4,024 once invoked, about $0.0010 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.