golang-code-style
改进 Go 代码风格
Go 代码即使通过了格式检查,仍然可能难以阅读。此技能会引导 Claude、Codex 和 Claude Code 做出更清晰的风格选择。
使用我的智能体安装
将此请求复制给你的智能体,其中包含权威 Skill 页面和清单。
Review the Skillstore skill "golang-code-style" from https://skillstore.io/skills/samber-golang-code-style.md and its manifest at https://skillstore.io/api/skills/samber-golang-code-style/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.你的智能体仍应展示其计划,并按安全策略请求必要确认。
Agent 可读资源
当 AI Agent、爬虫或脚本需要干净上下文,而不是读取完整页面时,请使用这些链接。
测试它
正在使用“golang-code-style”。 一个 Go handler 包含嵌套验证,并为空结果返回 nil slices。
预期结果:
- 使用提前返回,让验证失败在主路径之前退出。
- 对于没有结果的成功场景,返回已初始化的空 slices。
- 让主要的响应构建逻辑保持较浅的缩进。
正在使用“golang-code-style”。 一个 service 函数接受许多分散的配置参数。
预期结果:
建议将相关输入分组到 options struct 中,将 context 放在首位,并让主要依赖靠前。
正在使用“golang-code-style”。 一次审查询问 string 是否需要指针参数。
预期结果:
建议按值传递 string,除非 nil 具有含义,或函数必须修改引用的值。
安全审计
安全Static alerts were reviewed in context and adjudicated as false positives. Backtick matches are Markdown code spans, fenced Go examples, and eval prompt strings rather than shell execution. The only URL is homepage metadata, and no prompt injection or malicious intent was found.
风险因素
⚙️ 外部命令 (74)
🌐 网络访问 (1)
分享与引用此报告
分享版本化评估报告、中性徽章、嵌入卡片和引用。Skillstore 只报告证据,不判断该 Skill 是否安全。
复制报告链接
https://skillstore.io/skills/samber-golang-code-style/audits/3?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown 徽章
[](https://skillstore.io/skills/samber-golang-code-style?utm_source=security_passport_badge)HTML 徽章
<a href="https://skillstore.io/skills/samber-golang-code-style?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/samber-golang-code-style/security.svg" alt="Skillstore security assessment" loading="lazy"></a>嵌入卡片
<iframe src="https://skillstore.io/embed/skills/samber-golang-code-style.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>学术引用 (APA · BibTeX · CFF)
APA 引用
samber. (2026). golang-code-style security audit report (audit version 3) [Author version 1.2.0]. Skillstore. https://skillstore.io/skills/samber-golang-code-style/audits/3BibTeX 引用
@techreport{samber-samber-golang-code-style-2026,
author = {samber},
title = {golang-code-style security audit report (audit version 3)},
institution = {Skillstore},
year = {2026},
number = {3},
url = {https://skillstore.io/skills/samber-golang-code-style/audits/3},
note = {Author version 1.2.0}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "golang-code-style security audit report (audit version 3)"
version: "1.2.0"
type: report
authors:
- name: "samber"
date-released: "2026-07-06"
url: "https://skillstore.io/skills/samber-golang-code-style/audits/3"
identifiers:
- type: other
value: "skillstore:samber-golang-code-style:audit:3"
description: "Skillstore immutable audit report identifier"
Skillstore 评分
评分依据 证据置信度: 高你能构建什么
审查 Go Pull Request
在合并前发现控制流、声明、函数形态和文件组织中的可读性问题。
制定团队风格标准
为自动化 linter 较难强制执行的风格决策创建实用检查清单。
指导 AI 代码编辑
当 prompt 要求紧凑代码、嵌套分支或过多参数时,保持生成的 Go 代码易读。
试试这些提示
审查我的 Go 文件的可读风格。重点关注行长、变量声明、提前返回以及初始化的空集合。
为清晰性重构这个 Go 函数。保持行为不变,减少嵌套,移除不必要的 else 块,并解释风格变更。
为此仓库创建一份简洁的 Go 代码风格检查清单。使其与现有模式保持一致,并注明 linter 无法强制执行的规则。
按独立的风格关注点审查此 Go 代码库。报告控制流、函数设计、集合初始化和文件组织方面的问题。
最佳实践
- 将此技能与 gofmt、gofumpt 和 goimports 结合使用,以处理机械格式化。
- 在风格重构前,先要求保持行为不变的编辑。
- 当仓库约定与通用风格指导冲突时,遵循仓库约定。
避免
- 使用此技能替代测试、linter 或编译器检查。
- 不考虑可读性,机械地应用每一条指导原则。
- 请求属于关联技能范围的命名或文档规则。
常见问题
此技能会自动格式化 Go 代码吗?
它能审查现有 Go 代码吗?
它能替代 linter 吗?
它涵盖命名规则吗?
它能帮助处理大型仓库吗?
它是 Claude Code 专用的吗?
开发者详情
作者
samber许可证
MIT
作者版本
v1.2.0
Skillstore 修订
r1
引用
e397ce5a135369cd6def89cb6400d013e2f68f2f
维护新鲜度
2026/7/18
使用量
2 次下载 · 0 次浏览
文件结构