plugins/languages/golang/skills/libs/SKILL.md
Go 优先库选型规范——集合用 candy(Map/Filter/Each/Unique)、字符串用 stringx(CamelCase/SnakeCase)、文件用 osx(IsFile/IsDir)、日志用 lazygophers/log 或 slog、JSON 用 lazygophers/utils/json、类型转换用 candy.ToInt64/ToBool。选第三方库、写工具函数、做集合操作或类型转换时触发。
npx skillsauth add lazygophers/ccplugin golang-libsInstall 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.
import (
"github.com/lazygophers/utils"
"github.com/lazygophers/utils/candy"
"github.com/lazygophers/utils/stringx"
"github.com/lazygophers/utils/osx"
"github.com/lazygophers/utils/json"
"github.com/lazygophers/utils/cryptox"
"github.com/lazygophers/utils/xtime"
"github.com/lazygophers/utils/defaults"
"github.com/lazygophers/utils/validate"
"github.com/lazygophers/log"
)
| 场景 | 必用库 | 禁用替代 |
| --- | --- | --- |
| 集合操作(Map/Filter/Each) | candy | 手写 for |
| 字符串转换(驼峰/蛇形) | stringx | 手写转换 |
| 文件存在/类型检查 | osx | os.Stat 拼接 |
| JSON 编解码 | lazygophers/utils/json | encoding/json 直接 |
| 加密/哈希 | cryptox | 直接用 crypto/* |
| 时间 | xtime | time 直接 |
| 默认值 | defaults | 手写 nil 检查 |
| 表单/参数校验 | validate | 手写 |
| 日志 | lazygophers/log 或 slog | fmt.Println/logrus/zap |
| 原子操作 | go.uber.org/atomic | sync/atomic |
| 类型转换 | candy.ToInt64/ToBool | strconv + 手写 |
m := min(a, b, c)
M := max(a, b, c)
clear(mySlice)
clear(myMap)
candy.Min/Max 仅用于非可比较类型或多参 + 自定义比较的场景。
import "github.com/lazygophers/utils/candy"
candy.Each(users, func(u *User) { log.Infof("user: %s", u.Name) })
names := candy.Map(users, func(u *User) string { return u.Name })
adults := candy.Filter(users, func(u *User) bool { return u.Age >= 18 })
reversed := candy.Reverse(items)
unique := candy.Unique(items)
sorted := candy.Sort(items)
import "github.com/lazygophers/utils/stringx"
stringx.ToCamel("user_name") // UserName
stringx.ToSmallCamel("user_name") // userName
stringx.ToSnake("UserName") // user_name
import "github.com/lazygophers/utils/osx"
if osx.IsFile(path) { /* ... */ }
if osx.IsDir(path) { /* ... */ }
port := candy.ToInt64(config["port"])
enabled := candy.ToBool(config["enabled"])
ratio := candy.ToFloat64(data)
golang-error)import "github.com/lazygophers/log"
log.Infof("proto file:%s", protoFile)
log.Warnf("not found %s", path)
log.Errorf("err:%v", err)
log.Fatalf("failed to load state")
新项目可改 log/slog,但同一仓库不要混用。
| AI 借口 | 实际应验证 | | --- | --- | | "for 循环更直观" | 集合操作走 candy? | | "手动转换更可控" | 字符串走 stringx? | | "os.Stat 是标准库" | 文件检查走 osx? | | "encoding/json 够用" | JSON 走 lazygophers/utils/json? | | "自己实现更灵活" | candy/stringx 是否已有该能力? | | "math.Min 够用" | 1.21+ 用内置 min/max? |
stringxcandyosxcandy.ToXxxlazygophers/log 或 slogos.Stat 直接调用min/max/cleartools
--- name: trellisx-workspace description: 维护 `.trellis/task.md` 任务看板 —— trellis 缺的跨任务总览。**一个表格, 一行一个任务**, 列为 id/名称/描述/状态/阶段/进度/worktree (状态/阶段中文显示)。在 task create/start/阶段切换/archive 后**及时更新**对应行; 并**自动清理超 7 天的已完成行**防膨胀。保持看板与 task.json 实时一致。 when_to_use: 维护 / 创建 / 更新 `.trellis/task.md` 任务看板时; task 生命周期任一节点 (create/start/阶段推进/archive) 之后同步看板时; 用户问"当前有哪些任务 / 任务进度 / 任务看板"时。被 trellisx-flow 与 trellisx-apply 注入的流程引用。 user-invocable: true argument-hint: [show|update|sync|cleanup ...] [task id] arguments:
testing
强制以 Trellis task 闭环处理用户指定的请求 (自判新建/并入 → plan→exec→check→finish 全程不跳步)。**仅用户显式主动调用** (/trellisx-flow 或明确要求"强制走 task 处理这个"); **禁止自动 / 被动 / 推断式调用** —— 不要因为某个请求"看起来该建 task"就自动触发本 skill, 那是 apply 注入的 no_task 倾向的职责。
testing
把 强推task + subtask拆分 + worktree隔离 + 闭环收尾 四维度增量注入当前项目 .trellis/ (workflow.md 的 no_task/planning/in_progress 块 + spec 背书文档 + trellis 生命周期 hook worktree 自动化)。强推 task 与闭环为纯 prompt 软约束 (非平台 hook 硬拦截)。**纯增量追加, 绝不替换 trellis 原生文本** (no_task 分类+征同意/check/finish/前缀全保留)。幂等 (marker 包裹)。
development
Claude Code 会话历史整理 — 扫 ~/.claude/projects/**/*.jsonl 全部 session transcripts, 提取学习增量 (用户校正/决策/踩坑/L0 规则) → 全局记忆库 ~/.cortex/.wiki/memory/. 默认 --apply 落盘 (--dry-run opt-in 仅出 JSON plan 预览). 与 cortex-extract (L4-inbox 内部) 互补.