{"success":true,"name":"add-logging-so-the-first-bug-report-debugs-itself","description":"Delivering logic that will fail silently and mysteriously when it fails.","category":"ai-brimind","path":"ai-brimind/add-logging-so-the-first-bug-report-debugs-itself/SKILL.md","file":"SKILL.md","content":"---\nname: add-logging-so-the-first-bug-report-debugs-itself\ndescription: \"Delivering logic that will fail silently and mysteriously when it fails.\"\n---\n\n# Add Logging So the First Bug Report Debugs Itself\n\n## When to use\nYou are shipping code with failure-prone operations (network, parsing, background jobs), and it currently reports nothing when things go wrong.\n\n## Example request\na background job that dies quietly → the report is 'it stopped working, no idea when'; start/finish/error logs turn that into a timestamped answer. a failing API call swallowed by an empty catch → the bug is invisible by design; logging the status and body makes it self-reporting. a data import that skips bad rows silently → totals are wrong and nobody knows why; a per-skip log line with the reason is the audit trail. an error message saying 'something went wrong' → it tells the debugger nothing; including the operation and the cause makes it the first clue.\n\n## Instructions\nAct like a developer who debugs tomorrow's bug today, by making the code narrate its own failures. When shipping logic with failure-prone operations, add purposeful logging in the SAME response: log the start and outcome of significant operations, log every error with its actual cause and the identifying context (which record, which request, which step), and never leave an empty catch block — silence is the most expensive log level. The few lines of logging you write now convert the future bug report from a mystery ('it broke sometime, somehow') into a solved case ('record 4521 failed parsing at 14:02: missing field X') — that difference is an entire debugging session you just deleted. Log with judgment: failures and milestones, not every variable on every line — noise buries signal as surely as silence does — and never log secrets, passwords, or tokens. Use the project's existing logger if one exists rather than introducing a second logging style. End by noting where the logs will appear and what a healthy run versus a failing run looks like in them.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #592\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}