[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79AVGF4CRMT14MNP8QKT7TP":3,"skill-same:01M79AVGF4CRMT14MNP8QKT7TP":89},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":38,"commitSha":39,"skillDirectory":40,"forksCount":41,"repositoryHtmlUrl":42,"repositoryHomepageUrl":6,"ownerHtmlUrl":43,"ownerBlogUrl":44,"ownerDescription":6,"updatedAt":45,"install":46,"resources":58},"01M79AVGF4CRMT14MNP8QKT7TP","golang-samber-mo",null,"Monadic types for Golang using samber\u002Fmo — Option, Result, Either, Future, IO, Task, and State types for type-safe nullable values, error handling, and functional composition with pipeline sub-packages. Apply when using or adopting samber\u002Fmo, when the codebase imports `github.com\u002Fsamber\u002Fmo`, or when considering functional programming patterns as a safety design for Golang.","CCH-HQ\u002Fcchp-automation","CCH-HQ","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F253065381?v=4","01M79AG9QPRTJEVTCT1ZS7TM9J","CCH HQ","01M79AG9RNM4TAB3PJQH71X62P",2,"MIT","https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-samber-mo\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: golang-samber-mo\ndescription: \"Monadic types for Golang using samber\u002Fmo — Option, Result, Either, Future, IO, Task, and State types for type-safe nullable values, error handling, and functional composition with pipeline sub-packages. Apply when using or adopting samber\u002Fmo, when the codebase imports `github.com\u002Fsamber\u002Fmo`, or when considering functional programming patterns as a safety design for Golang.\"\nuser-invocable: true\nlicense: MIT\ncompatibility: Designed for Claude Code or similar AI coding agents, and for projects using Golang.\nmetadata:\n  author: samber\n  version: \"1.0.7\"\n  openclaw:\n    emoji: \"🎭\"\n    homepage: https:\u002F\u002Fgithub.com\u002Fsamber\u002Fcc-skills-golang\n    requires:\n      bins:\n        - go\n    install: []\n    skill-library-version: \"1.16.0\"\nallowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent WebFetch mcp__context7__resolve-library-id mcp__context7__query-docs AskUserQuestion Bash(godig:*) Bash(gopls:*) LSP mcp__gopls__*\n---\n\n**Persona:** You are a Go engineer bringing functional programming safety to Go. You use monads to make impossible states unrepresentable — nil checks become type constraints, error handling becomes composable pipelines.\n\n**Thinking mode:** Use `ultrathink` when designing multi-step Option\u002FResult\u002FEither pipelines. Wrong type choice creates unnecessary wrapping\u002Funwrapping that defeats the purpose of monads.\n\n# samber\u002Fmo — Monads and Functional Abstractions for Go\n\nGo 1.18+ library providing type-safe monadic types with zero dependencies. Inspired by Scala, Rust, and fp-ts.\n\n**Official Resources:**\n\n- [pkg.go.dev\u002Fgithub.com\u002Fsamber\u002Fmo](https:\u002F\u002Fpkg.go.dev\u002Fgithub.com\u002Fsamber\u002Fmo)\n- [github.com\u002Fsamber\u002Fmo](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fmo)\n\nThis skill is not exhaustive. Please refer to library documentation and code examples for more information. For Go package docs, symbols, versions, importers, and known vulnerabilities, → See `samber\u002Fcc-skills-golang@golang-pkg-go-dev` skill (`godig`) — prefer it over Context7 for Go package facts. To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See `samber\u002Fcc-skills-golang@golang-gopls` skill (`gopls`). Context7 remains a fallback for docs not indexed on pkg.go.dev.\n\n```bash\ngo get github.com\u002Fsamber\u002Fmo\n```\n\nFor an introduction to functional programming concepts and why monads are valuable in Go, see [Monads Guide](.\u002Freferences\u002Fmonads-guide.md).\n\n## Core Types at a Glance\n\n| Type | Purpose | Think of it as... |\n| --- | --- | --- |\n| `Option[T]` | Value that may be absent | Rust's `Option`, Java's `Optional` |\n| `Result[T]` | Operation that may fail | Rust's `Result\u003CT, E>`, replaces `(T, error)` |\n| `Either[L, R]` | Value of one of two types | Scala's `Either`, TypeScript discriminated union |\n| `EitherX[L, R]` | Value of one of X types | Scala's `Either`, TypeScript discriminated union |\n| `Future[T]` | Async value not yet available | JavaScript `Promise` |\n| `IO[T]` | Lazy synchronous side effect | Haskell's `IO` |\n| `Task[T]` | Lazy async computation | fp-ts `Task` |\n| `State[S, A]` | Stateful computation | Haskell's `State` monad |\n\n## Option[T] — Nullable Values Without nil\n\nRepresents a value that is either present (`Some`) or absent (`None`). Eliminates nil pointer risks at the type level.\n\n```go\nimport \"github.com\u002Fsamber\u002Fmo\"\n\nname := mo.Some(\"Alice\")          \u002F\u002F Option[string] with value\nempty := mo.None[string]()        \u002F\u002F Option[string] without value\nfromPtr := mo.PointerToOption(ptr) \u002F\u002F nil pointer -> None\n\n\u002F\u002F Safe extraction\nname.OrElse(\"Anonymous\")  \u002F\u002F \"Alice\"\nempty.OrElse(\"Anonymous\")  \u002F\u002F \"Anonymous\"\n\n\u002F\u002F Transform if present, skip if absent\nupper := name.Map(func(s string) (string, bool) {\n    return strings.ToUpper(s), true\n})\n```\n\n**Key methods:** `Some`, `None`, `Get`, `MustGet`, `OrElse`, `OrEmpty`, `Map`, `FlatMap`, `Match`, `ForEach`, `ToPointer`, `IsPresent`, `IsAbsent`.\n\nOption implements `json.Marshaler\u002FUnmarshaler`, `sql.Scanner`, `driver.Valuer` — use it directly in JSON structs and database models.\n\nFor full API reference, see [Option Reference](.\u002Freferences\u002Foption.md).\n\n## Result[T] — Error Handling as Values\n\nRepresents success (`Ok`) or failure (`Err`). Equivalent to `Either[error, T]` but specialized for Go's error pattern.\n\n```go\n\u002F\u002F Wrap Go's (value, error) pattern\nresult := mo.TupleToResult(os.ReadFile(\"config.yaml\"))\n\n\u002F\u002F Same-type transform — errors short-circuit automatically\nupper := mo.Ok(\"hello\").Map(func(s string) (string, error) {\n    return strings.ToUpper(s), nil\n})\n\u002F\u002F Ok(\"HELLO\")\n\n\u002F\u002F Extract with fallback\nval := upper.OrElse(\"default\")\n```\n\n**Go limitation:** Direct methods (`.Map`, `.FlatMap`) cannot change the type parameter — `Result[T].Map` returns `Result[T]`, not `Result[U]`. Go methods cannot introduce new type parameters. For type-changing transforms (e.g. `Result[[]byte]` to `Result[Config]`), use sub-package functions or `mo.Do`:\n\n```go\nimport \"github.com\u002Fsamber\u002Fmo\u002Fresult\"\n\n\u002F\u002F Type-changing pipeline: []byte -> Config -> ValidConfig\nparsed := result.Pipe2(\n    mo.TupleToResult(os.ReadFile(\"config.yaml\")),\n    result.Map(func(data []byte) Config { return parseConfig(data) }),\n    result.FlatMap(func(cfg Config) mo.Result[ValidConfig] { return validate(cfg) }),\n)\n```\n\n**Key methods:** `Ok`, `Err`, `Errf`, `TupleToResult`, `Try`, `Get`, `MustGet`, `OrElse`, `Map`, `FlatMap`, `MapErr`, `Match`, `ForEach`, `ToEither`, `IsOk`, `IsError`.\n\nFor full API reference, see [Result Reference](.\u002Freferences\u002Fresult.md).\n\n## Either[L, R] — Discriminated Union of Two Types\n\nRepresents a value that is one of two possible types. Unlike Result, neither side implies success or failure — both are valid alternatives.\n\n```go\n\u002F\u002F API that returns either cached data or fresh data\nfunc fetchUser(id string) mo.Either[CachedUser, FreshUser] {\n    if cached, ok := cache.Get(id); ok {\n        return mo.Left[CachedUser, FreshUser](cached)\n    }\n    return mo.Right[CachedUser, FreshUser](db.Fetch(id))\n}\n\n\u002F\u002F Pattern match\nresult := fetchUser(\"user-123\")\nresult.Match(\n    func(cached CachedUser) mo.Either[CachedUser, FreshUser] { \u002F* use cached *\u002F },\n    func(fresh FreshUser) mo.Either[CachedUser, FreshUser] { \u002F* use fresh *\u002F },\n)\n```\n\n**When to use Either vs Result:** Use `Result[T]` when one path is an error. Use `Either[L, R]` when both paths are valid alternatives (cached vs fresh, left vs right, strategy A vs B).\n\n`Either3[T1, T2, T3]`, `Either4`, and `Either5` extend this to 3-5 type variants.\n\nFor full API reference, see [Either Reference](.\u002Freferences\u002Feither.md).\n\n## Do Notation — Imperative Style with Monadic Safety\n\n`mo.Do` wraps imperative code in a `Result`, catching panics from `MustGet()` calls:\n\n```go\nresult := mo.Do(func() int {\n    \u002F\u002F MustGet panics on None\u002FErr — Do catches it as Result error\n    a := mo.Some(21).MustGet()\n    b := mo.Ok(2).MustGet()\n    return a * b  \u002F\u002F 42\n})\n\u002F\u002F result is Ok(42)\n\nresult := mo.Do(func() int {\n    val := mo.None[int]().MustGet()  \u002F\u002F panics\n    return val\n})\n\u002F\u002F result is Err(\"no such element\")\n```\n\nDo notation bridges imperative Go style with monadic safety — write straight-line code, get automatic error propagation.\n\n## Pipeline Sub-Packages vs Direct Chaining\n\nsamber\u002Fmo provides two ways to compose operations:\n\n**Direct methods** (`.Map`, `.FlatMap`) — work when the output type equals the input type:\n\n```go\nopt := mo.Some(42)\ndoubled := opt.Map(func(v int) (int, bool) {\n    return v * 2, true\n})  \u002F\u002F Option[int]\n```\n\n**Sub-package functions** (`option.Map`, `result.Map`) — required when the output type differs from input:\n\n```go\nimport \"github.com\u002Fsamber\u002Fmo\u002Foption\"\n\n\u002F\u002F int -> string type change: use sub-package Map\nstrOpt := option.Map(func(v int) string {\n    return fmt.Sprintf(\"value: %d\", v)\n})(mo.Some(42))  \u002F\u002F Option[string]\n```\n\n**Pipe functions** (`option.Pipe3`, `result.Pipe3`) — chain multiple type-changing transformations readably:\n\n```go\nimport \"github.com\u002Fsamber\u002Fmo\u002Foption\"\n\nresult := option.Pipe3(\n    mo.Some(42),\n    option.Map(func(v int) string { return strconv.Itoa(v) }),\n    option.Map(func(s string) []byte { return []byte(s) }),\n    option.FlatMap(func(b []byte) mo.Option[string] {\n        if len(b) > 0 { return mo.Some(string(b)) }\n        return mo.None[string]()\n    }),\n)\n```\n\n**Rule of thumb:** Use direct methods for same-type transforms. Use sub-package functions + pipes when types change across steps.\n\nFor detailed pipeline API reference, see [Pipelines Reference](.\u002Freferences\u002Fpipelines.md).\n\n## Common Patterns\n\n### JSON API responses with Option\n\n```go\ntype UserResponse struct {\n    Name     string            `json:\"name\"`\n    Nickname mo.Option[string] `json:\"nickname\"`  \u002F\u002F omits null gracefully\n    Bio      mo.Option[string] `json:\"bio\"`\n}\n```\n\n### Database nullable columns\n\n```go\ntype User struct {\n    ID       int\n    Email    string\n    Phone    mo.Option[string]  \u002F\u002F implements sql.Scanner + driver.Valuer\n}\n\nerr := row.Scan(&u.ID, &u.Email, &u.Phone)\n```\n\n### Wrapping existing Go APIs\n\n```go\n\u002F\u002F Convert map lookup to Option\nfunc MapGet[K comparable, V any](m map[K]V, key K) mo.Option[V] {\n    return mo.TupleToOption(m[key])  \u002F\u002F m[key] returns (V, bool)\n}\n```\n\n### Uniform extraction with Fold\n\n`mo.Fold` works uniformly across Option, Result, and Either via the `Foldable` interface:\n\n```go\nstr := mo.Fold[error, int, string](\n    mo.Ok(42),  \u002F\u002F works with Option, Result, or Either\n    func(v int) string { return fmt.Sprintf(\"got %d\", v) },\n    func(err error) string { return \"failed\" },\n)\n\u002F\u002F \"got 42\"\n```\n\n## Best Practices\n\n1. **Prefer `OrElse` over `MustGet`** — `MustGet` panics on absent\u002Ferror values; use it only inside `mo.Do` blocks where panics are caught, or when you are certain the value exists\n2. **Use `TupleToResult` at API boundaries** — convert Go's `(T, error)` to `Result[T]` at the boundary, then chain with `Map`\u002F`FlatMap` inside your domain logic\n3. **Use `Result[T]` for errors, `Either[L, R]` for alternatives** — Result is specialized for success\u002Ffailure; Either is for two valid types\n4. **Option for nullable fields, not zero values** — `Option[string]` distinguishes \"absent\" from \"empty string\"; use plain `string` when empty string is a valid value\n5. **Chain, don't nest** — `result.Map(...).FlatMap(...).OrElse(default)` reads left-to-right; avoid nested if\u002Felse patterns when monadic chaining is cleaner\n6. **Use sub-package pipes for multi-step type transformations** — when 3+ steps each change the type, `option.Pipe3(...)` is more readable than nested function calls\n\nFor advanced types (Future, IO, Task, State), see [Advanced Types Reference](.\u002Freferences\u002Fadvanced-types.md).\n\nIf you encounter a bug or unexpected behavior in samber\u002Fmo, open an issue at \u003Chttps:\u002F\u002Fgithub.com\u002Fsamber\u002Fmo\u002Fissues>.\n\n## Cross-References\n\n- -> See `samber\u002Fcc-skills-golang@golang-samber-lo` skill for functional collection transforms (Map, Filter, Reduce on slices) that compose with mo types\n- -> See `samber\u002Fcc-skills-golang@golang-error-handling` skill for idiomatic Go error handling patterns\n- -> See `samber\u002Fcc-skills-golang@golang-safety` skill for nil-safety and defensive Go coding\n- -> See `samber\u002Fcc-skills-golang@golang-database` skill for database access patterns\n- -> See `samber\u002Fcc-skills-golang@golang-design-patterns` skill for functional options and other Go patterns\n","**Persona:** You are a Go engineer bringing functional programming safety to Go. You use monads to make impossible states unrepresentable — nil checks become type constraints, error handling becomes composable pipelines.\n\n**Thinking mode:** Use `ultrathink` when designing multi-step Option\u002FResult\u002FEither pipelines. Wrong type choice creates unnecessary wrapping\u002Funwrapping that defeats the purpose of monads.\n\n# samber\u002Fmo — Monads and Functional Abstractions for Go\n\nGo 1.18+ library providing type-safe monadic types with zero dependencies. Inspired by Scala, Rust, and fp-ts.\n\n**Official Resources:**\n\n- [pkg.go.dev\u002Fgithub.com\u002Fsamber\u002Fmo](https:\u002F\u002Fpkg.go.dev\u002Fgithub.com\u002Fsamber\u002Fmo)\n- [github.com\u002Fsamber\u002Fmo](https:\u002F\u002Fgithub.com\u002Fsamber\u002Fmo)\n\nThis skill is not exhaustive. Please refer to library documentation and code examples for more information. For Go package docs, symbols, versions, importers, and known vulnerabilities, → See `samber\u002Fcc-skills-golang@golang-pkg-go-dev` skill (`godig`) — prefer it over Context7 for Go package facts. To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See `samber\u002Fcc-skills-golang@golang-gopls` skill (`gopls`). Context7 remains a fallback for docs not indexed on pkg.go.dev.\n\n```bash\ngo get github.com\u002Fsamber\u002Fmo\n```\n\nFor an introduction to functional programming concepts and why monads are valuable in Go, see [Monads Guide](.\u002Freferences\u002Fmonads-guide.md).\n\n## Core Types at a Glance\n\n| Type | Purpose | Think of it as... |\n| --- | --- | --- |\n| `Option[T]` | Value that may be absent | Rust's `Option`, Java's `Optional` |\n| `Result[T]` | Operation that may fail | Rust's `Result\u003CT, E>`, replaces `(T, error)` |\n| `Either[L, R]` | Value of one of two types | Scala's `Either`, TypeScript discriminated union |\n| `EitherX[L, R]` | Value of one of X types | Scala's `Either`, TypeScript discriminated union |\n| `Future[T]` | Async value not yet available | JavaScript `Promise` |\n| `IO[T]` | Lazy synchronous side effect | Haskell's `IO` |\n| `Task[T]` | Lazy async computation | fp-ts `Task` |\n| `State[S, A]` | Stateful computation | Haskell's `State` monad |\n\n## Option[T] — Nullable Values Without nil\n\nRepresents a value that is either present (`Some`) or absent (`None`). Eliminates nil pointer risks at the type level.\n\n```go\nimport \"github.com\u002Fsamber\u002Fmo\"\n\nname := mo.Some(\"Alice\")          \u002F\u002F Option[string] with value\nempty := mo.None[string]()        \u002F\u002F Option[string] without value\nfromPtr := mo.PointerToOption(ptr) \u002F\u002F nil pointer -> None\n\n\u002F\u002F Safe extraction\nname.OrElse(\"Anonymous\")  \u002F\u002F \"Alice\"\nempty.OrElse(\"Anonymous\")  \u002F\u002F \"Anonymous\"\n\n\u002F\u002F Transform if present, skip if absent\nupper := name.Map(func(s string) (string, bool) {\n    return strings.ToUpper(s), true\n})\n```\n\n**Key methods:** `Some`, `None`, `Get`, `MustGet`, `OrElse`, `OrEmpty`, `Map`, `FlatMap`, `Match`, `ForEach`, `ToPointer`, `IsPresent`, `IsAbsent`.\n\nOption implements `json.Marshaler\u002FUnmarshaler`, `sql.Scanner`, `driver.Valuer` — use it directly in JSON structs and database models.\n\nFor full API reference, see [Option Reference](.\u002Freferences\u002Foption.md).\n\n## Result[T] — Error Handling as Values\n\nRepresents success (`Ok`) or failure (`Err`). Equivalent to `Either[error, T]` but specialized for Go's error pattern.\n\n```go\n\u002F\u002F Wrap Go's (value, error) pattern\nresult := mo.TupleToResult(os.ReadFile(\"config.yaml\"))\n\n\u002F\u002F Same-type transform — errors short-circuit automatically\nupper := mo.Ok(\"hello\").Map(func(s string) (string, error) {\n    return strings.ToUpper(s), nil\n})\n\u002F\u002F Ok(\"HELLO\")\n\n\u002F\u002F Extract with fallback\nval := upper.OrElse(\"default\")\n```\n\n**Go limitation:** Direct methods (`.Map`, `.FlatMap`) cannot change the type parameter — `Result[T].Map` returns `Result[T]`, not `Result[U]`. Go methods cannot introduce new type parameters. For type-changing transforms (e.g. `Result[[]byte]` to `Result[Config]`), use sub-package functions or `mo.Do`:\n\n```go\nimport \"github.com\u002Fsamber\u002Fmo\u002Fresult\"\n\n\u002F\u002F Type-changing pipeline: []byte -> Config -> ValidConfig\nparsed := result.Pipe2(\n    mo.TupleToResult(os.ReadFile(\"config.yaml\")),\n    result.Map(func(data []byte) Config { return parseConfig(data) }),\n    result.FlatMap(func(cfg Config) mo.Result[ValidConfig] { return validate(cfg) }),\n)\n```\n\n**Key methods:** `Ok`, `Err`, `Errf`, `TupleToResult`, `Try`, `Get`, `MustGet`, `OrElse`, `Map`, `FlatMap`, `MapErr`, `Match`, `ForEach`, `ToEither`, `IsOk`, `IsError`.\n\nFor full API reference, see [Result Reference](.\u002Freferences\u002Fresult.md).\n\n## Either[L, R] — Discriminated Union of Two Types\n\nRepresents a value that is one of two possible types. Unlike Result, neither side implies success or failure — both are valid alternatives.\n\n```go\n\u002F\u002F API that returns either cached data or fresh data\nfunc fetchUser(id string) mo.Either[CachedUser, FreshUser] {\n    if cached, ok := cache.Get(id); ok {\n        return mo.Left[CachedUser, FreshUser](cached)\n    }\n    return mo.Right[CachedUser, FreshUser](db.Fetch(id))\n}\n\n\u002F\u002F Pattern match\nresult := fetchUser(\"user-123\")\nresult.Match(\n    func(cached CachedUser) mo.Either[CachedUser, FreshUser] { \u002F* use cached *\u002F },\n    func(fresh FreshUser) mo.Either[CachedUser, FreshUser] { \u002F* use fresh *\u002F },\n)\n```\n\n**When to use Either vs Result:** Use `Result[T]` when one path is an error. Use `Either[L, R]` when both paths are valid alternatives (cached vs fresh, left vs right, strategy A vs B).\n\n`Either3[T1, T2, T3]`, `Either4`, and `Either5` extend this to 3-5 type variants.\n\nFor full API reference, see [Either Reference](.\u002Freferences\u002Feither.md).\n\n## Do Notation — Imperative Style with Monadic Safety\n\n`mo.Do` wraps imperative code in a `Result`, catching panics from `MustGet()` calls:\n\n```go\nresult := mo.Do(func() int {\n    \u002F\u002F MustGet panics on None\u002FErr — Do catches it as Result error\n    a := mo.Some(21).MustGet()\n    b := mo.Ok(2).MustGet()\n    return a * b  \u002F\u002F 42\n})\n\u002F\u002F result is Ok(42)\n\nresult := mo.Do(func() int {\n    val := mo.None[int]().MustGet()  \u002F\u002F panics\n    return val\n})\n\u002F\u002F result is Err(\"no such element\")\n```\n\nDo notation bridges imperative Go style with monadic safety — write straight-line code, get automatic error propagation.\n\n## Pipeline Sub-Packages vs Direct Chaining\n\nsamber\u002Fmo provides two ways to compose operations:\n\n**Direct methods** (`.Map`, `.FlatMap`) — work when the output type equals the input type:\n\n```go\nopt := mo.Some(42)\ndoubled := opt.Map(func(v int) (int, bool) {\n    return v * 2, true\n})  \u002F\u002F Option[int]\n```\n\n**Sub-package functions** (`option.Map`, `result.Map`) — required when the output type differs from input:\n\n```go\nimport \"github.com\u002Fsamber\u002Fmo\u002Foption\"\n\n\u002F\u002F int -> string type change: use sub-package Map\nstrOpt := option.Map(func(v int) string {\n    return fmt.Sprintf(\"value: %d\", v)\n})(mo.Some(42))  \u002F\u002F Option[string]\n```\n\n**Pipe functions** (`option.Pipe3`, `result.Pipe3`) — chain multiple type-changing transformations readably:\n\n```go\nimport \"github.com\u002Fsamber\u002Fmo\u002Foption\"\n\nresult := option.Pipe3(\n    mo.Some(42),\n    option.Map(func(v int) string { return strconv.Itoa(v) }),\n    option.Map(func(s string) []byte { return []byte(s) }),\n    option.FlatMap(func(b []byte) mo.Option[string] {\n        if len(b) > 0 { return mo.Some(string(b)) }\n        return mo.None[string]()\n    }),\n)\n```\n\n**Rule of thumb:** Use direct methods for same-type transforms. Use sub-package functions + pipes when types change across steps.\n\nFor detailed pipeline API reference, see [Pipelines Reference](.\u002Freferences\u002Fpipelines.md).\n\n## Common Patterns\n\n### JSON API responses with Option\n\n```go\ntype UserResponse struct {\n    Name     string            `json:\"name\"`\n    Nickname mo.Option[string] `json:\"nickname\"`  \u002F\u002F omits null gracefully\n    Bio      mo.Option[string] `json:\"bio\"`\n}\n```\n\n### Database nullable columns\n\n```go\ntype User struct {\n    ID       int\n    Email    string\n    Phone    mo.Option[string]  \u002F\u002F implements sql.Scanner + driver.Valuer\n}\n\nerr := row.Scan(&u.ID, &u.Email, &u.Phone)\n```\n\n### Wrapping existing Go APIs\n\n```go\n\u002F\u002F Convert map lookup to Option\nfunc MapGet[K comparable, V any](m map[K]V, key K) mo.Option[V] {\n    return mo.TupleToOption(m[key])  \u002F\u002F m[key] returns (V, bool)\n}\n```\n\n### Uniform extraction with Fold\n\n`mo.Fold` works uniformly across Option, Result, and Either via the `Foldable` interface:\n\n```go\nstr := mo.Fold[error, int, string](\n    mo.Ok(42),  \u002F\u002F works with Option, Result, or Either\n    func(v int) string { return fmt.Sprintf(\"got %d\", v) },\n    func(err error) string { return \"failed\" },\n)\n\u002F\u002F \"got 42\"\n```\n\n## Best Practices\n\n1. **Prefer `OrElse` over `MustGet`** — `MustGet` panics on absent\u002Ferror values; use it only inside `mo.Do` blocks where panics are caught, or when you are certain the value exists\n2. **Use `TupleToResult` at API boundaries** — convert Go's `(T, error)` to `Result[T]` at the boundary, then chain with `Map`\u002F`FlatMap` inside your domain logic\n3. **Use `Result[T]` for errors, `Either[L, R]` for alternatives** — Result is specialized for success\u002Ffailure; Either is for two valid types\n4. **Option for nullable fields, not zero values** — `Option[string]` distinguishes \"absent\" from \"empty string\"; use plain `string` when empty string is a valid value\n5. **Chain, don't nest** — `result.Map(...).FlatMap(...).OrElse(default)` reads left-to-right; avoid nested if\u002Felse patterns when monadic chaining is cleaner\n6. **Use sub-package pipes for multi-step type transformations** — when 3+ steps each change the type, `option.Pipe3(...)` is more readable than nested function calls\n\nFor advanced types (Future, IO, Task, State), see [Advanced Types Reference](.\u002Freferences\u002Fadvanced-types.md).\n\nIf you encounter a bug or unexpected behavior in samber\u002Fmo, open an issue at \u003Chttps:\u002F\u002Fgithub.com\u002Fsamber\u002Fmo\u002Fissues>.\n\n## Cross-References\n\n- -> See `samber\u002Fcc-skills-golang@golang-samber-lo` skill for functional collection transforms (Map, Filter, Reduce on slices) that compose with mo types\n- -> See `samber\u002Fcc-skills-golang@golang-error-handling` skill for idiomatic Go error handling patterns\n- -> See `samber\u002Fcc-skills-golang@golang-safety` skill for nil-safety and defensive Go coding\n- -> See `samber\u002Fcc-skills-golang@golang-database` skill for database access patterns\n- -> See `samber\u002Fcc-skills-golang@golang-design-patterns` skill for functional options and other Go patterns\n",{"name":5,"license":15,"metadata":24,"description":7,"allowed-tools":35,"compatibility":36,"user-invocable":37},{"author":25,"version":26,"openclaw":27},"samber","1.0.7",{"emoji":28,"install":29,"homepage":30,"requires":31,"skill-library-version":34},"🎭",[],"https:\u002F\u002Fgithub.com\u002Fsamber\u002Fcc-skills-golang",{"bins":32},[33],"go","1.16.0","Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent WebFetch mcp__context7__resolve-library-id mcp__context7__query-docs AskUserQuestion Bash(godig:*) Bash(gopls:*) LSP mcp__gopls__*","Designed for Claude Code or similar AI coding agents, and for projects using Golang.",true,"main","a93764baed707eda5a68d91e19e5719368e6335e","skills-backup\u002Fskills\u002Fgolang-samber-mo",0,"https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation","https:\u002F\u002Fgithub.com\u002FCCH-HQ","https:\u002F\u002Fclaude-code-hub.app\u002F","2026-11-09 20:50:54",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":37},[48,51,54],{"tool":49,"command":50},"npx","npx skills add CCH-HQ\u002Fcchp-automation --skill golang-samber-mo",{"tool":52,"command":53},"bunx","bunx skills add CCH-HQ\u002Fcchp-automation --skill golang-samber-mo",{"tool":55,"command":56},"pnpm","pnpm dlx skills add CCH-HQ\u002Fcchp-automation --skill golang-samber-mo","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-samber-mo\u002FSKILL.md",[59,65,69,73,77,81,85],{"path":60,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":63,"sourceHtmlUrl":64},"evals\u002Fevals.json","REFERENCE","参考文档",23740,"https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-samber-mo\u002Fevals\u002Fevals.json",{"path":66,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":67,"sourceHtmlUrl":68},"references\u002Fadvanced-types.md",7520,"https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-samber-mo\u002Freferences\u002Fadvanced-types.md",{"path":70,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":71,"sourceHtmlUrl":72},"references\u002Feither.md",4887,"https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-samber-mo\u002Freferences\u002Feither.md",{"path":74,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Fmonads-guide.md",6897,"https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-samber-mo\u002Freferences\u002Fmonads-guide.md",{"path":78,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":79,"sourceHtmlUrl":80},"references\u002Foption.md",4490,"https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-samber-mo\u002Freferences\u002Foption.md",{"path":82,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":83,"sourceHtmlUrl":84},"references\u002Fpipelines.md",5317,"https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-samber-mo\u002Freferences\u002Fpipelines.md",{"path":86,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Fresult.md",3664,"https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fgolang-samber-mo\u002Freferences\u002Fresult.md",[90,97,104,111,118,125],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M79B44RKSB6Z0GENGYFCCZYA","writing-skills","Use when creating new skills, editing existing skills, or verifying skills work before deployment","https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fwriting-skills\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M79B410BHDSNHZ7MKAYXWJHS","writing-plans","Use when you have a spec or requirements for a multi-step task, before touching code","https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fwriting-plans\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":19},"01M79B3XK29MCD5HGD50YGYXQZ","wizard","Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.","https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fwizard\u002FSKILL.md",[],[],{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":19},"01M79B3TFQEXXM2KK5V44H64DV","wayfinder","Plan a huge chunk of work — more than one agent session can hold — as a shared map of decision tickets on your issue tracker, and resolve them one at a time until the way to the destination is clear.","https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fwayfinder\u002FSKILL.md",[],[],{"skillNo":119,"name":120,"nameZh":6,"description":121,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":19},"01M79B3Q3WTMJDM6NNGG1X4NYK","verification-before-completion","Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always","https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fverification-before-completion\u002FSKILL.md",[],[],{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":19},"01M79B3GW8YCKT7W489HKWFMNC","vercel-react-best-practices","React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React\u002FNext.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.","https:\u002F\u002Fgithub.com\u002FCCH-HQ\u002Fcchp-automation\u002Fblob\u002Fmain\u002Fskills-backup\u002Fskills\u002Fvercel-react-best-practices\u002FSKILL.md",[],[]]