Install any skill in seconds. Free to start, no credit card required.
Get Started Free →oliver-kriska/narrow-bare-rescue
Narrow bare rescue in Elixir so real errors like KeyError and typos propagate instead of being swallowed. Use to audit rescues and refactor error handling.
Passed 15 of 21 test cases with the skill, and 11 of 21 without it.
and 2 more in the full report
4 fixed12 passed either way6 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 4 test cases the skill fixed. Same model, same prompt, with and without the skill.
Show the Elixir syntax transformation for converting def process(x) do String.to_integer(x) rescue e -> :error end into a typed rescue block that captures the exception struct as e.
| Checked | Without skill | With skill |
|---|---|---|
| Uses rescue e in [ArgumentError] -> :error syntax preserving the variable binding e. | Missed | Passed |
The instructions your model reads when the skill loads.
Turn rescue _ -> fallback into rescue _ in [ExceptionType1, ExceptionType2] -> fallback
so programmer bugs propagate while known failure modes stay handled.
Bare rescues (rescue _ ->, rescue e -> — any form without an in clause) swallow
every exception, including UndefinedFunctionError from typos, KeyError from
misspelled map keys, and CompileError from bad HEEx templates. The symptom isn't a stack
trace — it's a silent {:error, :generic} or a nil fallback. Bugs that should surface
in tests or error reporters become quiet degradations.
The Erlang Secure Coding Guide makes
the same case at the BEAM level — rule LNG-002 ("Do Not Use catch") warns that the
legacy catch-all form conflates normal returns, throws, and errors. Bare rescue in Elixir
is the direct analogue.
rescue _ -> or rescue e -> without an in clause. Every rescue must
list exact exception types. The Credo check enforces this after cleanup lands.UndefinedFunctionError,
CompileError, BadFunctionError, and BadArityError must propagate.reraise e, __STACKTRACE__, never reraise e, []. Preserve the original stack
trace so Oban retry metadata and error reporters show the real origin.mix compile --warnings-as-errors before committing. Typos in exception module
names only surface at compile time — the code looks fine until it loads.# Before — masks programmer bugs
def parse(body) do
Jason.decode!(body)
rescue
_ -> %{}
end
test cases passed, vs 11 / 21 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.