golang-code-style
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 `sa
供给资产档案
编程与开发 Agent
代码审查、仓库分析、测试、CI、GitHub、DevOps 与开发工作流 Skill。
场景
编程 Agent
我需要一个能理解仓库、修改代码并审查 Pull Request 的编程 Agent。
适配 Agent
Claude Code + OpenAI Agents + CLI
适用于 Codex、Claude Code、Cursor、CLI 或自定义 Agent。
安装
就绪
npx skills add samber/cc-skills-golang --skill golang-code-style
维护状态
新鲜
距上次推送 2 天
风险
需审查
Dependency or permission surface needs review
GitHub 质量
3.0K
82/100 质量 · 72/100 信任
覆盖标签
审查说明
Dependency or permission surface needs review · Permission surface may require sandboxing
Agent 采用评分卡
一眼查看信任、审计与安装准备度
这些分数综合公开仓库元数据、OpenAgentSkill 审查信号、维护新鲜度与安装准备度。它用于候选筛选,不替代人工审查。
质量
强可靠的选择,值得加入生产工作流候选列表。
信任
仅限沙盒有用但信任信号不足或混杂的候选项。在结果闭环证明任务匹配前,请保持在隔离工作区内使用。
审计
需审查对安装准备度、安全元数据、维护情况与采用风险的机器可读审查。
OpenAgentSkill 信任评分 v5
安装前需人工审查
仅在沙盒中运行,并在用于真实工作前比较接近的替代方案。
Stars
3.0K 个 GitHub Stars
仓库活跃度
3.0K 个 Star,197 个 Fork
维护状态
距上次推送 2 天
许可证
MIT
安装
npx skills add samber/cc-skills-golang --skill golang-code-style
安装安全性
标准软件包或运行时安装路径
权限范围
shell or command execution, filesystem or document access
Agent 结果
暂未有 Agent 结果数据
文档
README/SKILL.md 上下文充分
风险摘要
生产前审查
- The SKILL.md excerpt references a 'Parallelizing Code Style Reviews' section that is not visible in the provided excerpt; ensure it exists in the full file to avoid broken references.
- Financial research output is not financial advice; require human review before any live investment decision.
- Quality score needs review
- Permission surface needs review: shell or command execution, filesystem or document access
安装准备度
安装路径可用
- 安装路径可用
- 仓库证据可用
- 已声明许可证
- 暂无 Agent 验证结果证据
Agent 可读元数据
这个 Skill 的机器可读决策数据。
使用此区块或内嵌 JSON 判断 Agent 是否应安装该 Skill、选择替代方案,或先请求人工审查。
适用任务
- 编程 Agent 工作流
- Claude Code 团队
- 重视 GitHub 采用信号的团队
- Inspect source files
适用 Agent
安装决策
- 命令
- npx skills add samber/cc-skills-golang --skill golang-code-style
- 策略
- 审查
- 人工审查
- 是
信任与风险
- 信任
- 64/100
- 审计
- 81/100
- 风险级别
- 需审查
结果闭环
- 端点
- /api/agent/outcome
- 事件 ID
- resolve
- 结果
- 5
不适用场景
- 需要厂商支持 SLA 的团队
- production agents without a repository review
- The SKILL.md excerpt references a 'Parallelizing Code Style Reviews' section that is not visible in the provided excerpt; ensure it exists in the full file to avoid broken references.
- 高风险权限提示:Shell 或命令执行
- Dependency or permission surface needs review
替代 Skill
Code Review
168.6K Stars
npx skills add mattpocock/skills --skill code-review
替代 Skill
Grill With Docs
164.7K Stars
npx skills add mattpocock/skills --skill grill-with-docs
替代 Skill
To Spec
164.7K Stars
npx skills add mattpocock/skills --skill to-spec
替代 Skill
To Tickets
176.7K Stars
npx skills add mattpocock/skills --skill to-tickets
Agent 安全 v2
45/100 · 避免自动安装
Sparse or mixed signals. Useful for discovery, but not for autonomous installation.
Test manually in an isolated workspace and compare against safer alternatives.
高
Shell 或命令执行
Skill 元数据引用了终端、CLI、Shell、子进程或命令执行工作流。
中
Browser automation
Skill may drive a browser or interact with web pages.
中
网络访问
Skill 可能访问远程页面、API、仓库或外部服务。
中
文件系统访问
Skill 可能读取或写入项目文件、文档、生成产物或本地工作区状态。
- 高风险权限提示:Shell 或命令执行
- Dependency or permission surface needs review
安装目标
在你的 Agent 工作流中安装此 Skill
通过公开安装端点获取命令、安全清单、目标提示词和该 Skill 的规范链接。
OpenAgentSkill CLI
Resolve policy, run the source installer safely, and report a verified install receipt.
$ npx --yes https://github.com/Leon-Drq/openagentskill/releases/download/cli-v0.2.1/openagentskill-0.2.1.tgz install samber-golang-code-styleAgent 解析计划
让 Agent 在安装前验证匹配度。
Resolve API 返回首选 Skill、替代方案、安全策略、审计说明、安装目标和可直接执行的提示词,无需抓取此页面。
打开 JSON
/api/agent/resolve?task=Use%20golang-code-style%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve 文本
/api/agent/resolve?task=Use%20golang-code-style%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
安装交接
/api/skills/samber-golang-code-style/install
Agent 应检查
- 从 Resolve API 检查任务匹配与替代方案。
- 检查审计评分、信任评分和安全策略警告。
- 检查 Codex、Claude Code、Cursor 或 CLI 的安装目标兼容性。
复制提示词
Task: Use golang-code-style in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20golang-code-style%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/samber-golang-code-style/install
Install command: npx skills add samber/cc-skills-golang --skill golang-code-style
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Agent 交接
把安装路径交给 Agent,而不是再给一个目录页。
通过公开安装端点获取命令、安全清单、目标提示词和该 Skill 的规范链接。
安装交接
/api/skills/samber-golang-code-style/install
LLM 文本格式
/api/skills/samber-golang-code-style/install?format=text
寻找替代方案
/api/skills/search?q=golang-code-style&limit=3
Agent 提示词
Use golang-code-style for this task. Review https://www.openagentskill.com/api/skills/samber-golang-code-style/install, then install with: npx skills add samber/cc-skills-golang --skill golang-code-styleRegistry 元数据
用于自动选择 Skill 的 Agent 可读档案。
本页通过 Registry API 提供相同的决策、信任、审计、场景和安装信号,让 Agent 无需抓取界面即可排序。
Manifest
/api/registry/manifest/samber-golang-code-style
LLM 文本
/api/registry/manifest/samber-golang-code-style?format=text
安装别名
/api/registry/install/samber-golang-code-style
推荐
/api/registry/recommend?task=Use%20golang-code-style%20in%20an%20agent%20workflow&limit=3
适配 Agent
编程 Agent
平台
Claude Code, OpenAI Agents
Agent 决策面板
适合 编程 Agent 的首选
将其作为优先候选,再在你的 Agent 环境中验证 README 与安装路径。
栈中角色
首选
主要匹配
编程 Agent
信任标签
可用于生产
安装路径
命令已就绪
适用场景
- 编程 Agent 工作流
- Claude Code 团队
- 重视 GitHub 采用信号的团队
证据
- 3,010 个 GitHub Stars
- 仓库近期活跃
- 已提供安装命令或 GitHub 仓库
- 82/100 质量档案
- 4 个 OpenAgentSkill 交互事件
先审查
- The SKILL.md excerpt references a 'Parallelizing Code Style Reviews' section that is not visible in the provided excerpt; ensure it exists in the full file to avoid broken references.
实施路径
- 1在沙盒 Agent 中安装它,并端到端完成一次编程 Agent任务。
- 2Compare output quality, latency, and failure behavior against at least one alternative.
- 3Promote it into production only after reviewing repository permissions, license, and maintenance signals.
信任档案
仅限沙盒
有用但信任信号不足或混杂的候选项。在结果闭环证明任务匹配前,请保持在隔离工作区内使用。
GitHub 采用度
通过3.0K 个 GitHub Stars
Star/Fork 活跃度
信息3.0K 个 Star,197 个 Fork; 当前元数据中没有议题活跃度信息
近期维护
通过距上次推送 2 天
许可证清晰度
通过MIT
积极信号
- AI 审查已通过
- 安装路径可用
- 仓库证据可用
- 近期维护的仓库
- 有意义的 GitHub 采用信号
- 安装命令未发现明显高风险模式
- 结果闭环已就绪,但需要首次真实 Agent 运行
安装前审查
- The SKILL.md excerpt references a 'Parallelizing Code Style Reviews' section that is not visible in the provided excerpt; ensure it exists in the full file to avoid broken references.
- Financial research output is not financial advice; require human review before any live investment decision.
- Quality score needs review
- Permission surface needs review: shell or command execution, filesystem or document access
- Dependency/runtime risk: command execution surface, network or browser surface
- Permission surface: shell or command execution, filesystem or document access
- 暂未有真实 Agent 结果报告
- 无人值守安装前需要人工审查
建议操作
仅在沙盒中运行,并在用于真实工作前比较接近的替代方案。
质量档案
强 适用于 Agent 工作流的候选
可靠的选择,值得加入生产工作流候选列表。
工作流匹配
在这些场景使用此 Skill
Build and ship code
Coding agents
I need a coding agent that can understand a repository, edit code, and review pull requests.
Parse messy files
Document processing
I need my agent to read PDFs, extract tables, and turn documents into structured data.
Manage repositories
GitHub automation
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
工作流匹配
加入完整工作流
Inspect, patch, and verify code
Coding review agent
A workflow for software agents that inspect repositories, review pull requests, generate tests, and turn findings into shippable patches.
Operate and verify web apps
Browser QA agent
A workflow for agents that navigate products, fill forms, take screenshots, and verify real user flows across web applications.
Design, build, test, and ship interfaces
Frontend and UI
A practical workflow for agents that turn product briefs or Figma designs into polished frontend code, review the result, test it in a browser, and prepare a safe deployment.
替代方案短名单
安装前对比
可能适合该任务的相近 Skill。
Code Review
Review a branch or diff against repository standards and the originating spec in two independent analysis passes.
Grill With Docs
A relentless interview that pressure-tests a plan against the codebase, sharpens domain language, and updates CONTEXT.md and ADRs when decisions become durable.
To Spec
Turn the current conversation and codebase context into a structured implementation spec, then publish it to the configured project issue tracker.
To Tickets
Break a plan, spec, or conversation into independently actionable tracer-bullet tickets with explicit blocking relationships.
概览
--- name: golang-code-style description: "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 license: MIT compatibility: Designed for Claude Code, Codex or similar harness, and for projects using Golang. metadata: author: samber version: "1.3.0" openclaw: emoji: "🎨" 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:*) Agent paths: - "**/*.go" ---
**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.
> **Community default.** A company skill that explicitly supersedes `samber/cc-skills-golang@golang-code-style` skill takes precedence.
# Go Code Style
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.
> "Clear is better than clever." — Go Proverbs
When ignoring a rule, add a comment to the code.
## Line Length & Breaking
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:
```go // Good — each argument on its own line, closing paren separate mux.HandleFunc("/api/users", func(w http.ResponseWriter, r *http.Request) { handleUsers( w, r, serviceName, cfg, logger, authMiddleware, ) }) ```
When a function signature is too long, the real fix is often **fewer parameters** (use an options struct) rather than better line wrapping. For multi-line signatures, put each parameter on its own line.
## Variable Declarations
SHOULD use `:=` for non-zero values, `var` for zero-value initialization. The form signals intent: `var` means "this starts at zero."
```go var count int // zero value, set later name := "default" // non-zero, := is appropriate var buf bytes.Buffer // zero value is ready to use ```
### Slice & Map Initialization
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.
```go users := []User{} // always initialized m := map[string]int{} // always initialized users := make([]User, 0, len(ids)) // preallocate when capacity is known m := make(map[string]int, len(items)) // preallocate when size is known ```
Do not preallocate speculatively — `make([]T, 0, 1000)` wastes memory when the common case is 10 items.
### Composite Literals
Composite literals MUST use field names — positional fields break when the type adds or reorders fields:
```go srv := &http.Server{ Addr: ":8080", ReadTimeout: 5 * time.Second, WriteTimeout: 10 * time.Second, } ```
## Control Flow
### Reduce Nesting
Errors and edge cases MUST be handled first (early return). Keep the happy path at minimal indentation:
```go func process(data []byte) (*Result, error) { if len(data) == 0 { return nil, errors.New("empty data") }
parsed, err := parse(data) if err != nil { return nil, fmt.Errorf("parsing: %w", err) }
return transform(parsed), nil } ```
### Eliminate Unnecessary `else`
When the `if` body ends with `return`/`break`/`continue`, the `else` MUST be dropped. Use default-then-override for simple assignments — assign a default, then override with independent conditions or a `switch`:
```go // Good — default-then-override with switch (cleanest for mutually exclusive overrides) level := slog.LevelInfo switch { case debug: level = slog.LevelDebug case verbose: level = slog.LevelWarn }
// Bad — else-if chain hides that there's a default if debug { level = slog.LevelDebug } else if verbose { level = slog.LevelWarn } else { level = slog.LevelInfo } ```
### Complex Conditions & Init Scope
When an `if` condition has 3+ operands, MUST extract into named booleans — a wall of `||` is unreadable and hides business logic. Keep expensive checks inline for short-circuit benefit. [Details](./references/details.md)
```go // Good — named booleans make intent clear isAdmin := user.Role == RoleAdmin isOwner := resource.OwnerID == user.ID isPublicVerified := resource.IsPublic && user.IsVerified if isAdmin || isOwner || isPublicVerified || permissions.Contains(PermOverride) { allow() } ```
Scope variables to `if` blocks when only needed for the check:
```go if err := validate(input); err != nil { return err } ```
### Switch Over If-Else Chains
When comparing the same variable multiple times, prefer `switch`:
```go switch status { case StatusActive: activate() case StatusInactive: deactivate() default: panic(fmt.Sprintf("unexpected status: %d", status)) } ```
## Function Design
- 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.
```go func FetchUser(ctx context.Context, id string) (*User, error) func SendEmail(ctx context.Context, msg EmailMessage) error // grouped into struct ```
### Prefer `range` for Iteration
SHOULD use `range` over index-based loops. Use `range n` (Go 1.22+) for simple counting.
```go for _, user := range users { process(user) } ```
## Value vs Pointer Arguments
Pass small types (`string`, `int`, `bool`, `time.Time`) by value. Use pointers when mutating, for large structs (~128+ bytes), or when nil is meaningful. [Details](./references/details.md)
## Code Organization Within Files
- **Group related declarations**: type, constructor, methods together - **Order**: package doc, imports, constants, types, constructors, methods, helpers - **One primary type per file** when it has significant methods - **Blank imports** (`_ "pkg"`) register side effects (init functions). Restricting them to `main` and test packages makes side effects visible at the application root, not hidden in library code - **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.
## String Handling
Use `strconv` for simple conversions (faster), `fmt.Sprintf` for complex formatting. Use `%q` in error messages to make string boundaries visible. Use `strings.Builder` for loops, `+` for simple concatenation.
## Type Conversions
Prefer explicit, narrow conversions. Use generics over `any` when a concrete type will do:
```go func Contains[T comparable](slice []T, target T) bool // not []any ```
## Philosophy
- **"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 - **Minimize public surface** — every exported name is a commitment
## Parallelizing Code Style Reviews
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).
## Enforce with Linters
Many rules are enforced automatically: `gofmt`, `gofumpt`, `goimports`, `gocritic`, `revive`, `wsl_v5`. → See the `samber/cc-skills-golang@golang-lint` skill.
## Cross-References
- → See the `samber/cc-skills-golang@golang-naming` skill for identifier naming conventions - → See the `samber/cc-skills-golang@golang-structs-interfaces` skill for pointer vs value receivers, interface design - → See the `samber/cc-skills-golang@golang-design-patterns` skill for functional options, builders, constructors - → See the `samber/cc-skills-golang@golang-lint` skill for automated formatting enforcement - → See `samber/cc-skills-golang@golang-continuous-integration` skill for automated AI-driven code review in CI using these guidelines - → See `samber/cc-skills-golang@golang-refactoring` skill for mechanically applying guard-clause conversion, function extraction, and options-struct migration safely across many call sites once a review surfaces violations at scale
技术详情
- 版本
- 1.0.0
- 许可证
- MIT
- 最近更新
- 2026年8月20日
- 发布时间
- 2026年8月20日
决策摘要
首选
3,010 个 GitHub Stars
Agent 验证证据
Agent 验证证据
来自解析、审查、安装和一次小范围运行后的结果报告。
- 成功率
- —
- 近期失败
- —
- 结果
- 0
- 输出质量
- —
- 失败
- 0
- 不相关
- 0
- 安装次数
- 0
- 风险拦截
- 0
- 需要配置
- 0
- 生产环境
- 0
暂时没有 Agent 结果数据。首次 Agent 执行可以通过 /api/agent/outcome 报告成功、需要设置、风险拦截、失败或不相关。
增长闭环
分享工具包
为 golang-code-style 准备的场景化草稿,可手动发布到 X。
golang-code-style: Golang code style conventions — line length and breaking, variable declarations, control flow... 3.0K stars https://www.openagentskill.com/skills/samber-golang-code-style?ref=x
可选:带安装命令的回复
Listing + install path for golang-code-style: https://www.openagentskill.com/skills/samber-golang-code-style?ref=x Install: npx skills add samber/cc-skills-golang --skill golang-code-style
收录来源
Registry 收录
此列表来自公开来源,维护者认领获批前不会标记为官方。
- 创作者
- samber
- 收录方
- OpenAgentSkill 社区索引
归属链接指向公开仓库或创作者主页。创作者可认领列表以更新所有权信号。
认领此 Skill所有者认领
认领此 Skill 页面
这条 Registry 收录 列表归属于 samber,但尚未标记为官方。认领后可增加已验证所有者信号,使后续发布、安装和审计更新更值得信赖。
创作者外链工具包
将证据徽章加入你的 README
在开发者评估仓库的位置展示规范页面、当前信任与审计信号,以及真实的 Agent 验证证据。
[](https://www.openagentskill.com/skills/samber-golang-code-style)
[](https://www.openagentskill.com/skills/samber-golang-code-style)
[](https://www.openagentskill.com/skills/samber-golang-code-style/audit)
[](https://www.openagentskill.com/skills/samber-golang-code-style)作者
samber
@samber
健康信号
- GitHub Stars
- 3.0K
- 质量评分
- 48/100
- 最近 GitHub 推送
- 2026年8月20日
- 框架提示
- 未知
- OpenAgentSkill 浏览量
- 4
- 复制安装命令
- 0
- 跳转点击
- 0
社区信号
告诉我们这个 Skill 是否对你的 Agent 工作流有帮助。汇总反馈会持续改善排序。
信任与安全
仅限沙盒
- GitHub 采用度3.0K 个 GitHub Stars通过
- Star/Fork 活跃度3.0K 个 Star,197 个 Fork; 当前元数据中没有议题活跃度信息信息
- 近期维护距上次推送 2 天通过
- 许可证清晰度MIT通过
- README/SKILL.md 完整度元数据包含足够的用法与工作流上下文通过
- 依赖与运行时风险command execution surface, network or browser surface检查
相关 Skill
Code Review
Review a branch or diff against repository standards and the originating spec in two independent analysis passes.
168.6K StarsGrill With Docs
A relentless interview that pressure-tests a plan against the codebase, sharpens domain language, and updates CONTEXT.md and ADRs when decisions become durable.
164.7K StarsTo Spec
Turn the current conversation and codebase context into a structured implementation spec, then publish it to the configured project issue tracker.
164.7K StarsTo Tickets
Break a plan, spec, or conversation into independently actionable tracer-bullet tickets with explicit blocking relationships.
176.7K Stars