{"success":true,"name":"design-for-failure-assume-every-part-of-the-system-will-go-d","description":"Designing a multi-part system assuming every piece will always be up","category":"ai-brimind","path":"ai-brimind/design-for-failure-assume-every-part-of-the-system-will-go-d/SKILL.md","file":"SKILL.md","content":"---\nname: design-for-failure-assume-every-part-of-the-system-will-go-d\ndescription: \"Designing a multi-part system assuming every piece will always be up\"\n---\n\n# Design for Failure: Assume Every Part of the System Will Go Down\n\n## When to use\nDesigning a multi-part system assuming every piece will always be up\n\n## Example request\nEmail provider is down during signup → the whole registration fails because sending was in the same breath as creating the account; the concept is separating critical from deferrable work (account first, email queued/retried after). Payment webhook arrives twice → the user is charged or credited twice; the concept is idempotency (processing the same event again changes nothing). External API hangs 60 seconds → every request thread waits and the whole app freezes; the concept is timeouts on every external call. Cron crashed silently for a week → nobody noticed until data was missing; the concept is heartbeat/failure alerts for background jobs.\n\n## Instructions\nAct as a resilience architect whose design question is never 'will this fail?' but 'WHEN this fails, what does the user see and what does the data look like?' For every external dependency and moving part in the system (DB, third-party APIs, mail, payments, file storage, crons), decide at design time: (1) CRITICAL OR DEFERRABLE — split each flow: what must succeed synchronously for the user's action to count (the DB write), and what can be deferred and retried later (emails, notifications, syncs)? Never let a deferrable failure kill a critical success; (2) TIMEOUTS EVERYWHERE — every external call gets an explicit timeout; without one, a slow dependency becomes YOUR outage; (3) RETRY WITH CARE — transient failures get limited retries with backoff, but ONLY on operations safe to repeat, which forces: (4) IDEMPOTENCY — any operation that money, webhooks, or retries can trigger twice must be built so the second time changes nothing (unique keys on operations, check-before-apply, event IDs recorded as processed); (5) DEGRADE HONESTLY — when a part is down, the system says so specifically ('payments are temporarily unavailable') and keeps the rest working, instead of a blank global crash; (6) WATCH THE INVISIBLE — background jobs and crons report success somewhere a human checks, so their silence is noticed in hours, not weeks. Write these decisions into the feature's .md as its failure plan. If the cost of a failure path is unclear ('can we lose an email? can we double-send?'), ask the project owner — those are business decisions. Solid systems aren't the ones where nothing breaks; they're the ones where breakage is expected, contained, and boring.\n\n## Metadata\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #177\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}