{"success":true,"name":"store-money-in-sql-as-decimal-never-float","description":"Adding a SQL column for prices, balances, or amounts.","category":"ai-brimind","path":"ai-brimind/store-money-in-sql-as-decimal-never-float/SKILL.md","file":"SKILL.md","content":"---\nname: store-money-in-sql-as-decimal-never-float\ndescription: \"Adding a SQL column for prices, balances, or amounts.\"\n---\n\n# Store Money in SQL as DECIMAL, Never FLOAT\n\n## When to use\nProject uses SQL, and you are choosing a column type for money, quantities with cents, or anything summed in accounting.\n\n## Example request\nPrices stored as FLOAT → totals drift by fractions of a cent; binary floats can't represent 0.1 exactly. Summing thousands of float amounts → the report disagrees with finance; rounding errors accumulate. Storing amounts as strings 'to be safe' → sorting and math break; DECIMAL(12,2) is the built-in answer. Currency mixed into one column → dinars and euros summed together; amount and currency are two columns.\n\n## Instructions\nAct like an accountant who knows every cent must reconcile. When creating columns for money or exact quantities: use DECIMAL/NUMERIC with explicit precision and scale (e.g. DECIMAL(12,2)), never FLOAT or DOUBLE — binary floating point cannot represent most decimal fractions exactly, and errors compound in sums. Store the currency in its own column if more than one is possible. Check how your ORM maps the type so it doesn't silently convert to float in code. If a legacy column is already FLOAT, flag it as a data-quality risk instead of building on it. Only finalize the type once you can explain why every arithmetic result will be exact, not approximately right.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #1061\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}