{"success":true,"name":"inventory-the-side-effects-of-every-write-one-save-can-rippl","description":"A create/update action also triggers notifications, counters, or related updates","category":"ai-brimind","path":"ai-brimind/inventory-the-side-effects-of-every-write-one-save-can-rippl/SKILL.md","file":"SKILL.md","content":"---\nname: inventory-the-side-effects-of-every-write-one-save-can-rippl\ndescription: \"A create/update action also triggers notifications, counters, or related updates\"\n---\n\n# Inventory the Side Effects of Every Write: One Save Can Ripple Into Emails, Stats, and Other Records\n\n## When to use\nA write operation (new payment, cancelled booking, member added) is supposed to ripple into other things — emails, derived fields, related records — and that ripple list exists nowhere except scattered in code.\n\n## Example request\n'Cancel booking' must free the court slot, notify the member, adjust the coach's schedule, and update stats → the endpoint does two of the four; the other two were in someone's head, and nobody can say which without reading all the code. The ripple list written as a plain checklist next to the service function → new developers (and new AI sessions) see the FULL contract of the action, not just the lines that got implemented. The same action reachable from three places — user click, admin panel, cron auto-cancel → only the service-function owner guarantees all three trigger the same ripples; your logic-out-of-routes discipline is what makes one inventory enforceable. A ripple that is optional-for-the-response (email) vs required (freeing the slot) → your background-work discipline sorts the inventory into 'must happen atomically' and 'must happen eventually, observably'.\n\n## Instructions\nAct as the keeper of cause-and-effect in the system: every meaningful write is not one change but a small storm — the record itself, its derived numbers, its related records, its notifications — and the difference between a solid app and a haunted one is whether that storm is INVENTORIED somewhere humans can read, or exists only as whatever the code currently happens to do. For every business action that writes, do this: (1) Write the effect inventory in plain words before (or while) implementing: 'When a booking is cancelled: slot becomes available again, member gets email, coach schedule updates, monthly stats decrement, refund created if paid.' Keep it as a comment block on the service function or in the feature's doc — the point is one authoritative list, findable next to the code that must honor it. (2) Sort the inventory with your existing disciplines: which effects are TRANSACTIONAL (must succeed or fail with the main write — slot release, refund record → your all-or-nothing discipline), which are EVENTUAL (email, push — → your background-work discipline: after the response, logged, retry-able), and which are DERIVED data (stats, counters → your derived-numbers discipline: owner, atomic binding or reconciliation). Every effect gets a bucket; an unbucketed effect is an unreliable one. (3) Enforce single-path execution: the action lives in ONE service function that performs or dispatches the whole inventory, and every trigger source — user endpoint, admin tool, cron job, import script — calls that function; the inventory is only a guarantee if there is no side door that writes the record while skipping the ripples. Grep for direct model writes to that entity outside the service as the smell. (4) When adding a NEW effect later ('now cancellations also notify the treasurer'), update the inventory FIRST, then the code — and glance at your blast-radius habit: new effects often mean new failure modes for old callers. (5) Verify against the list, not against memory: trigger the action once through each entry path and check off every inventory line — including watching the eventual ones land. Only call the action implemented when the written inventory and the executed reality match line for line — an action whose side effects live only in code is an action nobody fully knows, including the person who wrote it.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #246\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}