跳转到正文
报告库
用途分类 / 开发辅助

Golang Code Style Skill 安全审计

作者说它能做什么(原文)

Golang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments help vs hurt. Use when writing or reviewing Go code, asking about style or clarity, or establishing project coding standards. Not for naming conventions (→ See `samber/cc-skills-golang@golang-naming` skill), linter configuration (→ See `samber/cc-skills-golang@golang-lint` skill), o

第三方安全检查结论

发现安全风险

已检查文件
3
发现的风险
5
会不会运行危险命令?检查是否下载程序后直接运行、让他人远程控制电脑,或藏起要运行的命令。未发现风险
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。未发现风险
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。发现 2 项风险
中风险

“样式”规则可能改变程序语义和公开 API

原文依据:3 处
发现了什么

该 Skill 不只调整格式:它要求集合永不为 nil、建议把超过四个参数改成 options struct,并要求积极取消导出。nil 与空集合可能具有不同的协议含义;修改签名或导出状态会改变调用方可用的 API。

为什么需要注意

应用于现有项目时,可能改变 JSON 输出、破坏依赖 nil 的逻辑,或导致下游代码无法编译。取消导出还可能成为破坏性 API 变更。

这不只是排版建议。若在现有代码上机械应用,“集合永不为 nil”可能改变 JSON 或调用方用来区分 nil 与空集合的语义;把参数改为 options struct 会改变函数签名;取消导出会让包外调用无法编译。风险只在这些规则被用于修改现有 API 时出现。用户可要求仅报告问题,不改集合语义、公开符号或函数签名,除非逐项批准。

SKILL.md:66来自说明文档打开原文件
Slices and maps MUST be initialized explicitly, never nil. Nil maps panic on write; nil slices serialize to `null` in JSON (vs `[]` for empty slices), surprising API consumers.
查看另外 2 个位置
SKILL.md:174来自说明文档打开原文件
- Functions SHOULD be **short and focused** — one function, one job.- Functions SHOULD have **≤4 parameters**. Beyond that, use an options struct (see `samber/cc-skills-golang@golang-design-patterns` skill).- **Parameter order**: `context.Context` first, then inputs, then output destinations.- Naked returns help in very short functions (1-3 lines) where return values are obvious, but become confusing when readers must scroll to find what's returned — name returns explicitly in longer functions.
SKILL.md:204来自说明文档打开原文件
- **Dot imports** pollute the namespace and make it impossible to tell where a name comes from — never use in library code- **Unexport aggressively** — you can always export later; unexporting is a breaking change. → See `samber/cc-skills-golang@golang-gopls` skill to unexport safely — its rename updates every call site atomically and refuses the change when lowercasing a method would break interface satisfaction, a breakage grep/sed silently ships.
中风险

样式建议可能引入新的第三方 Go 依赖

原文依据:2 处
发现了什么

该 Skill 直接建议过滤、分组和分块使用 `github.com/samber/lo`,尽管其用途是代码风格。采用该建议通常会把外部模块加入项目依赖,而不是只改变可读性。

为什么需要注意

项目的依赖清单、构建下载和供应链暴露面可能变化,并可能带来版本、许可证或维护负担。

Skill 对 filter/group-by/chunk 直接推荐外部模块;若代理据此编写代码,项目可能新增下载、构建和供应链依赖,超出纯可读性调整。不过清单的安装步骤为空,来源也没有命令自动安装该模块,所以风险只在建议被采用并更新依赖时发生。用户可要求仅使用标准库,或在新增任何模块前单独批准并审查版本。

SKILL.md:220来自说明文档打开原文件
- **"A little copying is better than a little dependency"**- **Use `slices` and `maps` standard packages**; for filter/group-by/chunk, use `github.com/samber/lo`- **"Reflection is never clear"** — avoid `reflect` unless necessary- **Don't abstract prematurely** — extract when the pattern is stable
查看另外 1 个位置
SKILL.md:16来自说明文档打开原文件
        - go    install: []allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。发现 2 项风险
中风险

代码风格审查可自动扩展到五个代理

原文依据:3 处
发现了什么

该 Skill 授予 Agent 工具,并在大型仓库审查时指示最多启动五个子代理。用户只是请求样式审查时,可能并未预期扩大代理数量和仓库读取范围。

为什么需要注意

这可能增加执行成本,并让更多代理处理仓库内容;若宿主对代理权限隔离不足,影响范围也会随之扩大。

在“大型代码库”的样式审查条件下,Skill 指示扇出多个代理,并请求 Agent 工具权限;这可能增加同时读取代码的主体和审查范围。Claude Code 的文字要求用 `ultracode` 显式选择,但其他兼容环境没有同样清楚的用户确认条件。用户可限制为单代理、指定目录,并要求任何扩展前确认。

SKILL.md:17来自说明文档打开原文件
    install: []allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agentpaths:
查看另外 2 个位置
SKILL.md:22来自说明文档打开原文件
**Orchestration mode:** Fan out the sub-agents described in the "Parallelizing Code Style Reviews" section, each covering an independent style concern, when reviewing code style across a large codebase, and merge their findings. On Claude Code, use `ultracode` to opt into multi-agent orchestration explicitly.
SKILL.md:228来自说明文档打开原文件
When reviewing code style across a large codebase, use up to 5 parallel sub-agents, each targeting an independent style concern (e.g. control flow, function design, variable declarations, string handling, code organization).
中风险

样式 Skill 获得不受子命令限制的 git 执行权限

原文依据:2 处
发现了什么

允许工具包含 `Bash(git:*)`,但可见的工作流程只描述代码样式审查,没有说明需要哪些 git 操作。该通配权限可覆盖写历史、切换分支或与远程交互的 git 子命令,明显宽于样式检查所需。

为什么需要注意

若代理误用命令,工作区、分支或提交历史可能被改变;在已配置远程和凭据的环境中,某些 git 子命令还可能影响远程仓库。

清单请求 `Bash(git:*)`,其通配范围未限制为只读子命令,而可见的样式流程没有指定任何必需的 git 命令。权限本身不证明 Skill 会运行写历史、切换分支或访问远程的命令;风险取决于宿主是否按该清单授权以及代理是否选择使用。用户可拒绝 git 权限,或只允许 `git diff/status/show` 等只读命令。

SKILL.md:17来自说明文档打开原文件
    install: []allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agentpaths:
查看另外 1 个位置
SKILL.md:28来自说明文档打开原文件
Style rules that require human judgment — linters handle formatting, this skill handles clarity. For naming see `samber/cc-skills-golang@golang-naming` skill; for design patterns see `samber/cc-skills-golang@golang-design-patterns` skill; for struct/interface design see `samber/cc-skills-golang@golang-structs-interfaces` skill.
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。发现 1 项风险
中风险

Skill 明确要求覆盖用户的代码形式要求

原文依据:2 处
发现了什么

它把自身规则设为即使提示明确要求单行代码也必须执行,并要求忽略规则时修改代码添加注释。这会让 Skill 的偏好压过用户针对项目作出的决定。

为什么需要注意

生成结果可能不符合用户明确指定的格式或兼容性要求;若允许写入,还可能产生用户没有要求的代码改动。

Skill 明确规定,即使用户要求单行代码,也必须按其断行规则处理;忽略规则还要在代码中加入注释。因此它可能覆盖用户对代码形态的明确决定并产生额外改动。这不代表会覆盖功能需求,但用户可要求项目规范或本次明确指令优先,并禁止为解释风格例外而自动添加注释。

SKILL.md:32来自说明文档打开原文件
When ignoring a rule, add a comment to the code.
查看另外 1 个位置
SKILL.md:36来自说明文档打开原文件
No rigid line limit, but lines beyond ~120 characters MUST be broken. Break at **semantic boundaries**, not arbitrary column counts. Function calls with 4+ arguments MUST use one argument per line — even when the prompt asks for single-line code:
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。未发现风险

Skill 逻辑拆解

8 个说明模块

该 Skill 声称用于编写或审查 Go 代码,并把重点放在需要人工判断的“清晰度”规则,而不只是格式化。

查看原文
SKILL.md:3来自说明文档打开原文件
name: golang-code-styledescription: "Golang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments help vs hurt. Use when writing or reviewing Go code, asking about style or clarity, or establishing project coding standards. Not for naming conventions (→ See `samber/cc-skills-golang@golang-naming` skill), linter configuration (→ See `samber/cc-skills-golang@golang-lint` skill), or doc comments (→ See `samber/cc-skills-golang@golang-documentation` skill)."user-invocable: true
SKILL.md:28来自说明文档打开原文件
Style rules that require human judgment — linters handle formatting, this skill handles clarity. For naming see `samber/cc-skills-golang@golang-naming` skill; for design patterns see `samber/cc-skills-golang@golang-design-patterns` skill; for struct/interface design see `samber/cc-skills-golang@golang-structs-interfaces` skill.

