Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

google-golang-styleGoogle Go style 搜索

Agent Skill

google-golang-style 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

188

周安装

8

GitHub Stars

公开资料未说明

下载量

66
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:google-golang-style(Google Go style 搜索)
来源仓库:https://github.com/meysam81/skills
仓库路径:skills/google-golang-style
安装命令:
npx skills add https://github.com/meysam81/skills --skill google-golang-style
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/meysam81/skills --skill google-golang-style

简介

用于查找、检索和筛选相关信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中根据关键词快速定位候选结果。
  • 通过 npx skills add 命令从指定仓库安装,建议结合原始 README 核验具体用法。
  • 安装前应确认权限范围和维护状态,避免触发不必要的联网或文件读写。
  • google-golang-style 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Google Go Style Guide for Claude Code

This skill distills Google's official Go style guide into actionable rules. The guide prioritizes these attributes in order: Clarity > Simplicity > Concision > Maintainability > Consistency.

Clarity means the reader understands what the code does and why. Simplicity means accomplishing goals without unnecessary abstraction. These two trump all other concerns.

Formatting

All Go source files must conform to gofmt output. Never manually adjust formatting that gofmt handles.

Use MixedCaps or mixedCaps for all multi-word names. Never use snake_case or SCREAMING_SNAKE_CASE, even for constants.

// Correct.
const MaxPacketSize = 512
var userCount int

// Wrong.
const MAX_PACKET_SIZE = 512
var user_count int

Line Length

There is no fixed line length. If a line feels too long, prefer refactoring (extracting a variable, helper function) over splitting it. If the line is already as short as practical, let it remain long.

Do not split a line before an indentation change (function declaration, conditional). Do not split long strings (like URLs) across multiple lines.

When wrapping function parameters, group by semantic meaning, not column width:

// Group by meaning.
canvas.RenderHeptagon(
    fillColor,
    x0, y0, vertexColor0,
    x1, y1, vertexColor1,
    // ...
)

Naming

Names should not feel repetitive when used, should account for context, and should not repeat concepts that are already clear.

Package Names

  • Lowercase only, no underscores, no mixedCaps: tabwriter not tabWriter.
  • Name describes what it provides, not what it contains.
  • Avoid util, helper, common, model — these are uninformative at call sites.
  • Avoid names likely shadowed by local variables: usercount over count.
// Good: clear at the call site.
db := spannertest.NewDatabaseFromFile(...)
b := elliptic.Marshal(curve, x, y)

// Bad: uninformative.
db := test.NewDatabaseFromFile(...)
b := helper.Marshal(curve, x, y)

Receiver Names

Short (1-2 letters), abbreviation of the type, consistent across all methods:

func (t Tray) Size() int          // not (tray Tray) or (this Tray)
func (ri *ResearchInfo) Update()  // not (info *ResearchInfo)
func (s *Scanner) Next() Token    // not (self *Scanner)

Variable Names

Length proportional to scope, inversely proportional to usage frequency:

  • Small scope (1-7 lines): single letter or short word (i, c, r).
  • Medium scope (8-15 lines): single descriptive word (count, users).
  • Large scope (15-25 lines): multi-word (userCount, projectName).
  • Very large scope (25+ lines): fully descriptive names.

