golang-samber-mo
Skill3.4k starsChanged 2 months agoMITView on GitHub
Monadic types for Golang using samber/mo — 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/mo, when the codebase imports `github.com/samber/mo`, or when considering functional programming patterns as a safety design for Golang. Not for nil-safety and zero-value design without this library (→ See `samber/cc-skills-golang@golang-safety` skill), nor for native error wrapping with fmt.Errorf, errors.Is and errors.As (→ See `samber/cc-skills-golang@golang-error-handling` skill).
- Installs packages
3 other projects use a version of this, 2 of them edited.
Trending
Quiet since October.about the whole repository
Most recently taken up by
- rzisso/golang-skillsword for word, first seen Sep 16, 2026
- alexastrum/skledited, first seen Jun 12, 2026
- guynhsichngeodiec/cc-skills-golangedited, first seen Apr 7, 2026
Who's talking about samber/cc-skills-golang
- @golangch.bsky.social“A collection of Golang agentic skills that works #golang github.com/samber/cc-s...”Bluesky · Jul 16, 2026 · 10 likes
- @samber.bsky.social“My Go skill set: github.com/samber/cc-skills-golang npx skills add samber/cc-skills-golang Open to …”Bluesky · Mar 23, 2026 · 6 likes
- LobsterTrap/lola“[FEATURE] - Cherry Pick Skills”GitHub · May 6, 2026 · 3 reactions
- @golangch.bsky.social“Claude Code Skills for production-ready Golang projects #golang github.com/samber/cc-s...”Bluesky · Mar 29, 2026 · 3 likes
- A Hacker News story“A collection of 35 Golang Agent Skills”Hacker News · Mar 23, 2026 · 3 points
The biggest 5 of 45 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 45
Talked about on GitHub, Bluesky and Hacker News (45 times).
On GitHub · 41
- May 6, 2026[FEATURE] - Cherry Pick Skills — LobsterTrap/lola3 reactions · 1 comment
- Jul 16, 2026Skills with nested metadata maps are silently dropped during discovery — charmbracelet/crush1 reaction
- Mar 30, 2026[SUBMISSION] cc-skills-golang — ProSkillsMD/proskills1 reaction · 1 comment
- Oct 4, 2026claude-code-plugins.github.samber.cc-skills-golang: init at 2.0.0 — sudosubin/agents.nix0 reactions
- Oct 1, 2026agent-skills.github.samber.cc-skills-golang: init at 2.0.0 — sudosubin/agents.nix0 reactions
36 more on GitHub
- Sep 23, 2026Update skill: /samber-golang-structs-interfaces (safe risk) — aiskillstore/marketplace0 reactions
- Sep 23, 2026Update skill: /samber-golang-spf13-viper (safe risk) — aiskillstore/marketplace0 reactions
- Sep 23, 2026Update skill: /samber-golang-benchmark (medium risk) — aiskillstore/marketplacesays it tested it0 reactions
- Sep 23, 2026Update skill: /samber-golang-pkg-go-dev (high risk) — aiskillstore/marketplace0 reactions
- Sep 23, 2026Update skill: /samber-golang-samber-ro (safe risk) — aiskillstore/marketplace0 reactions
- Sep 23, 2026Update skill: /samber-golang-uber-fx (safe risk) — aiskillstore/marketplace0 reactions
- Sep 23, 2026Update skill: /samber-golang-stretchr-testify (safe risk) — aiskillstore/marketplace0 reactions
- Sep 23, 2026Update skill: /samber-golang-swagger (safe risk) — aiskillstore/marketplace0 reactions
- Sep 23, 2026Update skill: /samber-golang-stay-updated (safe risk) — aiskillstore/marketplace0 reactions
- Sep 6, 2026Update skill: /samber-golang-spf13-cobra (safe risk) — aiskillstore/marketplace0 reactions
- Sep 6, 2026Update skill: /samber-golang-cli (safe risk) — aiskillstore/marketplace0 reactions
- Sep 6, 2026Update skill: /samber-golang-lint (medium risk) — aiskillstore/marketplace0 reactions
- Sep 6, 2026Update skill: /samber-golang-samber-slog (medium risk) — aiskillstore/marketplace0 reactions
- Sep 6, 2026Update skill: /samber-golang-modernize (safe risk) — aiskillstore/marketplace0 reactions
- Sep 6, 2026Update skill: /samber-golang-samber-lo (safe risk) — aiskillstore/marketplace0 reactions
- Sep 6, 2026Update skill: /samber-golang-documentation (safe risk) — aiskillstore/marketplace0 reactions
- Sep 5, 2026corpus tier3 cites an id with no path: the largest source's provenance handle cannot be followed — jonhill90/agent-estate0 reactions · 1 comment
- Sep 3, 2026chore: sync upstream skills (auto) — marcioaltoe/skills0 reactions
- Sep 2, 2026chore: sync upstream skills (auto) — marcioaltoe/skills0 reactions
- Aug 19, 2026add `samber` golang skills — greenbone/opensight-golang-libraries0 reactions · 4 comments
- Jul 17, 2026fix: import skills with nested metadata and surface parse errors — gridctl/gridctl0 reactions
- Jul 17, 2026fix: skill import fails on nested metadata frontmatter with misleading 'no SKILL.md files found' error — gridctl/gridctl0 reactions
- Jul 16, 2026chore: sync upstream skills — marcioaltoe/skills0 reactions
- Jul 3, 2026New skill: /samber-golang-performance (safe risk) — aiskillstore/marketplace0 reactions
- Jul 1, 2026New skill: /samber-golang-error-handling (low risk) — aiskillstore/marketplace0 reactions
- Jul 1, 2026New skill: /samber-golang-code-style (low risk) — aiskillstore/marketplace0 reactions
- Jun 26, 2026Integrate samber/cc-skills-golang: install full general-purpose set + full-list reminder at plan & each scenario — ArcadeAI/safeword0 reactions · 3 comments
- Jun 26, 2026[FEATURE] Add Golang skills selectively — inference-gateway/cli0 reactions
- Jun 24, 2026chore(skills): sync upstream skills — marcioaltoe/skills0 reactions
- Jun 7, 2026feature/naming-linting-testing-skills — joekhosbayar/go-mightysays it tested it0 reactions
- May 22, 2026🔐 ci: pin + sandbox the skills install in claude-review.yml — martinciu/ccpulse0 reactions
- May 21, 2026🔐 ci: pin or sandbox the unpinned npx skills install in claude-review.yml — martinciu/ccpulse0 reactions · 1 comment
- Apr 25, 2026Audit candidate: samber/cc-skills-golang — xiaolai/nlpm0 reactions · 3 comments
- Mar 30, 2026[Resource]: cc-skills-golang — hesreallyhim/awesome-claude-code0 reactions · 1 comment
- Mar 29, 2026golang skills — sushichan044/dotfiles0 reactions
- Mar 22, 2026Add a claude code skills for Golang — jqueryscript/awesome-claude-code0 reactions
On Bluesky · 3
- Jul 16, 2026A collection of Golang agentic skills that works #golang github.com/samber/cc-s... — @golangch.bsky.social10 likes and reposts
- Mar 23, 2026My Go skill set: github.com/samber/cc-skills-golang npx skills add samber/cc-skills-golang Open to contributions. If you're building skills… — @samber.bsky.social6 likes and reposts
- Mar 29, 2026Claude Code Skills for production-ready Golang projects #golang github.com/samber/cc-s... — @golangch.bsky.social3 likes and reposts · 1 reply
On Hacker News · 1
- Mar 23, 2026A collection of 35 Golang Agent Skills3 points · 2 comments
Other versions3 projects use a version of this.
Word for word · 1
- rzisso/golang-skills★ 0100% same
Edited · 2
- alexastrum/skl★ 1097% same
- guynhsichngeodiec/cc-skills-golang★ 097% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository46 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- golang-benchmarkSkill
- golang-cliSkill
- golang-code-styleSkill
- golang-concurrencySkill
- golang-contextSkill
- golang-continuous-integrationSkill
- golang-databaseSkill
- golang-data-structuresSkill
- golang-dependency-injectionSkill
- golang-dependency-managementSkill
- golang-design-patternsSkill
- golang-documentationSkill
- golang-error-handlingSkill
- golang-google-wireSkill
- golang-goplsSkill
- golang-graphqlSkill
- golang-grpcSkill
- golang-how-toSkill
- golang-lintSkill
- golang-modernizeSkill
- golang-namingSkill
- golang-observabilitySkill
- golang-performanceSkill
- golang-pkg-go-devSkill
- golang-popular-librariesSkill
- golang-project-layoutSkill
- golang-refactoringSkill
- golang-safetySkill
- golang-samber-doSkill
- golang-samber-hotSkill
- golang-samber-loSkill
- golang-samber-oopsSkill
- golang-samber-roSkill
- golang-samber-slogSkill
- golang-securitySkill
- golang-spf13-cobraSkill
- golang-spf13-viperSkill
- golang-stay-updatedSkill
- golang-stretchr-testifySkill
- golang-structs-interfacesSkill
- golang-swaggerSkill
- golang-testingSkill
- golang-troubleshootingSkill
- golang-uber-digSkill
- golang-uber-fxSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 144
When to use Either vs Result: Use Result[T] when one path is an error.
- Distinctive: line 170
Do notation bridges imperative Go style with monadic safety — write straight-line code, get automatic error propagation.
- Distinctive: line 212
Rule of thumb: Use direct methods for same-type transforms.
- Distinctive: line 273
If you encounter a bug or unexpected behavior in samber/mo, open an issue at <https://github.com/samber/mo/issues>.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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.
Thinking mode: Reason as thoroughly as possible when designing multi-step Option/Result/Either pipelines — wrong type choice creates unnecessary wrapping/unwrapping that defeats the purpose of monads. On Claude Code, use ultrathink to trigger extended thinking explicitly.
samber/mo — Monads and Functional Abstractions for Go
Go 1.18+ library providing type-safe monadic types with zero dependencies. Inspired by Scala, Rust, and fp-ts.
Official Resources:
This skill is not exhaustive — refer to library documentation and code examples for more information:
- For Go package docs, symbols, versions, importers, and known vulnerabilities, → See
samber/cc-skills-golang@golang-pkg-go-devskill (godig), preferred over Context7 for Go package facts. - To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See
samber/cc-skills-golang@golang-goplsskill (gopls). - Context7 remains a fallback for docs not indexed on pkg.go.dev.
go get github.com/samber/moFor an introduction to functional programming concepts and why monads are valuable in Go, see Monads Guide.
Core Types at a Glance
| Type | Purpose | Think of it as... |
Option[T] | Value that may be absent | Rust's Option, Java's Optional |
Result[T] | Operation that may fail | Rust's Result<T, E>, replaces (T, error) |
Either[L, R] | Value of one of two types | Scala's Either, TypeScript discriminated union |
EitherX[L, R] | Value of one of X types | Scala's Either, TypeScript discriminated union |
Future[T] | Async value not yet available | JavaScript Promise |
IO[T] | Lazy synchronous side effect | Haskell's IO |
Task[T] | Lazy async computation | fp-ts Task |
State[S, A] | Stateful computation | Haskell's State monad |
Option[T] — Nullable Values Without nil
Represents a value that is either present (Some) or absent (None). Eliminates nil pointer risks at the type level.
import "github.com/samber/mo"
name := mo.Some("Alice") // Option[string] with value
empty := mo.None[string]() // Option[string] without value
fromPtr := mo.PointerToOption(ptr) // nil pointer -> None
// Safe extraction
name.OrElse("Anonymous") // "Alice"
empty.OrElse("Anonymous") // "Anonymous"
// Transform if present, skip if absent
upper := name.Map(func(s string) (string, bool) {
return strings.ToUpper(s), true
})Key methods: Some, None, Get, MustGet, OrElse, OrEmpty, Map, FlatMap, Match, ForEach, ToPointer, IsPresent, IsAbsent.
Option implements json.Marshaler/Unmarshaler, sql.Scanner, driver.Valuer — use it directly in JSON structs and database models.
For full API reference, see Option Reference.
Result[T] — Error Handling as Values
Represents success (Ok) or failure (Err). Equivalent to Either[error, T] but specialized for Go's error pattern.
// Wrap Go's (value, error) pattern
result := mo.TupleToResult(os.ReadFile("config.yaml"))
// Same-type transform — errors short-circuit automatically
upper := mo.Ok("hello").Map(func(s string) (string, error) {
return strings.ToUpper(s), nil
})
// Ok("HELLO")
// Extract with fallback
val := upper.OrElse("default")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:
import "github.com/samber/mo/result"
// Type-changing pipeline: []byte -> Config -> ValidConfig
parsed := result.Pipe2(
mo.TupleToResult(os.ReadFile("config.yaml")),
result.Map(func(data []byte) Config { return parseConfig(data) }),
result.FlatMap(func(cfg Config) mo.Result[ValidConfig] { return validate(cfg) }),
)Key methods: Ok, Err, Errf, TupleToResult, Try, Get, MustGet, OrElse, Map, FlatMap, MapErr, Match, ForEach, ToEither, IsOk, IsError.
For full API reference, see Result Reference.
Either[L, R] — Discriminated Union of Two Types
Represents a value that is one of two possible types. Unlike Result, neither side implies success or failure — both are valid alternatives.
// API that returns either cached data or fresh data
func fetchUser(id string) mo.Either[CachedUser, FreshUser] {
if cached, ok := cache.Get(id); ok {
return mo.Left[CachedUser, FreshUser](cached)
}
return mo.Right[CachedUser, FreshUser](db.Fetch(id))
}
// Pattern match
result := fetchUser("user-123")
result.Match(
func(cached CachedUser) mo.Either[CachedUser, FreshUser] { /* use cached */ },
func(fresh FreshUser) mo.Either[CachedUser, FreshUser] { /* use fresh */ },
)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).
Either3[T1, T2, T3], Either4, and Either5 extend this to 3-5 type variants.
For full API reference, see Either Reference.
Do Notation — Imperative Style with Monadic Safety
mo.Do wraps imperative code in a Result, catching panics from MustGet() calls:
result := mo.Do(func() int {
// MustGet panics on None/Err — Do catches it as Result error
a := mo.Some(21).MustGet()
b := mo.Ok(2).MustGet()
return a * b // 42
})
// result is Ok(42)
result := mo.Do(func() int {
val := mo.None[int]().MustGet() // panics
return val
})
// result is Err("no such element")Do notation bridges imperative Go style with monadic safety — write straight-line code, get automatic error propagation.
Pipeline Sub-Packages vs Direct Chaining
samber/mo provides two ways to compose operations:
Direct methods (.Map, .FlatMap) — work when the output type equals the input type:
opt := mo.Some(42)
doubled := opt.Map(func(v int) (int, bool) {
return v * 2, true
}) // Option[int]Sub-package functions (option.Map, result.Map) — required when the output type differs from input:
import "github.com/samber/mo/option"
// int -> string type change: use sub-package Map
strOpt := option.Map(func(v int) string {
return fmt.Sprintf("value: %d", v)
})(mo.Some(42)) // Option[string]Pipe functions (option.Pipe3, result.Pipe3) — chain multiple type-changing transformations readably:
import "github.com/samber/mo/option"
result := option.Pipe3(
mo.Some(42),
option.Map(func(v int) string { return strconv.Itoa(v) }),
option.Map(func(s string) []byte { return []byte(s) }),
option.FlatMap(func(b []byte) mo.Option[string] {
if len(b) > 0 { return mo.Some(string(b)) }
return mo.None[string]()
}),
)Rule of thumb: Use direct methods for same-type transforms. Use sub-package functions + pipes when types change across steps.
For detailed pipeline API reference, see Pipelines Reference.
Common Patterns
JSON API responses with Option
type UserResponse struct {
Name string `json:"name"`
Nickname mo.Option[string] `json:"nickname"` // omits null gracefully
Bio mo.Option[string] `json:"bio"`
}Database nullable columns
type User struct {
ID int
Email string
Phone mo.Option[string] // implements sql.Scanner + driver.Valuer
}
err := row.Scan(&u.ID, &u.Email, &u.Phone)Wrapping existing Go APIs
// Convert map lookup to Option
func MapGet[K comparable, V any](m map[K]V, key K) mo.Option[V] {
return mo.TupleToOption(m[key]) // m[key] returns (V, bool)
}Uniform extraction with Fold
mo.Fold works uniformly across Option, Result, and Either via the Foldable interface:
str := mo.Fold[error, int, string](
mo.Ok(42), // works with Option, Result, or Either
func(v int) string { return fmt.Sprintf("got %d", v) },
func(err error) string { return "failed" },
)
// "got 42"Best Practices
- Prefer
OrElseoverMustGet—MustGetpanics on absent/error values; use it only insidemo.Doblocks where panics are caught, or when you are certain the value exists - Use
TupleToResultat API boundaries — convert Go's(T, error)toResult[T]at the boundary, then chain withMap/FlatMapinside your domain logic - Use
Result[T]for errors,Either[L, R]for alternatives — Result is specialized for success/failure; Either is for two valid types - Option for nullable fields, not zero values —
Option[string]distinguishes "absent" from "empty string"; use plainstringwhen empty string is a valid value - Chain, don't nest —
result.Map(...).FlatMap(...).OrElse(default)reads left-to-right; avoid nested if/else patterns when monadic chaining is cleaner - 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
For advanced types (Future, IO, Task, State), see Advanced Types Reference.
If you encounter a bug or unexpected behavior in samber/mo, open an issue at https://github.com/samber/mo/issues.
Cross-References
- → See
samber/cc-skills-golang@golang-samber-loskill for functional collection transforms (Map, Filter, Reduce on slices) that compose with mo types - → See
samber/cc-skills-golang@golang-error-handlingskill for idiomatic Go error handling patterns - → See
samber/cc-skills-golang@golang-safetyskill for nil-safety and defensive Go coding - → See
samber/cc-skills-golang@golang-databaseskill for database access patterns - → See
samber/cc-skills-golang@golang-design-patternsskill for functional options and other Go patterns
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

