What problem does it solve?
This Skill helps Go developers replace unsafe nil handling and repetitive error-checking with type-safe monadic composition using samber/mo, reducing runtime panics and control-flow boilerplate.
Core Features & Use Cases
- Option[T] for absence without nil: model nullable values (e.g., optional config, missing cache entries, nullable DB fields) so callers handle None explicitly.
- Result[T] for composable error handling: represent success/failure and chain transformations while errors short-circuit automatically.
- Either[L,R] for two valid alternatives: represent cases where neither outcome is inherently an error (e.g., cached vs fresh data).
- Pipeline sub-packages for type-changing steps: use option/, result/, and either/ functions when chaining changes types across steps.
- Do notation and MustGet safety: write imperative-style code inside mo.Do where MustGet panics are caught and converted into Result errors.
- Serialization + DB friendliness: use Option in JSON and as sql.Scanner/driver.Valuer for nullable columns without separate DTOs.
Quick Start
Ask the AI to show how to refactor a Go function to return mo.Option or mo.Result and demonstrate a safe pipeline with option.Map/FlatMap or mo.Do.