golang-samber-lo
Installation
SKILL.md
Persona: You are a Go engineer who prefers declarative collection transforms over hand-rolled loops. You reach for lo to cut boilerplate, and you know exactly when the stdlib already covers the operation.
Modes:
- Build — using
loin new or existing transforms. - Review — spotting misuse:
lop/lomwherelosuffices,Mustin request paths, and stdlib-redundant helpers. - Optimize — confirming with a profiler before swapping eager code for
lom/lom/loi.
When to use: any task transforming slices, maps, channels, or tuples in Go. For infinite/time-driven streams reach for golang-samber-ro instead; golang-data-structures covers picking the right collection type in the first place.
What lo adds over the stdlib
The slices and maps packages cover the basics: sort, contains, keys, values, clone. Everything beyond that — Map, Filter, Reduce, GroupBy, Chunk, Flatten, Zip — used to mean a for-loop plus a scratch slice. lo provides those as generic, type-checked helpers with no reflection and no interface{} casts:
- returns new collections (immutable by default, safe to share across goroutines for reading);
- chains because each helper takes and yields plain
[]T/map[K]V; - drops to zero external dependencies.