Agent skill

Golang Samber Lo

by context-labs in context-labs/whip

Functional helpers for Go using samber/lo — 500+ type-safe generics for slices, maps, strings, concurrency (Map, Filter, Reduce); concurrent (lo/parallel), in-place (lo/mutable), lazy iterators…

MITAuto-check passedDevelopment

Install Golang Samber Lo

skills CLI
$ npx skills add context-labs/whip --skill golang-samber-lo -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install context-labs/whip golang-samber-lo --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/context-labs/whip.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/golang-samber-lo .claude/skills/golang-samber-lo && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
golang-samber-lo
GitHub stars
1.1k
Used in
2 other repos
Token cost
~2.3k tokens
SKILL.md length
880 words
Files
5 (incl. references)
Skills in repo
40
Repo updated
First seen
Licence
MIT

At a glance

Functional helpers for Go using samber/lo — 500+ type-safe generics for slices, maps, strings, concurrency (Map, Filter, Reduce); concurrent (lo/parallel), in-place (lo/mutable), lazy iterators…

  • Works in 5 steps: Prefer stdlib when available —… → Compose lo functions — chain lo.Filter →… → Profile before optimizing — switch from… → …
  • Tasks that involve Type safety
  • SKILL.md covers Why samber/lo, Installation, Choose the Right Package and Core Patterns, plus 4 more sections
  • Calls go

What it does

Golang Samber Lo is an agent skill from context-labs/whip. Functional helpers for Go using samber/lo — 500+ type-safe generics for slices, maps, strings, concurrency (Map, Filter, Reduce); concurrent (lo/parallel), in-place (lo/mutable), lazy iterators (lo/it). Apply when using/importing github.com/samber/lo. Not for streaming (→ golang-ro).

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including reference files (for example `evals/evals.json`, `references/advanced-patterns.md` and `references/api-reference.md`). Compatibility notes: Designed for Claude Code, Codex or similar harness, and for projects using Golang.

It sits in Development, covering Type safety. It works with Go and GitHub. The repository describes itself as: A fast coding-agent harness in Go. Tool-use loop, bubbletea TUI, provider-routable models with live catalog discovery, MCP support, background subagents. One binary, no runtime… The licence is MIT.

When your agent uses it

  • Tasks that involve Type safety

Example prompts

  • “/golang-samber-lo”

Requirements

  • Compatibility (from SKILL.md): Designed for Claude Code, Codex or similar harness, and for projects using Golang.
  • Pre-approved tools (allowed-tools): Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), mcp__context7__resolve-library-id, mcp__context7__query-docs, AskUserQuestion, Bash(godig:*), Bash(gopls:*), LSP, mcp__gopls__*

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Prefer stdlib when available — slices.Contains and slices.Sort (Go 1.21+) carry no dependency; maps.Keys is Go 1.23+ and returns an…
  2. Compose lo functions — chain lo.Filter → lo.Map → lo.GroupBy instead of writing nested loops. Each function is a building block
  3. Profile before optimizing — switch from lo to lom/lop only after go tool pprof confirms allocation or CPU as the bottleneck
  4. Use error variants — prefer lo.MapErr over lo.Map + manual error collection. Error variants stop early and propagate cleanly
  5. Use lo.Must only in tests and init — in production, handle errors explicitly

What it can do on your machine

Read from SKILL.md and the folder at commit 8876467. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Edit
    • Write
    • Glob
    • Grep
    • Bash(go:*)
    • Bash(golangci-lint:*)
    • Bash(git:*)
    • mcp__context7__resolve-library-id
    • mcp__context7__query-docs

    …and 5 more on the same allowed-tools line.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • go

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com
    • lo.samber.dev
    • pkg.go.dev

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code, Codex or similar harness, and for projects using Golang.

    From compatibility in the SKILL.md frontmatter.

Context cost