元数据没有安装步骤,但要求 Go,并允许读写文件、运行 Go、golangci-lint、任意 git 子命令以及启动代理。

查看原文
SKILL.md:13来自说明文档打开原文件
    homepage: https://github.com/samber/cc-skills-golang    requires:      bins:        - go    install: []allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agentpaths:

该 Skill 把若干可能影响运行语义或公开 API 的做法规定为强制规则,包括非 nil 集合、参数数量和取消导出。

查看原文
SKILL.md:66来自说明文档打开原文件
Slices and maps MUST be initialized explicitly, never nil. Nil maps panic on write; nil slices serialize to `null` in JSON (vs `[]` for empty slices), surprising API consumers.
SKILL.md:173来自说明文档打开原文件
- Functions SHOULD be **short and focused** — one function, one job.- Functions SHOULD have **≤4 parameters**. Beyond that, use an options struct (see `samber/cc-skills-golang@golang-design-patterns` skill).- **Parameter order**: `context.Context` first, then inputs, then output destinations.- Naked returns help in very short functions (1-3 lines) where return values are obvious, but become confusing when readers must scroll to find what's returned — name returns explicitly in longer functions.
SKILL.md:204来自说明文档打开原文件
- **Dot imports** pollute the namespace and make it impossible to tell where a name comes from — never use in library code- **Unexport aggressively** — you can always export later; unexporting is a breaking change. → See `samber/cc-skills-golang@golang-gopls` skill to unexport safely — its rename updates every call site atomically and refuses the change when lowercasing a method would break interface satisfaction, a breakage grep/sed silently ships.

在大型代码库审查中,该 Skill 指示代理并行拆分审查,正文允许最多五个子代理。

查看原文
SKILL.md:22来自说明文档打开原文件
**Orchestration mode:** Fan out the sub-agents described in the "Parallelizing Code Style Reviews" section, each covering an independent style concern, when reviewing code style across a large codebase, and merge their findings. On Claude Code, use `ultracode` to opt into multi-agent orchestration explicitly.
SKILL.md:226来自说明文档打开原文件
## Parallelizing Code Style ReviewsWhen reviewing code style across a large codebase, use up to 5 parallel sub-agents, each targeting an independent style concern (e.g. control flow, function design, variable declarations, string handling, code organization).
从这里开始 · 工作说明SKILL.md
golang-code-style
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。 另有 4 个章节,可在原文件中查看。

文件引用关系图

1 处引用
哪些文件发起引用引用了什么
连线表示真实的文件引用,不是运行顺序。点击节点可高亮相关连线,并查看具体文件和原文位置。虚线表示还有文件需要定位。
文件与检查记录3 个文件

检查范围与遗漏

逐文件查看涉及的内容

下方列出本次涉及的原文范围;纳入检查不代表已查清所有问题。

  • SKILL.md已纳入全文
  • references/details.md已纳入全文
  • evals/evals.json已纳入全文

这份报告只针对上方版本。我们看了拿到的代码和说明文件,没有实际运行 Skill,也没有检查它另外安装的软件包。因此,这不是“保证安全”的承诺;换了版本或使用环境,结果也可能不同。

  • SKILL.md工作说明
  • evals/evals.json配套文件
  • references/details.md配套文件

代码和说明中提到的操作

连接外部网站
SKILL.md:12来自说明文档打开原文件
    emoji: "🎨"    homepage: https://github.com/samber/cc-skills-golang    requires:
运行命令
SKILL.md:17来自说明文档打开原文件
    install: []allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agentpaths:
读取文件
evals/evals.json:178来自说明文档打开原文件
    "description": "Helper functions called only within the same package stay unexported; exporting is a commitment",    "prompt": "Write a Go file `parser.go` in package `config`. Include: an exported ParseConfig function that reads a file path and returns a *Config struct; an exported ValidateConfig function that checks required fields; a helper function that tokenizes a raw config string (used only by ParseConfig); a helper function that resolves environment variable references in values (used by ParseConfig and ValidateConfig); a helper function that formats a field path for error messages (used only in error messages inside ValidateConfig). Make all functions exported for potential future reuse from other packages.",    "trap": "Model follows the prompt's instruction to export all functions, leaking tokenizer, env resolver, and error formatter as public API — any future change to them becomes a breaking change",
读取了多少行
889
文件校验值(用于核对版本)
75485360ab86c223a14804b9627e71997a9cb5b96beb0fc83c107fce6a1d1ecf