golang-lo
Go >= 1.18 项目中希望用 samber/lo(Lodash 风格泛型库)简化集合/映射/字符串、错误处理、重试/节流/防抖、通道并发或指针空值场景时使用。
Best use case
golang-lo is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Go >= 1.18 项目中希望用 samber/lo(Lodash 风格泛型库)简化集合/映射/字符串、错误处理、重试/节流/防抖、通道并发或指针空值场景时使用。
Teams using golang-lo should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/golang-lo/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How golang-lo Compares
| Feature / Agent | golang-lo | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Go >= 1.18 项目中希望用 samber/lo(Lodash 风格泛型库)简化集合/映射/字符串、错误处理、重试/节流/防抖、通道并发或指针空值场景时使用。
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# lo Go 工具库速用指南
## 快速上手
- 安装:`go get github.com/samber/lo@v1`。
- 常用导入:
```go
import (
"github.com/samber/lo"
lop "github.com/samber/lo/parallel"
lom "github.com/samber/lo/mutable"
loi "github.com/samber/lo/it"
)
```
- 常用函数速览:
```go
// Filter: 按条件保留
lo.Filter(nums, func(x int, _ int) bool { return x%2==0 })
// Map: 映射生成新切片
lo.Map(nums, func(x int, _ int) int { return x*x })
// Find: 找到首个满足条件的元素
v, ok := lo.Find(nums, func(x int) bool { return x > 10 })
// Uniq: 去重并保持顺序
uniq := lo.Uniq([]string{"a","a","b"})
// GroupBy: 按键分组
groups := lo.GroupBy(users, func(u User) int { return u.Age })
// Must: 遇 err/false panic,常用于初始化
t := lo.Must(time.Parse(time.RFC3339, ts))
```
## 官方清单获取
使用 curl 直接读取最新函数列表:
```bash
curl -sSL https://lo.samber.dev/llms.txt
```
该清单随 Git 仓库最新提交更新,可能包含尚未发布的变更;使用前请核对本地依赖版本。Related Skills
dbos-golang
DBOS Go SDK for building reliable, fault-tolerant applications with durable workflows. Use this skill when writing Go code with DBOS, creating workflows and steps, using queues, using the DBOS Client from external applications, or building Go applications that need to be resilient to failures.
golang-enterprise-patterns
Enterprise-level Go architecture patterns including clean architecture, hexagonal architecture, DDD, and production-ready application structure.
golang-patterns
Idiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications.
golang-tooling
Go developer toolchain — gopls LSP diagnostics, linting, formatting, and vet. Use when setting up Go tooling, running linters, or integrating gopls with Claude Code. (triggers: gopls, golangci-lint, golangci.yml, go vet, goimports, staticcheck, go tooling, go lint)
golang-logging
Standards for structured logging and observability in Golang. Use when adding structured logging or tracing to Go services. (triggers: go.mod, pkg/logger/**, logging, slog, structured logging, zap)
golang-language
Core idioms, style guides, and best practices for writing idiomatic Go code. Use when writing Go code following official style guides and idiomatic patterns. (triggers: go.mod, golang, go code, idiomatic, gofmt, goimports, iota, golang style)
golang-configuration
Standards for application configuration using environment variables and libraries. Use when managing Go application config with environment variables or viper. (triggers: configs/**, cmd/**, configuration, env var, viper, koanf)
golang-architecture
Standards for structural design, Clean Architecture, and project layout in Golang. Use when structuring Go projects or applying Clean Architecture in Go. (triggers: go.mod, internal/**, architecture, structure, folder layout, clean arch, dependency injection)
golang-api-server
Standards for building HTTP services, REST APIs, and middleware in Golang. Use when building Go HTTP servers, REST APIs, or custom middleware. (triggers: cmd/server/*.go, internal/adapter/handler/**, http server, rest api, gin, echo, middleware)
golang-troubleshooting
Troubleshoot Golang programs systematically - find and fix the root cause. Use when encountering bugs, crashes, deadlocks, or unexpected behavior in Go code. Covers debugging methodology, common Go pitfalls, test-driven debugging, pprof setup and capture, Delve debugger, race detection, GODEBUG tracing, and production debugging. Start here for any 'something is wrong' situation. Not for interpreting profiles or benchmarking (see golang-benchmark skill) or applying optimization patterns (see golang-performance skill).
golang-stretchr-testify
Comprehensive guide to stretchr/testify for Golang testing. Covers assert, require, mock, and suite packages in depth. Use whenever writing tests with testify, creating mocks, setting up test suites, or choosing between assert and require. Essential for testify assertions, mock expectations, argument matchers, call verification, suite lifecycle, and advanced patterns like Eventually, JSONEq, and custom matchers. Trigger on any Go test file importing testify.
golang-stay-updated
Provides resources to stay updated with Golang news, communities and people to follow. Use when seeking Go learning resources, discovering new libraries, finding community channels, or keeping up with Go language changes and releases.