{"success":true,"name":"choose-soft-delete-or-hard-delete-deliberately","description":"Adding a delete feature and about to DELETE rows without deciding policy.","category":"ai-brimind","path":"ai-brimind/choose-soft-delete-or-hard-delete-deliberately/SKILL.md","file":"SKILL.md","content":"---\nname: choose-soft-delete-or-hard-delete-deliberately\ndescription: \"Adding a delete feature and about to DELETE rows without deciding policy.\"\n---\n\n# Choose Soft Delete or Hard Delete Deliberately\n\n## When to use\nA feature removes records (members, orders, channels), and whether data should be recoverable, referenced elsewhere, or truly erased hasn't been decided.\n\n## Example request\nOrder rows hard-deleted → old invoices now reference nothing; reports change retroactively — deleted data was load-bearing. Soft delete added but half the queries forget the filter → 'deleted' items keep appearing in lists and counts — inconsistent deleted_at filtering. Everything kept forever 'just in case' → user demands real erasure of personal data; the system can't — no true-delete path.\n\n## Instructions\nAct like a developer who knows delete is a policy decision wearing a technical costume. Before implementing, answer three questions: Is this data REFERENCED by other records (orders, history, stats)? Might a human need to UNDO or inspect the deletion? Is there an obligation to truly ERASE it (personal data)? Then choose: (1) HARD delete for genuinely disposable, unreferenced data — and check what cascades: what else references this row and what happens to it; (2) SOFT delete (deleted_at timestamp) when history, references, or undo matter — but commit to the full cost: EVERY read path must filter it out (centralize the filter in one query layer/scope rather than repeating it per query, because one forgotten filter equals ghost data), and unique constraints must account for deleted rows blocking re-creation; (3) hybrid where law or privacy requires: soft delete for operation, plus a real purge path that erases or anonymizes on demand or schedule. State the chosen policy per entity in one sentence. Only proceed once deleted items provably vanish from every list, count, and search — and the recovery (or true-erasure) story is stated.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #1169\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}