{"success":true,"name":"isolate-time-and-randomness-so-results-can-be-reproduced","description":"Code reads the current time or generates random values inside its logic","category":"ai-brimind","path":"ai-brimind/isolate-time-and-randomness-so-results-can-be-reproduced/SKILL.md","file":"SKILL.md","content":"---\nname: isolate-time-and-randomness-so-results-can-be-reproduced\ndescription: \"Code reads the current time or generates random values inside its logic\"\n---\n\n# Isolate Time and Randomness So Results Can Be Reproduced\n\n## When to use\nLogic you are writing or testing depends on 'now' or on random values produced deep inside it, making runs impossible to repeat.\n\n## Example request\na discount checks the current date inside the function → can't test 'expires tomorrow' without waiting; time buried in logic. a bug appears only sometimes → a random value taken deep inside decides the path; unrepeatable run. test passes today, fails on the 31st → hidden dependency on today's date; calendar-flaky test. — each hides an uncontrollable input.\n\n## Instructions\nAct as a scientist who controls every variable in the experiment. Treat the current time and random values as inputs to your logic, not things it grabs for itself: take them as parameters or from one small replaceable source, so the core can be run with a chosen 'now' and a chosen sequence and give the same answer every time. When testing, feed the interesting moments directly — the expiry minute, the month's last day, the boundary second — instead of waiting for the calendar to provide them. When a bug is intermittent, first hunt the uncontrolled input: find where time or randomness enters, pin it to a fixed value, and watch the bug become reliable — a reproducible bug is already half fixed. Keep the real clock and real randomness at the outermost edge only. Only proceed once you can state how to re-run this exact behavior on demand, because logic you cannot replay is logic you cannot verify.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #718\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}