Golang Samber Lo loads about 2.3k tokens when it runs, and up to ~9.6k if it reads all its reference files. Until then it costs about 75 tokens; SKILL.md has 880 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~75
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~9.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from context-labs/whip at commit 8876467, republished under its MIT licence (© context-labs). 880 words, ~2,343 tokens.

Download SKILL.mdSave it as .claude/skills/golang-samber-lo/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
golang-samber-lo
description
Functional helpers for Go using samber/lo — 500+ type-safe generics for slices, maps, strings, concurrency (Map, Filter, Reduce); concurrent (lo/parallel), in-place (lo/mutable), lazy iterators (lo/it). Apply when using/importing github.com/samber/lo. Not for streaming (→ golang-ro).
allowed-tools
Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), mcp__context7__resolve-library-id, mcp__context7__query-docs, AskUserQuestion, Bash(godig:*), Bash(gopls:*), LSP, mcp__gopls__*
compatibility
Designed for Claude Code, Codex or similar harness, and for projects using Golang.
user-invocable
true
license
MIT
metadata.author
samber
metadata.version
1.2.0
paths
**/*.go

Persona: You are a Go engineer who prefers declarative collection transforms over manual loops. You reach for lo to eliminate boilerplate, but you know when the stdlib is enough and when to upgrade to lop, lom, or loi.

samber/lo — Functional Utilities for Go

Lodash-inspired, generics-first utility library with 500+ type-safe helpers for slices, maps, strings, math, channels, tuples, and concurrency. Zero external dependencies. Immutable by default.

Official Resources:

This 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/cc-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/cc-skills-golang@golang-gopls skill (gopls). Context7 remains a fallback for docs not indexed on pkg.go.dev.

Why samber/lo

Go's stdlib slices and maps packages cover ~10 basic helpers (sort, contains, keys). Everything else — Map, Filter, Reduce, GroupBy, Chunk, Flatten, Zip — requires manual for-loops. lo fills this gap:

  • Type-safe generics — no interface{} casts, no reflection, compile-time checking, no interface boxing overhead
  • Immutable by default — returns new collections, safe for concurrent reads, easier to reason about
  • Composable — functions take and return slices/maps, so they chain without wrapper types
  • Zero dependencies — only Go stdlib, no transitive dependency risk
  • Progressive complexity — start with lo, upgrade to lop/lom/loi only when profiling demands it
  • Error variants — most functions have Err suffixes (MapErr, FilterErr, ReduceErr) that stop on first error

Installation

bash
go get github.com/samber/lo
PackageImportAliasGo version
Core (immutable)github.com/samber/lolo1.18+
Parallelgithub.com/samber/lo/parallellop1.18+
Mutablegithub.com/samber/lo/mutablelom1.18+
Iteratorgithub.com/samber/lo/itloi1.23+
SIMD (experimental)github.com/samber/lo/exp/simd—1.25+ (amd64 only)

Choose the Right Package

Start with lo. Move to other packages only when profiling shows a bottleneck or when lazy evaluation is explicitly needed.

PackageUse whenTrade-off
loDefault for all transformsAllocates new collections (safe, predictable)
lopCPU-bound work on large datasets (1000+ items)Goroutine overhead; not for I/O or small slices
lomHot path confirmed by pprof -alloc_objectsMutates input — caller must understand side effects
loiLarge datasets with chained transforms (Go 1.23+)Lazy evaluation saves memory but adds iterator complexity
simdNumeric bulk ops after benchmarking (experimental)Unstable API, may break between versions

Key rules:

  • lop is for CPU parallelism, not I/O concurrency — for I/O fan-out, use errgroup instead
  • lom breaks immutability — only use when allocation pressure is measured, never assumed
  • loi eliminates intermediate allocations in chains like Map → Filter → Take by evaluating lazily
  • For reactive/streaming pipelines over infinite event streams, → see samber/cc-skills-golang@golang-samber-ro skill + samber/ro package

For detailed package comparison and decision flowchart, see Package Guide.

Core Patterns

Transform a slice
go
// ✓ lo — declarative, type-safe
names := lo.Map(users, func(u User, _ int) string {
    return u.Name
})

// ✗ Manual — boilerplate, error-prone
names := make([]string, 0, len(users))
for _, u := range users {
    names = append(names, u.Name)
}
Filter + Reduce
go
total := lo.Reduce(
    lo.Filter(orders, func(o Order, _ int) bool {
        return o.Status == "paid"
    }),
    func(sum float64, o Order, _ int) float64 {
        return sum + o.Amount
    },
    0,
)
GroupBy
go
byStatus := lo.GroupBy(tasks, func(t Task, _ int) string {
    return t.Status
})
// map[string][]Task{"open": [...], "closed": [...]}
Error variant — stop on first error
go
results, err := lo.MapErr(urls, func(url string, _ int) (Response, error) {
    return http.Get(url)
})

Common Mistakes

MistakeWhy it failsFix
Using lo.Contains when slices.Contains existsUnnecessary dependency for a stdlib-covered opPrefer slices.Contains/slices.Sort since Go 1.21+ and slices.Collect(maps.Keys(m)) since Go 1.23+ when a key slice is needed
Using lop.Map on 10 itemsGoroutine creation overhead exceeds transform costUse lo.Map — lop benefits start at ~1000+ items for CPU-bound work
Assuming lo.Filter modifies the inputlo is immutable by default — it returns a new sliceUse lom.Filter if you explicitly need in-place mutation
Using lo.Must in production code pathsMust panics on error — fine in tests and init, dangerous in request handlersUse the non-Must variant and handle the error
Chaining many eager transforms on large dataEach step allocates an intermediate sliceUse loi (lazy iterators) to avoid intermediate allocations
Show full SKILL.md (307 more words)Show less

Best Practices

  1. Prefer stdlib when available — slices.Contains and slices.Sort (Go 1.21+) carry no dependency; maps.Keys is Go 1.23+ and returns an iterator, so use slices.Collect(maps.Keys(m)) when you need a slice. Use lo for transforms the stdlib doesn't offer (Map, Filter, Reduce, GroupBy, Chunk, Flatten)
  2. Compose lo functions — chain lo.Filter → lo.Map → lo.GroupBy instead of writing nested loops. Each function is a building block
  3. Profile before optimizing — switch from lo to lom/lop only after go tool pprof confirms allocation or CPU as the bottleneck
  4. Use error variants — prefer lo.MapErr over lo.Map + manual error collection. Error variants stop early and propagate cleanly
  5. Use lo.Must only in tests and init — in production, handle errors explicitly

Quick Reference

FunctionWhat it does
lo.MapTransform each element
lo.Filter / lo.RejectKeep / remove elements matching predicate
lo.ReduceFold elements into a single value
lo.ForEachSide-effect iteration
lo.GroupByGroup elements by key
lo.ChunkSplit into fixed-size batches
lo.FlattenFlatten nested slices one level
lo.Uniq / lo.UniqByRemove duplicates
lo.Find / lo.FindOrElseFirst match or default
lo.Contains / lo.Every / lo.SomeMembership tests
lo.Keys / lo.ValuesExtract map keys or values
lo.PickBy / lo.OmitByFilter map entries
lo.Zip2 / lo.Unzip2Pair/unpair two slices
lo.Range / lo.RangeFromGenerate number sequences
lo.Ternary / lo.IfInline conditionals
lo.ToPtr / lo.FromPtrPointer helpers
lo.Must / lo.TryPanic-on-error / recover-as-bool
lo.Async / lo.AttemptAsync execution / retry with backoff
lo.Debounce / lo.ThrottleRate limiting
lo.ChannelDispatcherFan-out to multiple channels

For the complete function catalog (300+ functions), see API Reference.

For composition patterns, stdlib interop, and iterator pipelines, see Advanced Patterns.

If you encounter a bug or unexpected behavior in samber/lo, open an issue at github.com/samber/lo/issues.

Cross-References

  • → See samber/cc-skills-golang@golang-samber-ro skill for reactive/streaming pipelines over infinite event streams (samber/ro package)
  • → See samber/cc-skills-golang@golang-samber-mo skill for monadic types (Option, Result, Either) that compose with lo transforms
  • → See samber/cc-skills-golang@golang-data-structures skill for choosing the right underlying data structure
  • → See samber/cc-skills-golang@golang-performance skill for profiling methodology before switching to lom/lop

© context-labs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files (references) in .agents/skills/golang-samber-lo of context-labs/whip.

  • SKILL.md
  • evals/evals.json
  • references/advanced-patterns.md
  • references/api-reference.md
  • references/package-guide.md

Open the folder on GitHubat commit 8876467

Used in 2 other repositories

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in context-labs/whip, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Golang Samber Lo next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Golang Samber Lo compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Golang Samber Lo this skillcontext-labs/whip1.1k2 repos~2.3kAutomated safety check: PassMIT
Valgocohesivestack/valgo508—~2.4kAutomated safety check: PassMIT
Golang Samber Mosamber/cc-skills-golang3.4k—~2.9kAutomated safety check: PassMIT
Go-Redis Release Preparationredis/go-redis22k—~1.1kAutomated safety check: PassBSD-2-Clause
Machinistowainlewis/machinist4961 repos~761Automated safety check: PassMIT
Releaseyoanbernabeu/grepai1.9k—~918Automated safety check: PassMIT

Similar skills

  • Valgo

    cohesivestack/valgo

    Add, refactor, debug, review, explain, or migrate type-safe validation in consumer Go applications using github.com/cohesivestack/valgo.

    508 GitHub stars~2.4k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Golang Samber Mo

    samber/cc-skills-golang

    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…

    3.4k GitHub stars~2.9k tokensUpdated 10 days ago
    DevelopmentAuto-check passed
  • Official

    Prepares a go-redis release locally: picks the next semver, gathers merged PRs, writes the RELEASE-NOTES entry and bumps versions, without publishing.

    22k GitHub stars~1.1k tokensUpdated 2 days ago
    DevelopmentAuto-check passed
  • Machinist

    owainlewis/machinist

    Use Machinist to create, assign, and monitor software tasks.

    496 GitHub starsUsed in 1 repo~761 tokens
    DevelopmentAuto-check passed
  • Release

    yoanbernabeu/grepai

    Create a new release for grepai. An agent skill from yoanbernabeu/grepai.

    1.9k GitHub stars~918 tokensUpdated 20 days ago
    DevelopmentAuto-check passed
  • Teaches an agent to write fp-go v2 services with the Effect type, carrying dependencies in its type parameter instead of in context.Context or parameters.

    2k GitHub stars~4.3k tokensUpdated today
    DevelopmentAuto-check passed

More from context-labs/whip

All 40 skills in this repo
  • Golang Lint

    context-labs/whip

    Linting best practices and golangci-lint configuration for Go — running linters, configuring .golangci.yml, nolint suppressions, selecting linters.

    1.1k GitHub starsUsed in 2 repos~1.8k tokens
    Auto-check passed
  • Golang Project Layout

    context-labs/whip

    Golang project layouts and workspaces. An agent skill from context-labs/whip.

    1.1k GitHub starsUsed in 1 repo~1.8k tokens
    Auto-check passed
  • Golang Pkg Go Dev

    context-labs/whip

    Golang package/module docs via godig, a pkg.go.dev API client (CLI + MCP) — APIs, symbols, versions, importers, licenses, vulnerabilities.

    1.1k GitHub starsUsed in 2 repos~3k tokens
    Auto-check passed
  • Golang Stretchr Testify

    context-labs/whip

    Golang testing with stretchr/testify — assert, require, mock, suite: assertions, mock expectations, argument matchers, suite lifecycle, Eventually, JSONEq.

    1.1k GitHub starsUsed in 2 repos~1.8k tokens
    Auto-check passed
  • CI/CD with GitHub Actions for Golang — testing, linting, SAST, security scanning, coverage, Dependabot, Renovate, GoReleaser, release pipelines.

    1.1k GitHub stars~3.5k tokensUpdated 6 days ago
    Auto-check passed
  • Golang Data Structures

    context-labs/whip

    Golang data structures — slices/maps internals (capacity growth, preallocation, hash buckets), slices/maps packages, container/list/heap/ring, strings.Builder vs bytes.Buffer, generic collections…

    1.1k GitHub starsUsed in 1 repo~2.6k tokens
    Auto-check passed

Works with

Categories

Questions about Golang Samber Lo

What does Golang Samber Lo do?

Functional helpers for Go using samber/lo — 500+ type-safe generics for slices, maps, strings, concurrency (Map, Filter, Reduce); concurrent (lo/parallel), in-place (lo/mutable), lazy iterators…. Golang Samber Lo is an agent skill from context-labs/whip. Functional helpers for Go using samber/lo — 500+ type-safe generics for slices, maps, strings, concurrency (Map, Filter, Reduce); concurrent (lo/parallel), in-place (lo/mutable), lazy iterators (lo/it).

When should I use Golang Samber Lo?

Golang Samber Lo fits situations like: tasks that involve Type safety.

How do I install Golang Samber Lo in Claude Code?

Run `npx skills add context-labs/whip --skill golang-samber-lo -a claude-code`. Or copy the skill folder (.agents/skills/golang-samber-lo in context-labs/whip) into .claude/skills/golang-samber-lo in your project. Claude Code loads it when a task matches its description.

How do I install Golang Samber Lo in Codex?

Run `npx skills add context-labs/whip --skill golang-samber-lo -a codex`. Or copy the skill folder (.agents/skills/golang-samber-lo in context-labs/whip) into .agents/skills/golang-samber-lo in your project. Codex loads it when a task matches its description.

Can I use Golang Samber Lo in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add context-labs/whip --skill golang-samber-lo -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/golang-samber-lo, .gemini/skills/golang-samber-lo, .github/skills/golang-samber-lo and .opencode/skills/golang-samber-lo in your project.

What does Golang Samber Lo need to run?

Going by SKILL.md and its folder, Golang Samber Lo needs the command-line tools its instructions call (go). Its frontmatter pre-approves these tools: Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), mcp__context7__resolve-library-id, mcp__context7__query-docs, AskUserQuestion, Bash(godig:*), Bash(gopls:*), LSP, mcp__gopls__*. Compatibility (from SKILL.md): Designed for Claude Code, Codex or similar harness, and for projects using Golang..

Does Golang Samber Lo access the network?

SKILL.md names 3 domains. As links in the text: github.com, lo.samber.dev and pkg.go.dev. This is read from the text; nothing was executed.

Is Golang Samber Lo safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Golang Samber Lo use?

Golang Samber Lo is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Golang Samber Lo use?

About 2.3k tokens (SKILL.md is roughly 9.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 7.3k tokens, read only when the agent opens those files.

What are the alternatives to Golang Samber Lo?

Skills that share tags, products or a category with Golang Samber Lo: Valgo (cohesivestack/valgo, 508 stars), Golang Samber Mo (samber/cc-skills-golang, 3.4k stars), Go-Redis Release Preparation (redis/go-redis, 22k stars) and Machinist (owainlewis/machinist, 496 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Golang Samber Lo?

context-labs (a GitHub organization) maintains it in context-labs/whip, which has 1,083 GitHub stars. The repository holds 40 skills in this directory. The repository was last updated on October 5, 2026.

Source: context-labs/whip on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.