Familiar abbreviations for common types: r for io.Reader/*http.Request, w for io.Writer/http.ResponseWriter, ctx for context.Context.

Omit the type from the name:

var users int        // not numUsers, usersInt
var name string      // not nameString
var primary *Project // not primaryProject

Avoid Repetition

This is the most impactful naming rule. Repetition makes code noisy and harder to read.

Package vs. exported name — don't repeat the package name in the symbol:

// Good.
widget.New()           // not widget.NewWidget()
db.Load()              // not db.LoadFromDatabase()

// If the package exports only one type named after itself,
// the constructor is just New.

Method vs. receiver — don't repeat the receiver type:

func (c *Config) WriteTo(w io.Writer)   // not WriteConfigTo
func (p *Project) Name() string         // not ProjectName()

Context vs. local name — strip information already provided by context:

// In package "sqldb":
type Connection struct{} // not DBConnection

// In a method of *DB:
func (db *DB) UserCount() (int, error) {
    var count int64 // not userCountInt64
    if err := db.Load("count(distinct users)", &count); err != nil {
        return 0, fmt.Errorf("load user count: %s", err)
    }
    return int(count), nil
}

Initialisms

Initialisms keep consistent case: URL or url, never Url. ID not Id. HTTP not Http.

ScopeCorrectIncorrect
ExportedXMLAPI, ID, DB, GRPCXmlApi, Id, Db, Grpc
UnexportedxmlAPI, id, db, gRPCxmlapi, iD, dB, grpc

Getters

No Get prefix. Use the noun directly:

func (c *Config) Name() string   // not GetName()
func (u *User) Counts() int      // not GetCounts()

Use Compute or Fetch when the operation is expensive or involves I/O, to signal that the call may block.

Constants

MixedCaps only. Name by role, not by value:

const MaxPacketSize = 512     // not MAX_PACKET_SIZE, not kMaxPacketSize
const ExecuteBit = 1 << iota  // not Twelve = 12

Error Handling

Returning Errors

error is always the last return value. Return nil for success. Always return error (the interface), never a concrete error type from exported functions.

// Good.
func Lookup() (*Result, error)

// Bad: concrete error type can cause nil-pointer-in-interface bugs.
func Bad() *os.PathError

Error Strings

Not capitalized (unless starting with an exported name or proper noun). No trailing punctuation.

err := fmt.Errorf("something bad happened")     // Good.
err := fmt.Errorf("Something bad happened.")     // Bad.

Full display messages (logs, test failures, UI) should be capitalized:

log.Errorf("Operation aborted: %v", err)
t.Errorf("Op(%q) failed unexpectedly; err=%v", args, err)

Wrapping Errors

Use %w when callers need to inspect the underlying error with errors.Is/errors.As. Use %v when you want to add context but hide the chain (especially at system boundaries like RPCs).

Add context that the underlying error doesn't already provide. Don't duplicate information:

// Good: adds meaningful context.
if err := os.Open("settings.txt"); err != nil {
    return fmt.Errorf("launch codes unavailable: %w", err)
}

// Bad: duplicates the filename already in os.Open's error.
if err := os.Open("settings.txt"); err != nil {
    return fmt.Errorf("could not open settings.txt: %w", err)
}

// Bad: annotation adds no information.
return fmt.Errorf("failed: %w", err) // just return err

Sentinel Errors

Define package-level sentinel errors for expected conditions callers need to distinguish. Use errors.Is() to check (handles wrapped errors).

var (
    ErrNotFound     = errors.New("not found")
    ErrUnauthorized = errors.New("unauthorized")
)

// Caller checks with errors.Is, not ==.
if errors.Is(err, ErrNotFound) {
    // handle missing resource
}

Handle Every Error

Never discard errors with _ unless the function is documented to never fail. When discarding, comment why:

n, _ := b.Write(p) // never returns a non-nil error

Otherwise, handle it, return it, or in exceptional cases call log.Fatal. Do not panic.

Avoid In-Band Errors

Don't return -1, "", or nil to signal errors. Use multiple return values:

// Good.
func Lookup(key string) (value string, ok bool)

// Bad: caller can't distinguish "not found" from empty string.
func Lookup(key string) string

Imports

Grouping

Four groups, separated by blank lines, in this order:

  1. Standard library
  2. Third-party / project packages
  3. Protocol buffer imports (with pb suffix)
  4. Side-effect imports (_ "package")
import (
    "fmt"
    "os"

    "github.com/user/project/internal/config"
    "golang.org/x/text/encoding"

    foopb "myproj/foo/proto/proto"

    _ "myproj/rpc/protocols/dial"
)

Renaming

Avoid renaming imports unless necessary. Valid reasons:

  • Name collision with another import.
  • Generated proto packages (must rename to remove underscores, add pb suffix).
  • Uninformative names like v1 — rename to something descriptive: core "k8s.io/api/core/v1".
  • Collision with common local variable — add pkg suffix: urlpkg.

Blank and Dot Imports

Blank imports (_ "package") only in main packages or tests. Never in library code.

Never use dot imports (import. "package"). They obscure where symbols come from.

Documentation

Doc Comments

All exported names must have doc comments. Start with the name of the thing being described. Use full sentences.

// A Request represents a request to run a command.
type Request struct { ... }

// Encode writes the JSON encoding of req to w.
func Encode(w io.Writer, req *Request) { ... }

Unexported types with non-obvious behavior should also have doc comments.

Comment Style

Doc comments: full sentences, capitalized, punctuated. End-of-line comments for struct fields: can be fragments.

type Server struct {
    // BaseDir points to the base directory for data storage.
    BaseDir string

    WelcomeMessage  string // displayed when user logs in
    ProtocolVersion string // checked against incoming requests
    PageLength      int    // optional; default: 20
}

Comment line length: aim for readability on 80-column terminals, but no hard limit.

Package Comments

Immediately above the package clause, no blank line between them:

// Package math provides basic constants and mathematical functions.
package math

One package comment per package. For main packages, describe the command.

Code Organization

Simplicity First

Use the least mechanism needed. Prefer core language constructs (channels, slices, maps, loops, structs) over libraries. Look in stdlib before adding dependencies. A map[string]bool is fine for set membership — don't import a set library for that.

Package Size

  • Group types whose implementations are tightly coupled.
  • If a user must import two packages to use either meaningfully, combine them.
  • Don't put everything in one package — conceptually distinct things get their own package.
  • No "one type, one file" rule. Files should be focused enough that a maintainer can tell which file has what.

Test Doubles

Place test doubles in a separate <package>test package (e.g., creditcardtest). Name stubs by behavior when there are multiple:

package creditcardtest

// AlwaysCharges stubs creditcard.Service and simulates success.
type AlwaysCharges struct{}

func (AlwaysCharges) Charge(*creditcard.Card, money.Money) error { return nil }

// AlwaysDeclines stubs creditcard.Service and simulates declined charges.
type AlwaysDeclines struct{}

func (AlwaysDeclines) Charge(*creditcard.Card, money.Money) error {
    return creditcard.ErrDeclined
}

Happy Path

Structure code so the success path flows straight down. Handle errors immediately, then continue with main logic. Avoid nesting the success case inside conditions.

// Good: happy path flows down.
func Process(id string) (*User, error) {
    user, err := db.GetUser(id)
    if err != nil {
        return nil, fmt.Errorf("get user %s: %w", id, err)
    }

    if err := user.Validate(); err != nil {
        return nil, fmt.Errorf("validate user %s: %w", id, err)
    }

    return user, nil
}

Shadowing

Be careful with := in new scopes — it creates a new variable that shadows the outer one. This is a common source of bugs with ctx and err:

// Bug: ctx inside the if is a new variable; outer ctx unchanged.
if *shortenDeadlines {
    ctx, cancel := context.WithTimeout(ctx, 3*time.Second) // shadows!
    defer cancel()
}
// ctx here is still the original, unbounded context.

// Fix: declare cancel separately, use = not :=.
if *shortenDeadlines {
    var cancel func()
    ctx, cancel = context.WithTimeout(ctx, 3*time.Second)
    defer cancel()
}

Quick Reference: Common Mistakes

MistakeFix
MAX_PACKET_SIZEMaxPacketSize
widget.NewWidget()widget.New()
func (c *Config) GetName()func (c *Config) Name()
var numUsers intvar users int
return err (bare, no context)return fmt.Errorf("operation: %w", err)
err:= fmt.Errorf("Failed.")err:= fmt.Errorf("failed")
func Bad() *os.PathErrorfunc Bad() error
Splitting lines at 80/100/120 colsRefactor if too long; otherwise let it be
import. "foo"import "foo" and qualify: foo.Bar()
package utilName by what it provides

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.33%
按下载量换算25

Claude

32.34%
按下载量换算21

Cursor

16.6%
按下载量换算11

Gemini CLI

8.71%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills