Golang How To
Samuel BertheCommunityCreated by samberDistributed by Samuel Berthe
- Skill
- Meta (authoring, orchestration, planning, memory)
- Agent tooling
- MIT
- Low risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
golang-how-to acts as a central hub for Go development within an AI agent environment. It intelligently identifies the context of a user's task and automatically loads the appropriate set of specialized Go skills from the samber/cc-skills-golang library. Beyond simple loading, it disambiguates overlapping skill domains and provides a configuration mode to persist project-specific skill requirements in agent configuration files.
What it does
- Orchestrates multiple Go-specific skills simultaneously based on task context.
- Disambiguates overlapping skill domains using defined boundary tables.
- Configures project-level agent settings to force-trigger required skills.
- Integrates with gopls for semantic code navigation and diagnostics.
- Provides a structured approach to selecting and applying Go development tools.
When to use it
- When starting a new Go coding, review, or debugging task.
- When you need to ensure all relevant Go best practices and tools are active.
- When you need to configure a project to consistently use specific Go skills.
- When you are unsure which specific Go skill is best suited for a complex task.
Advantages
- Reduces manual effort by automatically loading relevant toolsets.
- Ensures consistent application of Go idioms and best practices.
- Prevents tool overlap confusion through clear disambiguation logic.
- Maintains project-specific agent configurations for team consistency.
Usage examples
- “/golang-how-to configure”
- The agent updates the project's configuration file to force-trigger necessary Go skills for future tasks.
- “Help me build a gRPC service.”
- The agent automatically loads golang-grpc, golang-testing, and golang-error-handling to support the task.
- “Debug this panic in my Go code.”
- The agent loads golang-troubleshooting and golang-safety to assist in identifying and fixing the issue.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/samber/golang-how-to/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip golang-how-to.zip -d .agents/skills
Documentation by samber
Persona: You are a Go skills orchestrator. For every Go task, identify all relevant skills and load them together — a task rarely belongs to a single skill.
Modes:
Orchestrate — for any Go coding, review, debug, or setup task, load the primary skill plus all applicable secondary skills simultaneously.
Disambiguate — when two skills seem to overlap, show the boundary table. See disambiguation.md.
Configure — write the always-load directive for
golang-how-toitself, plus an optional## Required Go skillsblock, to the project's agent-config file (CLAUDE.md, AGENTS.md, or equivalent). Follow project-config.md.
Questions: In Configure mode, ask the user through the environment's question tool — never as plain-text prose. One question at a time, wait for the answer. If the environment has no question tool, ask in prose with the same options.
Dependencies: gopls — go install golang.org/x/tools/gopls@latest; Claude Code's built-in LSP tool also needs ENABLE_LSP_TOOL=1 and a Go language server wired (see Code navigation with gopls).
Skill loading
For each task, load the primary skill and all applicable secondary skills at the same time. Do not wait — load them together at the start.
| Intent | Primary | Also load |
|---|---|---|
| Design an API, choose a pattern | golang-design-patterns | golang-structs-interfaces, golang-naming |
| Name a type, function, or package | golang-naming | golang-code-style |
| Handle errors idiomatically | golang-error-handling | golang-safety (nil-heavy code) |
| Write goroutines, channels, sync | golang-concurrency | golang-context (if cancellation) |
| Pass deadlines / cancel operations | golang-context | golang-concurrency (if goroutines) |
| Design structs, embed, use interfaces | golang-structs-interfaces | golang-design-patterns |
| Database queries and transactions | golang-database | golang-error-handling, golang-security |
| Build a gRPC service | golang-grpc | golang-testing, golang-error-handling |
| Build a GraphQL API | golang-graphql | golang-testing, golang-error-handling |
| Build a CLI command tree | golang-spf13-cobra | golang-cli, golang-spf13-viper (if config) |
| Layer config from flags/env/file | golang-spf13-viper | golang-spf13-cobra |
| Write tests | golang-testing | golang-stretchr-testify (if using testify) |
| Apply optimization patterns | golang-performance | golang-benchmark (measure first) |
| Measure with pprof / benchstat | golang-benchmark | golang-performance (fix), golang-troubleshooting (root cause) |
| Debug a panic or unexpected behavior | golang-troubleshooting | golang-safety, golang-benchmark (if perf-related) |
| Monitor in production | golang-observability | golang-performance (if SLO breach) |
| Audit security vulnerabilities | golang-security | golang-safety, golang-lint |
| Review formatting and style | golang-code-style | golang-naming, golang-lint |
| Refactor or restructure existing code | golang-refactoring | golang-naming, golang-code-style, golang-project-layout |
| Configure golangci-lint | golang-lint | golang-code-style |
| Write godoc / README / CHANGELOG | golang-documentation | golang-naming |
| Set up a new project structure | golang-project-layout | golang-design-patterns, golang-dependency-injection, golang-lint |
| Set up CI/CD pipeline | golang-continuous-integration | golang-lint, golang-security |
| Choose a library | golang-popular-libraries | relevant library-specific skill |
| Look up a package's docs, versions, importers, or CVEs | golang-pkg-go-dev | golang-dependency-management |
| Navigate, diagnose, or refactor local code (definitions, references, rename) | golang-gopls | — |
| Adopt new Go language features | golang-modernize | golang-lint |
| Use samber/lo (slice/map helpers) | golang-samber-lo | golang-data-structures, golang-performance |
| Use samber/oops (structured errors) | golang-samber-oops | golang-error-handling |
| Use log/slog | golang-samber-slog | golang-observability, golang-error-handling |
| Use dependency injection | golang-dependency-injection | golang-google-wire or golang-uber-dig or golang-uber-fx or golang-samber-do |
All skill identifiers above are short forms of samber/cc-skills-golang@<name>.
Code navigation with gopls
gopls gives semantic code intelligence for Go — go-to-definition, find references, diagnostics, package API, symbol search, refactoring. → See samber/cc-skills-golang@golang-gopls skill for the three ways to reach it (its own MCP server, the native LSP tool, and its CLI), the full capability matrix, and efficient read/edit workflows.
gopls only reasons about code that is present and resolvable in the local build: your workspace plus every dependency exactly as pinned in go.sum (including replace directives). For any fact that isn't tied to your local build — version history, licenses, ecosystem-wide importers, a package you haven't added yet — use golang-pkg-go-dev (godig). See the godig vs gopls vs Context7 vs govulncheck section below for the full boundary.
godig vs gopls vs Context7 vs govulncheck
Four tools can answer "is this dependency OK to use," and they don't overlap as much as they look:
Context7 is a general-purpose, cross-language documentation fetcher — useful when no more specific source exists. For a Go package or module,
godigis almost always the better choice: it pulls structured, Go-specific data straight from pkg.go.dev — exact versions, exported symbols with signatures, runnable examples,imported-by, and known vulnerabilities — rather than Context7's generic scraped/curated docs, which don't expose that structure and can lag or miss lesser-known Go modules. Reach for Context7 only when a dependency's documentation genuinely doesn't exist or isn't indexed on pkg.go.dev.godiganswers questions about the published ecosystem: any Go package or module, whether or not it's in yourgo.modyet — it calls the remote pkg.go.dev API and never touches your local checkout. Itsvulnscommand reports CVEs known for a package/version in isolation, regardless of whether your build actually reaches the vulnerable code path.gopls(→samber/cc-skills-golang@golang-gopls, via its MCP server, the nativeLSPtool, or its CLI) answers questions about your specific build: your code plus every dependency exactly as pinned ingo.sum, includingreplacedirectives pointing at forks or local paths — neithergodignor Context7 can see that. Itsgo_vulncheckoperation runs a single, on-demand reachability check against the workspace as it stands right now.govulncheck(the standalone CLI, wrapped by thesamber/cc-skills-golang@golang-securityskill) is the whole-tree audit: it walks the entire module's call graph to confirm which known vulnerabilities are actually reachable, and is the tool of record for CI gates and periodic security sweeps —gopls'sgo_vulncheckis a lighter-weight, single-shot version of the same analysis for use mid-edit.
Pick by task:
| Task | Tool | How |
|---|---|---|
| Find where a symbol is defined in your own repo | gopls | samber/cc-skills-golang@golang-gopls — go_search, then go_file_context |
| Understand a file's intra-package dependencies | gopls | samber/cc-skills-golang@golang-gopls — go_file_context |
Jump into a dependency's exact resolved source (incl. forks/replaced versions) | gopls | samber/cc-skills-golang@golang-gopls — go_package_api, or the native LSP tool's goToDefinition |
| Find every call site in your own code that references a dependency's symbol | gopls | samber/cc-skills-golang@golang-gopls — go_symbol_references — godig's imported-by only lists public packages, not call sites in your repo |
| Get compiler diagnostics right after an edit | gopls | samber/cc-skills-golang@golang-gopls — go_diagnostics (MCP), or automatic with the native LSP tool |
| Check whether your current build can reach a known vulnerability, mid-edit | gopls | samber/cc-skills-golang@golang-gopls — go_vulncheck |
| Rename, extract, inline, or otherwise refactor local code | gopls | samber/cc-skills-golang@golang-gopls — safe rename, refactor.* code actions |
| Whole-tree vulnerability audit across the module (CI, periodic sweep) | govulncheck | samber/cc-skills-golang@golang-security skill — govulncheck ./... |
| List available versions of a published package | godig | godig versions <path> |
| Check known CVEs for a package/version you haven't added yet | godig | godig vulns <path> |
| See exported symbols/signatures of a published package | godig | godig symbols / symbol doc |
| Get runnable code examples for a symbol | godig | godig symbol examples |
| Read a package's rendered README/docs | godig | godig module readme / package doc |
| See who imports a package across the whole public ecosystem | godig | godig imported-by |
| Search for a package or library candidate | godig | godig search |
| Check a package's or module's license | godig | godig package licenses / module licenses |
| Get docs for a non-Go library, or a Go module not indexed on pkg.go.dev | Context7 | resolve-library-id / query-docs |
See the samber/cc-skills-golang@golang-pkg-go-dev skill for the full godig command reference, and the samber/cc-skills-golang@golang-security skill for the whole-tree govulncheck remediation workflow.
Categories at a glance
Full catalog with "use when" hooks: by-category.md
| Category | Skills |
|---|---|
| Code Quality | golang-code-style golang-documentation golang-error-handling golang-lint golang-naming golang-safety golang-security golang-structs-interfaces |
| Architecture & Design | golang-concurrency golang-context golang-data-structures golang-database golang-dependency-injection golang-design-patterns golang-modernize golang-refactoring |
| QA & Performance | golang-benchmark golang-observability golang-performance golang-testing golang-troubleshooting |
| Project Setup | golang-cli golang-continuous-integration golang-dependency-management golang-gopls golang-pkg-go-dev golang-popular-libraries golang-project-layout golang-stay-updated |
| APIs | golang-graphql golang-grpc golang-swagger |
| Dependency Injection | golang-dependency-injection golang-google-wire golang-uber-dig golang-uber-fx golang-samber-do |
| Frameworks | golang-spf13-cobra golang-spf13-viper |
| samber/* | golang-samber-do golang-samber-hot golang-samber-lo golang-samber-mo golang-samber-oops golang-samber-ro golang-samber-slog |
| Testing | golang-stretchr-testify golang-testing |
Competing clusters — boundary lines
Full boundary tables with routing examples: disambiguation.md
Key clusters and their owners:
Performance:
golang-performance(optimization patterns) ·golang-benchmark(measurement) ·golang-troubleshooting(root cause) ·golang-observability(always-on production)DI:
golang-dependency-injection(concepts/decision) ·golang-google-wire(compile-time) ·golang-uber-dig(runtime reflection) ·golang-uber-fx(lifecycle framework) ·golang-samber-do(type-safe container)samber/*:
golang-samber-lo(finite transforms) ·golang-samber-ro(reactive streams) ·golang-samber-mo(monadic types)Errors:
golang-error-handling(idioms) ·golang-samber-oops(structured errors) ·golang-safety(prevent panics)Style:
golang-code-style·golang-naming·golang-lint·golang-documentationCLI:
golang-cli(architecture) ·golang-spf13-cobra(command tree) ·golang-spf13-viper(config layering)Package lookup:
golang-pkg-go-dev(query pkg.go.dev for an existing path: versions/docs/symbols/importers/CVEs) ·golang-gopls(navigate/refactor your locally resolved build) ·golang-popular-libraries(which library to adopt) ·golang-dependency-management(manage go.mod) ·golang-security(whole-tree CVE scan)Gap — type vs arch:
golang-structs-interfaces(type design) vsgolang-design-patterns(architectural patterns)Gap — goroutine vs cancel:
golang-concurrency+golang-context— load both when cancelling goroutines via contextGap — correctness vs threat:
golang-safety(internal bugs) vsgolang-security(external threats)Gap — features vs rules:
golang-modernize(language adoption) vsgolang-lint(static analysis config)Gap — process vs target rules:
golang-refactoring(the safe, staged, at-scale process of changing existing code — planning, ordering, gopls-driven mechanics, staged PRs) vsgolang-naming/golang-code-style/golang-project-layout/golang-design-patterns/golang-modernize(what the resulting code should look like) — loadgolang-refactoringalongside whichever of these owns the target shape
Configure mode
Write an always-load directive for golang-how-to itself to the project's agent-config file (CLAUDE.md, AGENTS.md, GEMINI.md, Cursor rules, or Copilot instructions — whichever the project's harness reads), and optionally force-trigger specific secondary skills too.
samber/cc-skills-golang@golang-project-layout writes the always-load directive automatically at project creation, with no user confirmation needed — it costs one skill description and never imposes project-specific choices. Running /golang-how-to configure writes it too if missing, and additionally lets the user confirm a ## Required Go skills block for skills that must always apply beyond routing. Follow project-config.md.
This skill is not exhaustive. Refer to individual skill files and the official Go documentation for detailed guidance.
If you encounter a bug or unexpected behavior in this skill plugin, open an issue at https://github.com/samber/cc-skills-golang/issues.
Files
- ATTRIBUTION.mdAdded by AutoGineer896 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md15.4 KiB
- assets/cursor-go-skills.mdc660 B
- references/by-category.md20.6 KiB
- references/disambiguation.md20.1 KiB
- references/project-config.md9.9 KiB
references/by-category.md
Golang skills — full catalog by category
42 skills. Skills marked ⭐️ are recommended for all Go projects. Skills marked ⚙️ can be superseded by a company-specific skill.
Table of Contents
Code Quality
samber/cc-skills-golang@golang-code-style⭐️ ⚙️samber/cc-skills-golang@golang-documentation⭐️ ⚙️samber/cc-skills-golang@golang-error-handling⭐️ ⚙️samber/cc-skills-golang@golang-lintsamber/cc-skills-golang@golang-naming⭐️ ⚙️samber/cc-skills-golang@golang-safety⭐️samber/cc-skills-golang@golang-security⭐️ 🧠samber/cc-skills-golang@golang-structs-interfaces⚙️
Architecture & Design
samber/cc-skills-golang@golang-concurrency⚙️samber/cc-skills-golang@golang-context⚙️samber/cc-skills-golang@golang-data-structures⭐️samber/cc-skills-golang@golang-database⭐️ ⚙️samber/cc-skills-golang@golang-dependency-injection⚙️samber/cc-skills-golang@golang-design-patterns⭐️ ⚙️samber/cc-skills-golang@golang-modernize⭐️
QA & Performance
samber/cc-skills-golang@golang-benchmark🧠samber/cc-skills-golang@golang-observability⚙️samber/cc-skills-golang@golang-performance🧠samber/cc-skills-golang@golang-testing⭐️ 🧠 ⚙️samber/cc-skills-golang@golang-troubleshooting⭐️ 🧠
Project Setup
samber/cc-skills-golang@golang-clisamber/cc-skills-golang@golang-continuous-integrationsamber/cc-skills-golang@golang-dependency-managementsamber/cc-skills-golang@golang-pkg-go-devsamber/cc-skills-golang@golang-popular-librariessamber/cc-skills-golang@golang-project-layoutsamber/cc-skills-golang@golang-stay-updated
APIs
samber/cc-skills-golang@golang-graphqlsamber/cc-skills-golang@golang-grpcsamber/cc-skills-golang@golang-swagger
Dependency Injection
samber/cc-skills-golang@golang-dependency-injection⚙️samber/cc-skills-golang@golang-google-wiresamber/cc-skills-golang@golang-uber-digsamber/cc-skills-golang@golang-uber-fxsamber/cc-skills-golang@golang-samber-do
Frameworks
samber/cc-skills-golang@golang-spf13-cobrasamber/cc-skills-golang@golang-spf13-viper
samber/*
samber/cc-skills-golang@golang-samber-dosamber/cc-skills-golang@golang-samber-hotsamber/cc-skills-golang@golang-samber-losamber/cc-skills-golang@golang-samber-mo🧠samber/cc-skills-golang@golang-samber-oopssamber/cc-skills-golang@golang-samber-ro🧠samber/cc-skills-golang@golang-samber-slog
Testing
samber/cc-skills-golang@golang-stretchr-testifysamber/cc-skills-golang@golang-testing⭐️ 🧠 ⚙️
Code Quality
samber/cc-skills-golang@golang-code-style ⭐️ ⚙️
Golang code formatting, conventions, and project-level style consistency — gofmt, goimports, line length, var declarations, blank lines, comment heuristics.
Use when: the user asks about formatting rules, style review, or project coding standards. Not for naming conventions (→ golang-naming), linter configuration (→ golang-lint), or doc comments (→ golang-documentation).
samber/cc-skills-golang@golang-documentation ⭐️ ⚙️
Golang documentation standards — package docs, godoc conventions, example functions, README structure, CHANGELOG, llms.txt, API reference generation.
Use when: writing or reviewing Go doc comments, README files, or API reference. Not for code comments that explain logic (→ golang-code-style).
samber/cc-skills-golang@golang-error-handling ⭐️ ⚙️
Golang error handling best practices — error creation, wrapping with fmt.Errorf and errors.Is/As, sentinel errors, custom error types, panic recovery.
Use when: writing or reviewing error propagation, wrapping, logging, or recovery patterns. For samber/oops specifics → golang-samber-oops. For preventing panics → golang-safety.
samber/cc-skills-golang@golang-lint
Golang linting — golangci-lint configuration, presets, custom rules, CI integration, nolint suppressions, linter selection and output interpretation.
Use when: setting up or tuning golangci-lint, interpreting lint failures, or deciding which linters to enable. For style conventions not enforced by linters → golang-code-style.
samber/cc-skills-golang@golang-naming ⭐️ ⚙️
Golang naming conventions across all identifier types — packages, constructors, structs, interfaces, constants, errors, receivers, acronyms, test functions. Covers MixedCaps rules, Get-prefix, and utils/helpers anti-patterns.
Use when: naming a new type, function, package, or constant. Not for broader formatting (→ golang-code-style).
samber/cc-skills-golang@golang-safety ⭐️
Defensive Golang coding — prevents panics, silent data corruption, and runtime bugs. Nil safety, append aliasing, map concurrent access, float comparison, zero-value design, numeric overflow.
Use when: writing or reviewing code that could silently produce wrong results or panic. Not for external threats (→ golang-security) or error handling idioms (→ golang-error-handling).
samber/cc-skills-golang@golang-security ⭐️ 🧠
Golang security best practices — injection prevention (SQL, command, XSS), cryptography, filesystem/network safety, secrets management, cookie security, tool configuration. Audit and review modes.
Use when: auditing a codebase for vulnerabilities, writing security-sensitive code, or reviewing auth/crypto/secrets handling. Not for runtime correctness bugs (→ golang-safety).
samber/cc-skills-golang@golang-structs-interfaces ⚙️
Golang struct and interface design — composition, embedding, type assertions, interface segregation, struct tags (JSON/YAML/DB), pointer vs value receivers.
Use when: designing types, choosing between value vs pointer receivers, writing struct tags, or working with interface hierarchies. For architectural patterns that use interfaces → golang-design-patterns.
Architecture & Design
samber/cc-skills-golang@golang-concurrency ⚙️
Golang concurrency patterns — goroutines, channels, sync primitives, context cancellation, worker pools, fan-out/fan-in, pipelines, errgroup.
Use when: writing concurrent code, coordinating goroutines, or reviewing for race conditions. For context propagation specifically → golang-context. When cancelling goroutines via context — load both.
samber/cc-skills-golang@golang-context ⚙️
Idiomatic context.Context usage — creation, cancellation, timeouts, values, propagation patterns, WithoutCancel, common anti-patterns.
Use when: propagating deadlines and cancellation signals, or passing request-scoped values. Not for code that merely accepts ctx as first parameter.
samber/cc-skills-golang@golang-data-structures ⭐️
Golang data structures internals and usage — slices (capacity growth, append aliasing), maps, channels, sync primitives, container/*, generic collections, and when to use each.
Use when: choosing a data structure, understanding slice/map performance characteristics, or using container/list, container/heap, or ring.
samber/cc-skills-golang@golang-database ⭐️ ⚙️
Golang database access patterns — parameter binding, connection pooling, transactions, migrations, sqlboiler/sqlc code generation, query builders.
Use when: writing SQL queries, designing repository patterns, or configuring database connections. For security aspects of queries (injection) → also consult golang-security.
samber/cc-skills-golang@golang-dependency-injection ⚙️
Dependency injection patterns in Golang — constructor injection, interface-based DI, wire/dig/fx comparison, and when DI is worth the complexity.
Use when: deciding whether to use DI, designing constructor signatures, or comparing DI libraries. For a specific DI library → golang-google-wire, golang-uber-dig, golang-uber-fx, or golang-samber-do.
samber/cc-skills-golang@golang-design-patterns ⭐️ ⚙️
Idiomatic Golang design patterns — functional options, constructors, builder pattern, middleware chains, circuit breaker, and architecture guides.
Use when: choosing architectural patterns, designing APIs, or implementing resilience patterns. For type-level design (embedding, receivers) → golang-structs-interfaces.
samber/cc-skills-golang@golang-modernize ⭐️
Modernize Golang code using recent language features — range-over-int, min/max builtins, iterators, slices/maps/cmp/slog stdlib packages, testing patterns (t.Context, b.Loop, synctest), and tooling upgrades.
Use when: upgrading a codebase to a newer Go version or replacing pre-generics patterns. Not for lint rule enforcement (→ golang-lint).
QA & Performance
samber/cc-skills-golang@golang-benchmark 🧠
Golang benchmarking, profiling, and performance measurement — pprof, trace, CPU/memory/block profiles, flame graphs, benchstat, CI regression detection, continuous profiling.
Use when: measuring performance, capturing profiles, comparing benchmark runs, or setting up CI regression detection. For applying optimization patterns → golang-performance. For debugging a crash → golang-troubleshooting.
samber/cc-skills-golang@golang-observability ⚙️
Golang production observability — structured logging (slog), Prometheus metrics, OpenTelemetry tracing, pprof profiling endpoints, alerting, Grafana dashboards.
Use when: instrumenting a service for production monitoring. Not for temporary deep-dive investigation (→ golang-benchmark, golang-performance).
samber/cc-skills-golang@golang-performance 🧠
Golang performance optimization — allocation reduction, CPU efficiency, memory layout, GC tuning, pooling, caching, hot-path optimization.
Use when: applying optimization patterns after profiling. Not for measurement methodology (→ golang-benchmark) or debugging workflow (→ golang-troubleshooting).
samber/cc-skills-golang@golang-testing ⭐️ 🧠 ⚙️
Production-ready Golang tests — table-driven tests, fuzzing, fixtures, goroutine leak detection (goleak), snapshot testing, code coverage, integration tests, parallel tests.
Use when: writing or reviewing tests. For testify-specific APIs → golang-stretchr-testify. For measurement methodology → golang-benchmark.
samber/cc-skills-golang@golang-troubleshooting ⭐️ 🧠
Systematic Golang debugging — common pitfalls, test-driven debugging, pprof capture, Delve debugger, race detection, GODEBUG tracing, production debugging.
Use when: debugging a panic, unexpected output, or hard-to-reproduce bug. Not for interpreting profiles (→ golang-benchmark) or applying optimization patterns (→ golang-performance).
Project Setup
samber/cc-skills-golang@golang-cli
Golang CLI application development — project layout, exit codes, signal handling, I/O patterns, argument parsing, terminal UX.
Use when: building a CLI tool from scratch. For cobra-specific APIs → golang-spf13-cobra. For viper configuration → golang-spf13-viper.
samber/cc-skills-golang@golang-continuous-integration
CI/CD pipeline configuration for Golang projects using GitHub Actions — build, test, lint, and release workflows.
Use when: setting up or improving a CI pipeline for a Go project.
samber/cc-skills-golang@golang-dependency-management
Golang module dependency strategies — go.mod conventions, versioning, replace directives, tool dependencies, and multi-module workspaces.
Use when: managing go.mod, dealing with replace directives, or structuring a multi-module repo.
samber/cc-skills-golang@golang-pkg-go-dev
Golang package and module exploration via godig, a pkg.go.dev API client (CLI + MCP server) — docs, symbols, versions, importers, licenses, and known vulnerabilities.
Use when: looking up a module's available versions, CVEs, docs/symbols, or who imports it, or searching pkg.go.dev. For upgrading deps → golang-dependency-management; for choosing a library → golang-popular-libraries.
samber/cc-skills-golang@golang-popular-libraries
Curated recommendations for production-ready Golang libraries — when the stdlib is enough vs when to reach for a package.
Use when: choosing a library for a new concern (HTTP, logging, testing, etc.). For deep guidance on a specific library → use the library-specific skill.
samber/cc-skills-golang@golang-project-layout
Golang project structure and workspace setup — cmd/internal/pkg conventions, monorepo layout, CLI project structure, and when to keep things flat.
Use when: starting a new project or restructuring an existing one. For architectural patterns within the project → golang-design-patterns.
samber/cc-skills-golang@golang-stay-updated
Resources to stay current with Golang — official channels, community hubs, key people to follow, learning resources.
Use when: looking for ways to track Go releases, proposals, and community news.
APIs
samber/cc-skills-golang@golang-graphql
GraphQL API development in Golang using gqlgen/graphql-go — schema definition, resolvers, subscriptions, dataloader, federation.
Use when: building a GraphQL API in Go.
samber/cc-skills-golang@golang-grpc
gRPC in Golang — protobuf organization, service definitions, streaming, interceptors, error codes, code generation workflow.
Use when: building or consuming a gRPC service. For OpenAPI/REST documentation → golang-swagger.
samber/cc-skills-golang@golang-swagger
OpenAPI/Swagger docs with swaggo/swag — annotation comments, code generation, framework integrations (gin, echo, fiber, chi), security definitions.
Use when: generating OpenAPI documentation from Go code annotations.
Dependency Injection
samber/cc-skills-golang@golang-dependency-injection ⚙️
See "Architecture & Design" section above.
samber/cc-skills-golang@golang-google-wire
Compile-time dependency injection with google/wire — provider sets, injector generation, wire.Build, and structured DI patterns.
Use when: the codebase imports github.com/google/wire or the team has chosen compile-time DI. For runtime DI with reflection → golang-uber-dig.
samber/cc-skills-golang@golang-uber-dig
Reflection-based DI with uber-go/dig — Provide/Invoke, dig.In/dig.Out, named values, value groups, optional dependencies, Decorate.
Use when: the codebase imports go.uber.org/dig. For higher-level lifecycle and modules → golang-uber-fx.
samber/cc-skills-golang@golang-uber-fx
Application framework with uber-go/fx — fx.New, fx.Provide/Invoke, fx.Module, lifecycle hooks, fx.Annotate, fx.Decorate, signal-aware Run.
Use when: the codebase imports go.uber.org/fx. For raw DI without lifecycle → golang-uber-dig.
samber/cc-skills-golang@golang-samber-do
Dependency injection with samber/do — type-safe service containers, lifecycle management, scopes, health checks, graceful shutdown.
Use when: the codebase imports github.com/samber/do.
Frameworks
samber/cc-skills-golang@golang-spf13-cobra
CLI command trees with spf13/cobra — command hierarchy, RunE hooks, flag management, shell completion, usage templates, testing with SetArgs.
Use when: the codebase imports github.com/spf13/cobra. For configuration layering → golang-spf13-viper. For general CLI architecture → golang-cli.
samber/cc-skills-golang@golang-spf13-viper
Layered configuration with spf13/viper — flag > env > file > KV > default precedence, BindPFlag, hot reload, test isolation, remote KV integration.
Use when: the codebase imports github.com/spf13/viper. For CLI command structure → golang-spf13-cobra. For general CLI architecture → golang-cli.
samber/*
samber/cc-skills-golang@golang-samber-do
See "Dependency Injection" section above.
samber/cc-skills-golang@golang-samber-hot
In-memory caching with samber/hot — 9 eviction algorithms (LRU, LFU, TinyLFU, W-TinyLFU, S3FIFO, ARC, SIEVE), TTL, loaders, sharding, stale-while-revalidate, Prometheus metrics.
Use when: the codebase imports github.com/samber/hot.
samber/cc-skills-golang@golang-samber-lo
Functional programming helpers with samber/lo — 500+ type-safe generic functions for slices, maps, channels, strings. Immutable (lo), parallel (lop), mutable (lom), iterators (loi), SIMD.
Use when: the codebase imports github.com/samber/lo. Not for streaming pipelines (→ golang-samber-ro).
samber/cc-skills-golang@golang-samber-mo 🧠
Monadic types with samber/mo — Option, Result, Either, Future, IO, Task, State for type-safe nullable values, error handling, and functional composition.
Use when: the codebase imports github.com/samber/mo.
samber/cc-skills-golang@golang-samber-oops
Structured error handling with samber/oops — error builders, stack traces, error codes, context attributes, public vs developer messages, panic recovery, APM integration.
Use when: the codebase imports github.com/samber/oops.
samber/cc-skills-golang@golang-samber-ro 🧠
Reactive streams with samber/ro — 150+ type-safe operators, cold/hot observables, 5 subject types, 40+ plugins, automatic backpressure, Go context integration.
Use when: the codebase imports github.com/samber/ro. Not for finite slice transforms (→ golang-samber-lo).
samber/cc-skills-golang@golang-samber-slog
Structured logging pipeline with samber/slog-* packages — multi-handler routing (slog-multi), sampling, formatting, HTTP middleware, 20+ backend sinks.
Use when: the codebase imports any github.com/samber/slog-* package.
Testing
samber/cc-skills-golang@golang-stretchr-testify
Testing with stretchr/testify — assert, require, mock, and suite packages. Assertions, mock expectations, argument matchers, suite lifecycle, custom matchers.
Use when: the codebase imports github.com/stretchr/testify. For test architecture and strategy → golang-testing.
samber/cc-skills-golang@golang-testing ⭐️ 🧠 ⚙️
See "QA & Performance" section above.
Requirements and compatibility
Written for: Claude Code, OpenAI Codex
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Declares allowed tools, Claude Code frontmatter, Needs an MCP server
The author says: Designed for Claude Code, Codex or similar harness. Requires git.
Security
What our scanner noticed· Low risk
- Phrasing that asks for actions without confirmation
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- samber
- Publisher
- Samuel Berthe (Community)
- Distributed by
- Samuel Berthe
- Source
- samber/cc-skills-golang · skills/golang-how-to · commit bb1d43d
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by samber or Samuel Berthe.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download golang-how-to.zip