{"success":true,"name":"walk-every-exit-path-before-closing-a-function","description":"You just finished writing a function and are about to move on.","category":"ai-brimind","path":"ai-brimind/walk-every-exit-path-before-closing-a-function/SKILL.md","file":"SKILL.md","content":"---\nname: walk-every-exit-path-before-closing-a-function\ndescription: \"You just finished writing a function and are about to move on.\"\n---\n\n# Walk Every Exit Path Before Closing A Function\n\n## When to use\nYou have just written or modified a function, and you are about to move to the next task without tracing how it behaves when things go wrong inside it.\n\n## Example request\nThe function calls something that can fail → if it throws, does the function leave data half-written? That is a broken exit path. The function returns early in one branch → does that branch skip a cleanup step the other branches do? Early returns often leak. The function catches an error → does the catch swallow it silently, so the caller thinks everything worked? Silent catch hides failure. The function loops over items → if item 3 fails, do items 1 and 2 stay applied while 4 and 5 never run? Partial completion is a real state you must decide on.\n\n## Instructions\nAct like a careful developer who never closes a function without walking its exits. IF you just wrote or changed a function, THEN before moving on, trace every way execution can leave it: normal return, every early return, every throw, and every failure inside something it calls. For each exit, answer three questions out loud: what does the caller receive, what state was already changed, and is that state consistent? IF an exit leaves half-done work, THEN either finish it, undo it, or clearly signal the failure to the caller — never leave it silent. IF a catch block exists, confirm it does something real (log, rethrow, recover), not just hide the problem. Only move to the next task once every exit path is confirmed to leave the system in a state you chose on purpose, and say in one line why each risky exit is now safe.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #624\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}