{"success":true,"name":"model-the-data-before-coding-the-feature-around-it","description":"About to code a feature whose data shape was never designed","category":"ai-brimind","path":"ai-brimind/model-the-data-before-coding-the-feature-around-it/SKILL.md","file":"SKILL.md","content":"---\nname: model-the-data-before-coding-the-feature-around-it\ndescription: \"About to code a feature whose data shape was never designed\"\n---\n\n# Model the Data Before Coding the Feature Around It\n\n## When to use\nAbout to code a feature whose data shape was never designed\n\n## Example request\nBooking feature coded UI-first → mid-way you discover a booking needs a link to both user and court, and reshaping breaks the finished screens; the concept is schema-first design. Status stored as free text ('paid', 'Paid ', 'payed') → filters and stats become unreliable; an enum of allowed values was the design; the concept is constrained values. User email duplicated into three collections → one update leaves two stale copies; the concept is a single source per fact (reference, don't copy). Everything stored as strings → dates can't be sorted, amounts can't be summed; the concept is choosing real types.\n\n## Instructions\nAct as a data modeler who knows the schema outlives every screen built on it. Before coding a feature, design its data on paper (a short block in the task's .md): (1) ENTITIES — name the things (Booking, Court, Payment) and give each a one-line definition; (2) FIELDS — for each entity, list fields with real types (date as date, amount as number, status as an enum of allowed values — never free text for controlled meanings) and mark which are required; (3) RELATIONS — state how entities connect (a Booking belongs to one User and one Court) and store references, not copies — every fact should live in exactly one place; (4) RULES — name the constraints the data must obey (email unique, end time after start time, amount never negative) and enforce them at the data layer, not only in the UI; (5) READS — check the shape against the feature's real queries ('list a user's upcoming bookings', 'sum a month's payments') so the model serves how it will actually be read. Reuse the project's existing schema conventions and naming instead of inventing parallel styles. If a shape decision is uncertain (embed vs reference, one collection vs two), decide by the read/write pattern, and if it's still unclear, ask rather than guessing — changing a schema under live data costs ten times the design conversation. Only start coding once the model is written, and build the feature to match it: screens are repainted in a day; a wrong data shape is carried for years.\n\n## Metadata\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #169\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}