db-types-precision
Installation
SKILL.md
db-types-precision (M4)
The type is the first and cheapest constraint: it decides what values are even representable and how they sort, compare, and round. The classic data-loss bug — money in a float — lives here. This module is design-axis (Tipos category, shared with M6). It applies across paradigms with paradigm-appropriate type vocabularies (Postgres numeric, Mongo Decimal128).
What it checks
- Money as float:
float/real/double precision(or MongoDouble) for currency/amounts — binary floating point cannot represent decimal cents exactly. Usenumeric/decimal/Decimal128/integer-minor-units. This is the severity-5 cap. - Timestamps & timezone: naive
timestamp/datetime(without time zone) for instants that cross zones; prefertimestamptzstored in UTC. Flagtimestampcolumns named*_atlacking tz. - jsonb as schema evasion: a
jsonb/jsoncolumn carrying what should be first-class typed/constrained columns (stable, queried, FK-related keys buried in JSON). Embedding flexible blobs is fine; hiding the schema is not. - enum vs lookup: native
ENUM(esp. MySQLENUM, hard to alter) where a referenced lookup table would be safer to evolve; or free-text status where a constrained domain is needed. - Charset/collation: MySQL
utf8(3-byte, no emoji/astral) instead ofutf8mb4; an unintended case-sensitive or accent-sensitive collation on identifiers/emails.
Axis & severity
- Money in float/double: severity 5,
fail, axisdesign, confidenceestablished(caps the Design score). - Naive timestamp for cross-zone instant: severity 3–4,
warn, axisdesign. - jsonb hiding a stable queried schema: severity 3,
warn,fixable: proposed. - MySQL
utf8(not utf8mb4): severity 3,warn. - enum-as-lock-in / wrong collation: severity 2–3,
warn.