Add silent-failures-are-evil skill

Every failure path leaves a trace in the logs, and no failure is
invented without checking what the API actually returns. Prompted by
diigo-cache's password-manager save reporting "not saved" on success
(CredentialsContainer.store() resolves with undefined).

Generated-by: Claude Opus 5.5
This commit is contained in:
dckc committed 2026-10-07 02:27:12 -05:00
1 parent 792e535a56
commit a9750957cd
1 file changed
+36
+36
View File
@@ -0,0 +1,36 @@
---
name: silent-failures-are-evil
description: No silent failures — use when writing or reviewing error handling: catch blocks, promise rejections, fallbacks for unsupported features, or any branch that treats a result as "didn't work"; when a UI shows a failure with nothing logged; when someone says "silent failure". Every failure path leaves a trace in the logs, and no failure is invented without checking what the API actually returns.
---
# Silent failures are evil
A failure nobody can see is a failure nobody can fix. Every failure path
must leave a trace.
## the rules
- **Log every failure path**: a caught exception, a rejected promise, a
falsy result treated as "didn't work", an unsupported-feature
fallback. Changing a label on screen is not enough — log it, with an
`event` tag for grepping, and no secrets (no keys, cookies, header or
param values).
- **Don't invent failures.** Before branching on a result, check what
the API actually returns (the spec or MDN, not a guess). A success
misreported as failure is as bad as a failure reported as nothing.
- **Say only what you know.** When an API can't tell you the outcome,
report what it did tell you ("offered", not "saved").
- **Make it testable.** Pass the logger in (see
[ocap-discipline](../ocap-discipline/SKILL.md)) so a test can assert
that the failure path logged; a discovered silent failure is a goof
that owes a test ([lazy-tdd](../lazy-tdd/SKILL.md)).
## the goof that prompted this
diigo-cache's password-manager save button said "not saved", with
nothing in the console. The code read `c ? "saved" : "not saved"` on the
result of [`CredentialsContainer.store()`](https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/store),
which resolves with `undefined` per spec — even on success. So every
save was reported as a failure, silently. The fix
(`capsite/diigo-cache/src/pm-save.ts`) reports "offered", logs every
outcome, and is covered by `tests/pm-save.test.ts`.