What problem does it solve? Firestore writes to the Primitivão betting app have repeatedly caused data-loss scares: transient onSnapshot snapshots treated as resets, set() calls without merge wiping sibling fields, and reducers writing unwrapped state. This Skill encodes every known landmine so persistence code changes stop destroying production data. ## Core Features & Use Cases - Write-path discipline: Documents the commitBetDocUpdate reducer contract, including the { next } unwrapping rule and the protectMap guard that refuses to overwrite populated users/teamPlayers maps with empty objects. - Snapshot safety rules: Explains how to handle transient exists=false snapshots using hasLoadedRef checks and snap.metadata.fromCache so reconnects never trigger a fake reset or reseed. - Backup, restore, and wipe safeguards: Requires backups before restoreFromBackup or wipeAllData, merge:true on all top-level field writes, and Firestore security rules (delete: if false, notWipingJson shrink guard) verified as published in the Firebase Console. - Use Case: Before modifying the onSnapshot loader for the apostas document, consult this Skill to confirm the correct handling of cache snapshots and avoid recreating the document on a transient read. ## Quick Start Review the firestore-safety guidelines before I modify commitBetDocUpdate or any onSnapshot loader in the betting app.