Golang Patterns
antoniopaya22/go-rest-template
Idiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications.
Idiomatic Go patterns for error handling, interfaces, concurrency, testing, and module management
$ npx skills add rohitg00/awesome-claude-code-toolkit --skill golang-idioms -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install rohitg00/awesome-claude-code-toolkit golang-idioms --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/rohitg00/awesome-claude-code-toolkit.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/golang-idioms .claude/skills/golang-idioms && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "golang-idioms" agent skill from https://github.com/rohitg00/awesome-claude-code-toolkit/tree/main/skills/golang-idioms into .claude/skills/golang-idioms/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "golang-idioms", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/rohitg00/awesome-claude-code-toolkit/tree/main/skills/golang-idiomsType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add rohitg00/awesome-claude-code-toolkit --skill golang-idioms -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install rohitg00/awesome-claude-code-toolkit golang-idioms --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/rohitg00/awesome-claude-code-toolkit.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/golang-idioms .agents/skills/golang-idioms && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "golang-idioms" agent skill from https://github.com/rohitg00/awesome-claude-code-toolkit/tree/main/skills/golang-idioms into .agents/skills/golang-idioms/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "golang-idioms", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add rohitg00/awesome-claude-code-toolkit --skill golang-idioms -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install rohitg00/awesome-claude-code-toolkit golang-idioms --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/rohitg00/awesome-claude-code-toolkit.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/golang-idioms .cursor/skills/golang-idioms && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "golang-idioms" agent skill from https://github.com/rohitg00/awesome-claude-code-toolkit/tree/main/skills/golang-idioms into .cursor/skills/golang-idioms/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "golang-idioms", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/rohitg00/awesome-claude-code-toolkit.git --path skills/golang-idioms--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add rohitg00/awesome-claude-code-toolkit --skill golang-idioms -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install rohitg00/awesome-claude-code-toolkit golang-idioms --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/rohitg00/awesome-claude-code-toolkit.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/golang-idioms .gemini/skills/golang-idioms && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "golang-idioms" agent skill from https://github.com/rohitg00/awesome-claude-code-toolkit/tree/main/skills/golang-idioms into .gemini/skills/golang-idioms/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "golang-idioms", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install rohitg00/awesome-claude-code-toolkit golang-idiomsInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add rohitg00/awesome-claude-code-toolkit --skill golang-idioms -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/rohitg00/awesome-claude-code-toolkit.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/golang-idioms .github/skills/golang-idioms && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "golang-idioms" agent skill from https://github.com/rohitg00/awesome-claude-code-toolkit/tree/main/skills/golang-idioms into .github/skills/golang-idioms/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "golang-idioms", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add rohitg00/awesome-claude-code-toolkit --skill golang-idioms -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install rohitg00/awesome-claude-code-toolkit golang-idioms --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/rohitg00/awesome-claude-code-toolkit.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/golang-idioms .opencode/skills/golang-idioms && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "golang-idioms" agent skill from https://github.com/rohitg00/awesome-claude-code-toolkit/tree/main/skills/golang-idioms into .opencode/skills/golang-idioms/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "golang-idioms", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
golang-idiomsIdiomatic Go patterns for error handling, interfaces, concurrency, testing, and module management
Golang Idioms is an agent skill from rohitg00/awesome-claude-code-toolkit. Idiomatic Go patterns for error handling, interfaces, concurrency, testing, and module management
Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Development, covering Async programming. It works with Go. The repository describes itself as: The most comprehensive toolkit for Claude Code -- 135 agents, 35 curated skills, 42 commands, 176+ plugins, 20 hooks, 15 rules, 7 templates, 14 MCP configs, 26 companion apps, 52… The licence is Apache-2.0.
Read from SKILL.md and the folder at commit ebdf1d5. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
goFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Golang Idioms loads about 1.9k tokens when it runs. Until then it costs about 28 tokens; SKILL.md has 358 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from rohitg00/awesome-claude-code-toolkit at commit ebdf1d5, republished under its Apache-2.0 licence (© rohitg00). 358 words, ~1,945 tokens.
.claude/skills/golang-idioms/SKILL.md (or your agent's skills folder).// Return errors, never panic in library code
func LoadConfig(path string) (Config, error) {
data, err := os.ReadFile(path)
if err != nil {
return Config{}, fmt.Errorf("reading config %s: %w", path, err)
}
var cfg Config
if err := json.Unmarshal(data, &cfg); err != nil {
return Config{}, fmt.Errorf("parsing config: %w", err)
}
return cfg, nil
}Rules:
fmt.Errorf("context: %w", err)%w to allow callers to use errors.Is and errors.Asvar (
ErrNotFound = errors.New("not found")
ErrUnauthorized = errors.New("unauthorized")
)
func GetUser(id string) (User, error) {
user, ok := store[id]
if !ok {
return User{}, fmt.Errorf("user %s: %w", id, ErrNotFound)
}
return user, nil
}
// Caller
user, err := GetUser(id)
if errors.Is(err, ErrNotFound) {
http.Error(w, "user not found", http.StatusNotFound)
return
}// Keep interfaces small (1-3 methods)
type Reader interface {
Read(p []byte) (n int, err error)
}
type UserStore interface {
GetUser(ctx context.Context, id string) (User, error)
CreateUser(ctx context.Context, u User) error
}
// Accept interfaces, return structs
func NewService(store UserStore, logger *slog.Logger) *Service {
return &Service{store: store, logger: logger}
}Rules:
io.Reader, io.Writer, fmt.Stringer from the standard libraryer suffixfunc process(ctx context.Context, jobs <-chan Job, workers int) <-chan Result {
results := make(chan Result, workers)
var wg sync.WaitGroup
for range workers {
wg.Add(1)
go func() {
defer wg.Done()
for job := range jobs {
select {
case <-ctx.Done():
return
case results <- job.Execute():
}
}
}()
}
go func() {
wg.Wait()
close(results)
}()
return results
}func fanOut[T, R any](ctx context.Context, items []T, fn func(T) R, concurrency int) []R {
sem := make(chan struct{}, concurrency)
results := make([]R, len(items))
var wg sync.WaitGroup
for i, item := range items {
wg.Add(1)
sem <- struct{}{}
go func() {
defer func() { <-sem; wg.Done() }()
results[i] = fn(item)
}()
}
wg.Wait()
return results
}Rules:
context.Context as the first parametersync.WaitGroup to wait for goroutine completionfunc (s *Service) HandleRequest(ctx context.Context, req Request) (Response, error) {
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
user, err := s.store.GetUser(ctx, req.UserID)
if err != nil {
return Response{}, fmt.Errorf("getting user: %w", err)
}
ctx = context.WithValue(ctx, userKey, user)
return s.processRequest(ctx, req)
}Rules:
context.WithTimeout or context.WithDeadline for all external callsdefer cancel() after creating a cancellable contextcontext.WithValue sparingly (request-scoped values only: trace IDs, auth info)func TestValidateEmail(t *testing.T) {
tests := []struct {
name string
email string
want bool
}{
{"valid email", "user@example.com", true},
{"missing @", "userexample.com", false},
{"empty string", "", false},
{"multiple @", "user@@example.com", false},
{"valid with subdomain", "user@mail.example.com", true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := ValidateEmail(tt.email)
if got != tt.want {
t.Errorf("ValidateEmail(%q) = %v, want %v", tt.email, got, tt.want)
}
})
}
}func newTestServer(t *testing.T) *httptest.Server {
t.Helper()
handler := setupRoutes()
srv := httptest.NewServer(handler)
t.Cleanup(srv.Close)
return srv
}
func assertEqual[T comparable](t *testing.T, got, want T) {
t.Helper()
if got != want {
t.Errorf("got %v, want %v", got, want)
}
}Use t.Helper() in all test utility functions. Use t.Cleanup() instead of defer for test resource cleanup. Use testdata/ directory for test fixtures.
go.mod structure:
module github.com/org/project
go 1.23
require (
github.com/lib/pq v1.10.9
golang.org/x/sync v0.7.0
)Commands:
go mod tidy # remove unused, add missing
go mod verify # verify checksums
go list -m -u all # check for updates
go get -u ./... # update all dependencies
go mod vendor # vendor dependencies (optional)Use go mod tidy before every commit. Pin major versions. Review changelogs before updating.
Design types so their zero value is useful:
// sync.Mutex zero value is an unlocked mutex (ready to use)
var mu sync.Mutex
// bytes.Buffer zero value is an empty buffer (ready to use)
var buf bytes.Buffer
buf.WriteString("hello")
// Custom types: make zero value meaningful
type Server struct {
Addr string // defaults to ""
Handler http.Handler // defaults to nil
Timeout time.Duration // defaults to 0 (no timeout)
}
func (s *Server) ListenAndServe() error {
addr := s.Addr
if addr == "" {
addr = ":8080" // useful default
}
handler := s.Handler
if handler == nil {
handler = http.DefaultServeMux
}
// ...
}Rules:
import "log/slog"
logger := slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{
Level: slog.LevelInfo,
}))
logger.Info("request handled",
slog.String("method", r.Method),
slog.String("path", r.URL.Path),
slog.Int("status", status),
slog.Duration("latency", time.Since(start)),
)Use log/slog (standard library, Go 1.21+). Use structured fields, never string interpolation. Include request ID, user ID, and operation name in every log entry.
interface{} / any instead of concrete typesinit() for complex setup (makes testing hard)_ without comment© rohitg00, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/golang-idioms of rohitg00/awesome-claude-code-toolkit.
Open the folder on GitHubat commit ebdf1d5
Golang Idioms next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Golang Idioms this skillrohitg00/awesome-claude-code-toolkit | 2.7k | — | ~1.9k | Automated safety check: Pass | Apache-2.0 | |
| Golang Patternsantoniopaya22/go-rest-template | 172 | 9 repos | ~3.5k | Automated safety check: Pass | None | |
| Context Handling in fp-goIBM/fp-go | 2k | — | ~4.2k | Automated safety check: Pass | Apache-2.0 | |
| Go Concurrencyinference-gateway/inference-gateway | 214 | — | ~2.3k | Automated safety check: Pass | Apache-2.0 | |
| Golang Concurrencyunxed/f4 | 244 | 1 repos | ~2.4k | Automated safety check: Pass | MIT | |
| Golang Prodavila7/claude-code-templates | 33k | 8 repos | ~1.9k | Automated safety check: Pass | MIT |
antoniopaya22/go-rest-template
Idiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications.
IBM/fp-go
Covers handling Go's context.Context idiomatically in fp-go code: reading and scoping context through operators, timeouts, cancellation and converting ctx-first functions.
inference-gateway/inference-gateway
Idiomatic Go concurrency - sync primitives, channel semantics, the select statement, and the standard channel patterns (cancellation/done-channel, fan-out/fan-in, pipeline, or-done, context…
unxed/f4
Golang concurrency design — goroutine lifecycle and leak prevention, channels and select, channel ownership and direction, sync.Mutex/RWMutex/sync.Map/sync.Once/atomics, errgroup, singleflight…
davila7/claude-code-templates
Master Go 1.21+ with modern patterns, advanced concurrency, performance optimization, and production-ready microservices.
context-labs/whip
Golang concurrency patterns. An agent skill from context-labs/whip.
rohitg00/awesome-claude-code-toolkit
Web accessibility patterns for WCAG 2.2 compliance including ARIA, keyboard navigation, screen readers, and testing
rohitg00/awesome-claude-code-toolkit
Route broad or ambiguous AgentKit SEO work to the right module while keeping context scoped.
rohitg00/awesome-claude-code-toolkit
REST API design with resource naming, pagination, versioning, and OpenAPI spec generation
rohitg00/awesome-claude-code-toolkit
Authentication and authorization patterns including OAuth2, JWT, RBAC, session management, and PKCE flows
rohitg00/awesome-claude-code-toolkit
AWS cloud patterns for Lambda, ECS, S3, DynamoDB, and Infrastructure as Code with CDK/Terraform
rohitg00/awesome-claude-code-toolkit
CI/CD pipeline patterns for GitHub Actions, GitLab CI, testing strategies, and deployment automation
Works with
Categories
Idiomatic Go patterns for error handling, interfaces, concurrency, testing, and module management. Golang Idioms is an agent skill from rohitg00/awesome-claude-code-toolkit.
Golang Idioms fits situations like: tasks that involve Async programming.
Run `npx skills add rohitg00/awesome-claude-code-toolkit --skill golang-idioms -a claude-code`. Or copy the skill folder (skills/golang-idioms in rohitg00/awesome-claude-code-toolkit) into .claude/skills/golang-idioms in your project. Claude Code loads it when a task matches its description.
Run `npx skills add rohitg00/awesome-claude-code-toolkit --skill golang-idioms -a codex`. Or copy the skill folder (skills/golang-idioms in rohitg00/awesome-claude-code-toolkit) into .agents/skills/golang-idioms in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add rohitg00/awesome-claude-code-toolkit --skill golang-idioms -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/golang-idioms, .gemini/skills/golang-idioms, .github/skills/golang-idioms and .opencode/skills/golang-idioms in your project.
Going by SKILL.md and its folder, Golang Idioms needs the command-line tools its instructions call (go).
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Golang Idioms is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.9k tokens (SKILL.md is roughly 7.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Golang Idioms: Golang Patterns (antoniopaya22/go-rest-template, 172 stars), Context Handling in fp-go (IBM/fp-go, 2k stars), Go Concurrency (inference-gateway/inference-gateway, 214 stars) and Golang Concurrency (unxed/f4, 244 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
rohitg00 (a GitHub user) maintains it in rohitg00/awesome-claude-code-toolkit, which has 2,686 GitHub stars. The repository holds 38 skills in this directory. The repository was last updated on May 12, 2026.
Source: rohitg00/awesome-claude-code-toolkit on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.