{"success":true,"name":"handle-every-known-case-and-make-the-unknown-case-impossible","description":"Branching on a status or type that has a fixed set of values","category":"ai-brimind","path":"ai-brimind/handle-every-known-case-and-make-the-unknown-case-impossible/SKILL.md","file":"SKILL.md","content":"---\nname: handle-every-known-case-and-make-the-unknown-case-impossible\ndescription: \"Branching on a status or type that has a fixed set of values\"\n---\n\n# Handle Every Known Case, and Make the Unknown Case Impossible to Miss\n\n## When to use\nYou are writing a switch or if-chain over an enum-like value (status, role, type), or adding a new value to a set that existing branches consume.\n\n## Example request\nswitch handles three statuses, silently skips the fourth → the new 'refunded' state falls through and nothing happens; swallowed case. default branch does nothing → future values pass unnoticed forever; silent default. a new role added → five scattered branch points, only three updated; unfound consumers. — each lets an unhandled case slip by quietly.\n\n## Instructions\nAct as a doorman with a guest list who stops anyone not on it — never waves strangers through. When branching over a value with a fixed set of cases, handle every current case explicitly, and make the default branch an alarm, not a shrug: an unknown value should fail loudly with the value named, because it means either bad data or a case someone added without telling this code. Never use the default as a lazy stand-in for the last real case — spell that case out, so the default only ever means 'genuinely unknown'. When adding a new value to the set, hunt every place that branches on it — search for the type's other values to find them all — and update each one deliberately; the set's definition and its consumers must move together. If the language or tooling can enforce exhaustiveness, turn that on and let it do the hunting. Only proceed when every consumer either handles the new case or fails loudly on it — a status that three screens understand and the fourth ignores is a bug wearing a delay.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #728\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}