Money as Integer Minor Units
Specify how we store and display money. Integers in minor units. One currency per row. No binary floats. DOMAIN Currencies: [USD, OR A LIST] What we store: [PRICES, BALANCES, TAX LINES] Display locales: [LIST] Rounding rule for tax: [HALF UP OR THE RULE I NAME] DELIVER 1) The column type: integer minor units plus a currency code. The check constraint that the currency is one we support. 2) The TypeScript type that does not allow a number of dollars to be added to cents by accident. A function to format for display using Intl, and a parse function for input that rejects "1.2.3" and handles currencies with zero decimals if I listed one. 3) Addition and allocation: how we split a discount across lines without losing a cent. Show the remainder going to the last line. 4) The bugs you will comment on in review: float columns, money math in the client as the source of truth, formatting with a hardcoded "$". 5) A test set: $0.10 + $0.20, a 10% discount on $0.05, and a zero-decimal currency if applicable. Do not use JavaScript number arithmetic for the ledger. Integer math only.
🌟 Example Output / Preview
Prompt Metadata
Primary Use Cases:
- •Legacy code modernization & technical refactoring
- •Full-stack layout generation & component structuring
- •CI/CD workflow automation & unit/E2E testing suites
Associated Tags:
💡 Pro Tips & Advice
1. Use bracketed items: Be sure to fill out all [PLACEHOLDER] elements with specific details before sending the prompt to the AI model.
2. Adjust temperature: For creative tasks, set AI temperature higher (e.g., 0.8), or lower (e.g., 0.2) for strict coding/technical tasks.
🔗 Related AI Prompts
Full SaaS Landing Page Build Spec (SEO + Conversion)
You are a Staff Product Designer + Frontend Engineer + SEO strategist. Build a complete, production-ready marketing landing page f...
SaaS Analytics Dashboard Full Build Spec
You are a Principal Product Designer + Frontend Lead. Design and specify a complete [LIGHT | DARK] analytics dashboard for [PRODUC...
SaaS Admin Panel Dashboard Build Spec
Design a full internal Admin Dashboard for [PRODUCT_NAME] used by [ADMIN_ROLE: support | ops | super-admin]. --- 🎯 CONTEXT Adm...