integer-money

Store monetary values as integer cents in schemas, handlers, and tests.

59|14|Updated Mar 1, 2026
One-click install
npx skills add https://github.com/vobase/vobase --skill integer-money
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: integer-money
Source: https://github.com/vobase/vobase/tree/main/packages/cli/skills/integer-money
Command: npx skills add https://github.com/vobase/vobase --skill integer-money

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill helps you avoid floating point errors by requiring monetary values to be stored as integer cents, ensuring exact totals across invoices, taxes, and reports.

Core Features & Use Cases

  • Store money as cents using fields like amount_cents, tax_cents, and total_cents to keep arithmetic precise.
  • Keep business logic in cents by performing all calculations in integer units and converting to display format only at the UI boundary.
  • Schema guidance for Drizzle ORM definitions and naming conventions to enforce consistent money handling across modules.

Quick Start

Configure schemas and services to store monetary values in cents and perform calculations in integer units, converting to dollars only for display.

Frequently Asked Questions about integer-money

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent floating point rounding errors when storing money in a database schema?

Storing money as integer cents prevents floating point rounding errors by keeping all monetary values in exact whole-number units like amount_cents. You perform arithmetic operations directly on these integers and convert to decimal format only at the UI boundary for display.

What is the best way to handle currency calculations in backend handlers?

The best way to handle currency calculations in backend handlers is keeping all business logic in integer cents. You compute totals, taxes, and invoice amounts using whole numbers to guarantee precision, deferring any division or decimal conversion until the final user-facing display layer.

Does Drizzle ORM support defining money fields as integer cents?

Yes, Drizzle ORM supports defining money fields as integer cents. You can apply this approach by creating schema definitions using integer column types with *_cents naming conventions to enforce consistent money handling across your financial modules.

Why should I use integer cents instead of decimals for invoice and order totals?

You should use integer cents instead of decimals for invoice and order totals to ensure exact arithmetic across financial calculations. Decimal types can introduce subtle floating point errors during complex tax and report computations, whereas integers guarantee precise totals.

How do I name database columns for monetary values to maintain data integrity?

To maintain data integrity for monetary values, name database columns using the *_cents suffix, such as amount_cents, tax_cents, and total_cents. This naming convention enforces consistent money handling and clearly signals to developers that values are integers.

When should I convert integer cents back to dollars for user display?

You should convert integer cents back to dollars only at the UI boundary for user display. Keep all internal business logic, schema storage, and arithmetic operations in integer cents, transforming the exact values to decimal format exclusively for the final presentation layer.