neverthrow-wrap-exceptions
Installation
SKILL.md
Neverthrow Exception Wrapping
Goal
Capture recoverable exceptions with neverthrow helpers instead of ad hoc try/catch.
This skill governs exception capture only. If the task also changes public return signatures, use neverthrow-return-types alongside this skill.
Detect Exception Sources
-
Identify where failures currently enter the code.
- Look for hand-written
try/catch,.catch(...)wrappers used only for conversion, direct calls to known throwing APIs, and promise-returning functions that may reject. - Check third-party libraries, parsers, database clients, network clients, file-system helpers, schema validators, and serialization code.
- Look for hand-written
-
Distinguish the failure shape before choosing a wrapper.
- Use the synchronous path when the operation may throw before returning a value.
- Use the promise-function path when the operation returns a promise but may still throw before that promise exists.
- Use the promise-instance path when you already have a
PromiseLikevalue in hand.