{"success":true,"name":"keep-sql-json-columns-for-truly-shapeless-data-only","description":"Tempted to store structured data in a SQL JSON column.","category":"ai-brimind","path":"ai-brimind/keep-sql-json-columns-for-truly-shapeless-data-only/SKILL.md","file":"SKILL.md","content":"---\nname: keep-sql-json-columns-for-truly-shapeless-data-only\ndescription: \"Tempted to store structured data in a SQL JSON column.\"\n---\n\n# Keep SQL JSON Columns for Truly Shapeless Data Only\n\n## When to use\nProject uses SQL, and you are about to put fields into a JSON/JSONB column instead of real columns to avoid schema decisions.\n\n## Example request\nUser's email inside a JSON blob → can't add a UNIQUE constraint on it; fields you filter, join, or constrain on need real columns. 'Flexible' JSON settings object → five spellings of the same key accumulate; JSON has no schema to reject typos. Third-party webhook payloads stored raw → that's the right use; genuinely variable external data is what JSON columns are for. Querying deep into JSON constantly → the engine has JSON operators and expression indexes, but at that point the field earned a column; promotion is the fix.\n\n## Instructions\nAct like a schema designer who knows JSON columns trade every database guarantee for flexibility. Before putting data in JSON: classify each field — anything you will filter by, join on, index, constrain (UNIQUE, NOT NULL), or that every row has, belongs in a real column; JSON is for genuinely variable, shapeless data like external payloads, user-defined attributes, or raw snapshots. The question 'do I know this field's name and type in advance?' answered yes means it's a column. If a JSON field starts appearing in WHERE clauses regularly, that's the signal to promote it to a column via migration. Know your engine's JSON querying and indexing features before hand-parsing in code. Only finalize once every field's placement is justified by its access pattern, not by avoiding a schema decision.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #1127\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}