skills/golang-lo/SKILL.md
Go >= 1.18 项目中希望用 samber/lo(Lodash 风格泛型库)简化集合/映射/字符串、错误处理、重试/节流/防抖、通道并发或指针空值场景时使用。
npx skillsauth add dcjanus/prompts golang-loInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
go get github.com/samber/lo@v1。import (
"github.com/samber/lo"
lop "github.com/samber/lo/parallel"
lom "github.com/samber/lo/mutable"
loi "github.com/samber/lo/it"
)
// 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 直接读取最新函数列表:
curl -sSL https://lo.samber.dev/llms.txt
该清单随 Git 仓库最新提交更新,可能包含尚未发布的变更;使用前请核对本地依赖版本。
data-ai
用干净的独立 subagent 反复做代码审查、由主 agent 判断审查意见价值、修复有效问题并提交推送,直到连续三轮没有有价值审查意见。适用于用户要求 review/fix loop、clean review cycle、创建新 subagent 审查当前修改、反复 review 到没有问题、或“连续三次没有有价值建议”这类任务。
tools
使用 Python CLI 与 Google Sheets API 交互以读取、更新、批量写入、追加或清空 Google Sheets 在线表格;适用于需要通过 OAuth 授权操作 Google Workspace 表格的场景。
development
为当前 Codex thread 设置名称;仅当用户手动调用或明确要求命名、重命名、整理当前 Codex 会话标题时使用,永远不要自动调用。
testing
编写或更新 GitHub/GitLab Issue、PR、MR 的标题与正文;适用于创建、修改、重写 reviewer-facing 描述、Risks、Breaking Change、避免低价值验证噪声与本地路径泄露等场景。PR/MR 正文默认禁止 Validation;只有 CI/diff 看不到的高信噪比行为证据才允许写。