{"success":true,"name":"test-sql-update-and-delete-with-a-select-first","description":"Ready to run a SQL UPDATE or DELETE and its WHERE feels right.","category":"ai-brimind","path":"ai-brimind/test-sql-update-and-delete-with-a-select-first/SKILL.md","file":"SKILL.md","content":"---\nname: test-sql-update-and-delete-with-a-select-first\ndescription: \"Ready to run a SQL UPDATE or DELETE and its WHERE feels right.\"\n---\n\n# Test SQL UPDATE and DELETE With a SELECT First\n\n## When to use\nProject uses SQL, and you have an UPDATE or DELETE written and are about to execute it without having seen which rows it matches.\n\n## Example request\nWHERE clause looks obviously correct → it matched rows with NULLs you forgot; assumptions are not verification. Copied WHERE from another query → the other query had an extra JOIN narrowing it; context changed the scope. 'It's only dev data' → the connection string pointed at staging; the habit protects you when it counts. Quick fix under pressure → pressure is exactly when scope errors happen; the SELECT costs ten seconds.\n\n## Instructions\nAct like a careful operator who never fires a write blind. Before executing any UPDATE or DELETE: rewrite it as SELECT (or SELECT COUNT(*)) with the identical WHERE clause and run that first. Compare the matched rows and count against what you expected out loud — if they differ, the WHERE is wrong, not the data. Prefer wrapping the write in a transaction so you can inspect the result and roll back. Only run the real statement after the SELECT confirms the exact scope, and state the expected row count so the actual affected count can be checked against it.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #1023\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}