{"success":true,"name":"keep-one-source-of-truth-for-every-piece-of-data","description":"The same information is stored, computed, or defined in two places.","category":"ai-brimind","path":"ai-brimind/keep-one-source-of-truth-for-every-piece-of-data/SKILL.md","file":"SKILL.md","content":"---\nname: keep-one-source-of-truth-for-every-piece-of-data\ndescription: \"The same information is stored, computed, or defined in two places.\"\n---\n\n# Keep One Source of Truth for Every Piece of Data\n\n## When to use\nA value, rule, or dataset exists in multiple locations (two variables, DB + cache + UI state, config duplicated across files), and they can disagree.\n\n## Example request\nCart total stored separately from the items list → items change, total doesn't; the UI shows a sum that's wrong — stored derived value. User's name kept in three tables/objects → an update hits two of three; screens disagree about the name — duplicated fact. The same validation limit hardcoded in frontend and backend → one gets updated; the two sides now enforce different rules — forked rule definition.\n\n## Instructions\nAct like an architect who asks of every piece of data: 'who OWNS this?' — exactly one place should. Apply three rules: (1) DERIVED values (totals, counts, filtered lists, formatted strings) should be COMPUTED from their source when needed, not stored alongside it — a stored copy of something computable is a disagreement waiting to happen; only cache it if measured performance demands it, and then name the invalidation trigger explicitly; (2) duplicated FACTS (a name in three places, a limit in two files) get one authoritative home; other locations either read from it or are generated from it — before adding any new copy of existing data, justify why referencing the original is impossible; (3) when duplication is forced (frontend needs the backend's rule for instant feedback, offline cache needs server data), make the copy's status explicit: which side is authoritative, how the copy syncs, and what happens on conflict. When you find disagreeing copies, don't just re-sync them — remove or subordinate one. Only proceed once every value in the change has exactly one owner you can name.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #1109\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}