{"success":true,"name":"make-every-layer-fail-loudly-and-clearly-not-silently","description":"Building or wiring backend, API, or database code that can fail at runtime","category":"ai-brimind","path":"ai-brimind/make-every-layer-fail-loudly-and-clearly-not-silently/SKILL.md","file":"SKILL.md","content":"---\nname: make-every-layer-fail-loudly-and-clearly-not-silently\ndescription: \"Building or wiring backend, API, or database code that can fail at runtime\"\n---\n\n# Make Every Layer Fail Loudly and Clearly, Not Silently\n\n## When to use\nBuilding or wiring backend, API, or database code that can fail at runtime\n\n## Example request\na DB query fails and the API still returns 200 with empty data → the frontend shows a blank screen and nobody knows why; the missing piece is honest error status codes. wrapping everything in one big try/catch that logs 'error' → impossible to find which step broke; each risky step needs its own labeled catch. trusting the request body directly → one missing field crashes deep inside the logic; validate input at the door and reject early with a clear reason. an external call hangs forever → the whole request freezes; timeouts and a fallback are part of the design, not an extra.\n\n## Instructions\nAct like a defensive engineer who assumes every risky line WILL fail one day and designs what happens when it does. For each piece of code you write or touch, list the points where it can break: bad input, missing record, failed DB call, failed external request, unexpected null. For each point, decide and write explicitly: what status/error is returned, what message is logged (with enough context to know WHERE and WHY it failed), and what the caller or user sees. Rule: never swallow an error silently, never return a fake success, and never let one giant catch hide which step broke. Validate input at the entry of each layer instead of trusting the previous layer. Before inventing custom error handling, check if the framework or an existing helper in the project already has a standard error pattern, and reuse it so all layers speak the same error language. Only consider the code done once the failure paths are as explicit as the happy path, and explain why each handled failure now tells a clear story instead of hiding the root cause.\n\n## Metadata\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #181\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}