plugins/languages/golang/skills/naming/SKILL.md
Go 命名规范——Id/Uid 字段(非 ID)、IsActive/HasMFA 布尔前缀、CreatedAt 时间字段、接收者统一用 p、包名全小写无下划线、泛型类型参数描述性命名、集合字段 xxx_list 禁 xxxs 复数、Enum 0 值 XxxNil 禁 Unknown、禁 Status 统一 State、Set/Update 语义区分。定义结构体字段、函数、变量、包、接收者名、泛型、枚举时触发。
npx skillsauth add lazygophers/ccplugin golang-namingInstall 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.
PascalCase,如 User、UserLogin、GetUserById(不是 ID)camelCase,如 user、getUserByIdPascalCase,如 DefaultTimeout、MaxRetriesuser、order、paymentuser.go、user_test.gop,如 (p *User)、(p *Order)i、idx、itemx/y/z/tmptype User struct {
Id uint64 // 主键
Uid uint64 // 用户唯一标识
FriendUid uint64 // 关联用户 ID
UUID string // 仅当确实是 UUID(大写)
}
不写 ID/UserID/UID,统一 Id/Uid/Xxxid → XxxId。
type Model struct {
Id uint64
CreatedAt int64
UpdatedAt int64
DeletedAt int64 // 软删
}
type Friend struct {
Id uint64
State int32
}
const (
FriendStateNil = 0
FriendStatePending = 1
FriendStateActive = 2
FriendStateBlocked = 3
)
禁 Status:字段、常量、列名、变量名一律用 State,不用 Status。
const (
UserStateNil uint8 = 0 // 零值用 XxxNil
UserStateActive uint8 = 1
)
禁 Unknown/None/Unspecified 作零值,统一 XxxNil。
type User struct {
IsActive bool
HasMFA bool
IsAdmin bool
CanEdit bool
}
前缀必须是 Is/Has/Can/Should。
func UserLogin(req *UserLoginReq) (*UserLoginRsp, error)
func GetUserById(req *GetUserByIdReq) (*GetUserByIdRsp, error)
func AddUser(req *AddUserReq) error
func UpdateUser(req *UpdateUserReq) error
func DelUser(req *DelUserReq) error
func ListUser(req *ListUserReq) (*ListUserRsp, error)
| 前缀 | 用途 |
| --- | --- |
| GetXxxById | 取单条 |
| ListXxx | 取列表 |
| CountXxx | 计数 |
| CheckXxxExists | 存在性 |
| IsXxx | 布尔判断 |
func (p *User) Login(password string) error
func (p *Order) Calculate() int64
func (p *Friend) IsActive() bool
不用 self/this/u/o,统一 p。
type Rsp struct {
UserList []*User `json:"user_list"` // ✅
OrderList []*Order `json:"order_list"` // ✅
}
集合字段统一 xxx_list 后缀,禁 users/orders/images/files 等复数形式。
| 前缀 | 语义 | 场景 |
| --- | --- | --- |
| SetXxx | 覆盖整个 model | 整体替换 |
| UpdateXxx | 改部分字段 | 单字段/多字段更新 |
单字段改名必须 Update<Model><Field>,不能 Set<Model>。
// 描述性命名
func Map[T any, R any](items []T, fn func(T) R) []R
func Filter[T any](items []T, fn func(T) bool) []T
// 约束接口
type Ordered interface {
~int | ~float64 | ~string
}
// Go 1.26 自引用
type Node[T Node[T]] interface {
Children() []T
}
| AI 借口 | 实际应验证 | | --- | --- | | "ID 全大写更规范" | 用 Id 不是 ID? | | "self/this 更直观" | 接收者统一 p? | | "变量名越长越清晰" | 避免冗长? | | "GetByID 是 Go 官方写法" | 项目用 GetUserById 风格? | | "T 就够了" | 泛型参数描述性? | | "pkg_name 更清晰" | 包名全小写无下划线? | | "Status 更通用" | 禁 Status,统一 State? | | "Unknown 表示零值" | 零值用 XxxNil? | | "users 复数更自然" | 集合用 xxx_list? |
pId/UidCreatedAt/UpdatedAtState(禁 Status)XxxNil(禁 Unknown)Is/Has/Can 前缀xxx_list 后缀tools
--- 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 内部) 互补.