Generated banner for Golang How To
Generated logo for Golang How To

Golang How To

Samuel BertheCommunityCreated by samberDistributed by Samuel Berthe

  • Skill
  • Meta (authoring, orchestration, planning, memory)
  • Agent tooling
  • MIT
  • Low risk

From the author

Golang skills orchestrator — always active on any Golang coding, review, debug, or setup task. Reads the task context and loads the most relevant skills from samber/cc-skills-golang, often multiple at once: writing a gRPC service loads golang-grpc + golang-testing + golang-error-handling; debugging a panic loads golang-troubleshooting + golang-safety; auditing security loads golang-security + golang-lint + golang-safety. Also: disambiguates competing clusters when two skills seem to overlap (performance vs benchmark vs troubleshooting, samber/lo vs mo vs ro, DI cluster, safety vs security), and configures the project's agent-config file (CLAUDE.md, AGENTS.md, GEMINI.md, Cursor rules, or Copilot instructions) to force-trigger skills in a project (/golang-how-to configure).
— the description by samber

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

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/samber/golang-how-to/download
  2. Unzip 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-to itself, plus an optional ## Required Go skills block, 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.

IntentPrimaryAlso load
Design an API, choose a patterngolang-design-patternsgolang-structs-interfaces, golang-naming
Name a type, function, or packagegolang-naminggolang-code-style
Handle errors idiomaticallygolang-error-handlinggolang-safety (nil-heavy code)
Write goroutines, channels, syncgolang-concurrencygolang-context (if cancellation)
Pass deadlines / cancel operationsgolang-contextgolang-concurrency (if goroutines)
Design structs, embed, use interfacesgolang-structs-interfacesgolang-design-patterns
Database queries and transactionsgolang-databasegolang-error-handling, golang-security
Build a gRPC servicegolang-grpcgolang-testing, golang-error-handling
Build a GraphQL APIgolang-graphqlgolang-testing, golang-error-handling
Build a CLI command treegolang-spf13-cobragolang-cli, golang-spf13-viper (if config)
Layer config from flags/env/filegolang-spf13-vipergolang-spf13-cobra
Write testsgolang-testinggolang-stretchr-testify (if using testify)
Apply optimization patternsgolang-performancegolang-benchmark (measure first)
Measure with pprof / benchstatgolang-benchmarkgolang-performance (fix), golang-troubleshooting (root cause)
Debug a panic or unexpected behaviorgolang-troubleshootinggolang-safety, golang-benchmark (if perf-related)
Monitor in productiongolang-observabilitygolang-performance (if SLO breach)
Audit security vulnerabilitiesgolang-securitygolang-safety, golang-lint
Review formatting and stylegolang-code-stylegolang-naming, golang-lint
Refactor or restructure existing codegolang-refactoringgolang-naming, golang-code-style, golang-project-layout
Configure golangci-lintgolang-lintgolang-code-style
Write godoc / README / CHANGELOGgolang-documentationgolang-naming
Set up a new project structuregolang-project-layoutgolang-design-patterns, golang-dependency-injection, golang-lint
Set up CI/CD pipelinegolang-continuous-integrationgolang-lint, golang-security
Choose a librarygolang-popular-librariesrelevant library-specific skill
Look up a package's docs, versions, importers, or CVEsgolang-pkg-go-devgolang-dependency-management
Navigate, diagnose, or refactor local code (definitions, references, rename)golang-gopls—
Adopt new Go language featuresgolang-modernizegolang-lint
Use samber/lo (slice/map helpers)golang-samber-logolang-data-structures, golang-performance
Use samber/oops (structured errors)golang-samber-oopsgolang-error-handling
Use log/sloggolang-samber-sloggolang-observability, golang-error-handling
Use dependency injectiongolang-dependency-injectiongolang-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, godig is 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.

  • godig answers questions about the published ecosystem: any Go package or module, whether or not it's in your go.mod yet — it calls the remote pkg.go.dev API and never touches your local checkout. Its vulns command 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 native LSP tool, or its CLI) answers questions about your specific build: your code plus every dependency exactly as pinned in go.sum, including replace directives pointing at forks or local paths — neither godig nor Context7 can see that. Its go_vulncheck operation runs a single, on-demand reachability check against the workspace as it stands right now.

  • govulncheck (the standalone CLI, wrapped by the samber/cc-skills-golang@golang-security skill) 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's go_vulncheck is a lighter-weight, single-shot version of the same analysis for use mid-edit.

Pick by task:

TaskToolHow
Find where a symbol is defined in your own repogoplssamber/cc-skills-golang@golang-gopls — go_search, then go_file_context
Understand a file's intra-package dependenciesgoplssamber/cc-skills-golang@golang-gopls — go_file_context
Jump into a dependency's exact resolved source (incl. forks/replaced versions)goplssamber/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 symbolgoplssamber/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 editgoplssamber/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-editgoplssamber/cc-skills-golang@golang-gopls — go_vulncheck
Rename, extract, inline, or otherwise refactor local codegoplssamber/cc-skills-golang@golang-gopls — safe rename, refactor.* code actions
Whole-tree vulnerability audit across the module (CI, periodic sweep)govulnchecksamber/cc-skills-golang@golang-security skill — govulncheck ./...
List available versions of a published packagegodiggodig versions <path>
Check known CVEs for a package/version you haven't added yetgodiggodig vulns <path>
See exported symbols/signatures of a published packagegodiggodig symbols / symbol doc
Get runnable code examples for a symbolgodiggodig symbol examples
Read a package's rendered README/docsgodiggodig module readme / package doc
See who imports a package across the whole public ecosystemgodiggodig imported-by
Search for a package or library candidategodiggodig search
Check a package's or module's licensegodiggodig package licenses / module licenses
Get docs for a non-Go library, or a Go module not indexed on pkg.go.devContext7resolve-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

CategorySkills
Code Qualitygolang-code-style golang-documentation golang-error-handling golang-lint golang-naming golang-safety golang-security golang-structs-interfaces
Architecture & Designgolang-concurrency golang-context golang-data-structures golang-database golang-dependency-injection golang-design-patterns golang-modernize golang-refactoring
QA & Performancegolang-benchmark golang-observability golang-performance golang-testing golang-troubleshooting
Project Setupgolang-cli golang-continuous-integration golang-dependency-management golang-gopls golang-pkg-go-dev golang-popular-libraries golang-project-layout golang-stay-updated
APIsgolang-graphql golang-grpc golang-swagger
Dependency Injectiongolang-dependency-injection golang-google-wire golang-uber-dig golang-uber-fx golang-samber-do
Frameworksgolang-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
Testinggolang-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-documentation

  • CLI: 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) vs golang-design-patterns (architectural patterns)

  • Gap — goroutine vs cancel: golang-concurrency + golang-context — load both when cancelling goroutines via context

  • Gap — correctness vs threat: golang-safety (internal bugs) vs golang-security (external threats)

  • Gap — features vs rules: golang-modernize (language adoption) vs golang-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) vs golang-naming/golang-code-style/golang-project-layout/golang-design-patterns/golang-modernize (what the resulting code should look like) — load golang-refactoring alongside 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

references/disambiguation.md

Competing clusters — deep disambiguation

Thirteen clusters where skills overlap. Each cluster includes a boundary table, concrete routing examples, and notes on gap cases not yet explicit in source skill descriptions.


Table of Contents

  • 1. Performance cluster

  • 2. Dependency injection cluster

  • 3. samber/* functional cluster

  • 4. Error handling cluster

  • 5. Style / naming / lint / docs cluster

  • 6. CLI cluster

  • 7. Testing cluster

  • 8. design-patterns vs structs-interfaces

  • 9. concurrency vs context

  • 10. safety vs security

  • 11. modernize vs lint

  • 12. Package lookup / discovery cluster

  • 13. golang-refactoring vs. the target-state rule skills

1. Performance cluster

Four skills form a "deep analysis" cluster. golang-observability is the always-on counterpart; the other three are activated on demand.

SkillUnique territoryDoes NOT own
samber/cc-skills-golang@golang-performanceOptimization patterns — "if allocation bottleneck → use sync.Pool", "if hot-path → avoid reflection"Measurement, profile capture, root cause analysis
samber/cc-skills-golang@golang-benchmarkpprof/trace capture, flame graph interpretation, benchstat comparison, CI regression detectionDeciding which optimization to apply
samber/cc-skills-golang@golang-troubleshootingDebugging workflow: reproduce, bisect, Delve, race detector, GODEBUG, test-driven debuggingProfile interpretation, optimization patterns
samber/cc-skills-golang@golang-observabilityAlways-on production signals: structured logs, Prometheus counters, OTel traces, alertingTemporary investigation, benchmark runs

Routing examples:

  • "My HTTP handler is slow in production" → start with golang-observability (check metrics/traces), then golang-benchmark (capture profiles), then golang-performance (apply fixes).

  • "My benchmark regressed by 20%" → golang-benchmark (benchstat comparison, detect root cause via pprof).

  • "I need to reduce allocations in the hot path" → golang-performance (pooling, struct layout, escape analysis).

  • "The process crashes after 10 minutes under load" → golang-troubleshooting (race detector, memory leak, Delve attach).


2. Dependency injection cluster

Start with golang-dependency-injection for library selection. Then use the library-specific skill once the choice is made.

SkillUnique territory
samber/cc-skills-golang@golang-dependency-injectionConcepts (why DI, manual injection), constructor patterns, library comparison table
samber/cc-skills-golang@golang-google-wireCompile-time codegen: wire.Build, wire.NewSet, wire.Bind, ProviderSet
samber/cc-skills-golang@golang-uber-digRuntime reflection: dig.Provide, dig.In/dig.Out, value groups, Decorate
samber/cc-skills-golang@golang-uber-fxFull application framework on top of dig: fx.New, fx.Module, lifecycle hooks, fx.Annotate
samber/cc-skills-golang@golang-samber-doType-safe container, do.Provide, scopes, health checks, graceful shutdown

Routing examples:

  • "Should I use DI in my project?" → golang-dependency-injection.

  • "My project uses google/wire, wire.Build is failing" → golang-google-wire.

  • "I want lifecycle hooks with my DI container" → golang-uber-fx (not golang-uber-dig — dig is lower-level).

  • "I want type-safe DI without code generation" → golang-samber-do or golang-uber-dig.


3. samber/* functional cluster

The three core skills cover three distinct programming models. They rarely compete in the same task.

SkillUnique territoryDoes NOT own
samber/cc-skills-golang@golang-samber-loFinite collections: lo.Map, lo.Filter, lo.Reduce, lo.Uniq, lo.GroupBy — 500+ helpersInfinite streams, event-driven pipelines
samber/cc-skills-golang@golang-samber-roInfinite/event-driven: observables, subjects, operators like Map/Filter/Throttle, backpressureFinite slice transforms
samber/cc-skills-golang@golang-samber-moMonadic types: mo.Option[T], mo.Result[T], mo.Either[L,R], mo.Future[T]Slice helpers, reactive streams

Routing examples:

  • "Transform a slice of users into a map by ID" → golang-samber-lo (lo.KeyBy).

  • "Stream events from a channel with backpressure and rate limiting" → golang-samber-ro.

  • "Return an optional value without using nil" → golang-samber-mo (mo.Some/mo.None).

  • "Compose error-returning functions without if-err chains" → golang-samber-mo (mo.Result[T]).

Note: golang-samber-mo is currently absent from the mutual cross-reference between lo and ro in their descriptions. The boundary above reflects the intended design.


4. Error handling cluster

SkillUnique territory
samber/cc-skills-golang@golang-error-handlingIdiomatic error flow: fmt.Errorf("%w"), errors.Is/errors.As, sentinel errors, single-handling rule, panic/recover
samber/cc-skills-golang@golang-samber-oopsoops.New().Code().User().Hint() builder, stack traces, APM integration, oops.Recover
samber/cc-skills-golang@golang-safetyPreventing errors from occurring: nil checks, zero-value design, integer overflow guards, append aliasing

Routing examples:

  • "How should I wrap errors so callers can match them?" → golang-error-handling.

  • "I want structured errors with HTTP codes and stack traces" → golang-samber-oops.

  • "My service panics on nil pointer dereference" → golang-safety (defensive coding) AND golang-troubleshooting (debugging the existing crash).


5. Style / naming / lint / docs cluster

These four skills each own a distinct slice of "code quality". Source descriptions include explicit mutual disclaimers.

SkillUnique territory
samber/cc-skills-golang@golang-code-styleLine formatting, blank lines between declarations, short variable names in small scopes, comment placement
samber/cc-skills-golang@golang-namingAll identifier naming rules: MixedCaps, no GetX, no IFoo prefixes, package names, error variable names
samber/cc-skills-golang@golang-lintgolangci-lint YAML config, which linters to enable, //nolint usage, CI integration
samber/cc-skills-golang@golang-documentationExported symbol comments, package-level docs, README sections, example_test.go, llms.txt

Routing examples:

  • "How do I name my constructor?" → golang-naming.

  • "My golangci-lint run reports exhaustive errors" → golang-lint.

  • "How should I format my package-level godoc comment?" → golang-documentation.

  • "When should I use a blank line between two function bodies?" → golang-code-style.


6. CLI cluster

SkillUnique territory
samber/cc-skills-golang@golang-cliExit codes, signal handling (SIGTERM), stdin/stdout/stderr patterns, progress bars, terminal detection
samber/cc-skills-golang@golang-spf13-cobracobra.Command, PersistentPreRunE, Args validators, ValidArgsFunction, SetArgs in tests
samber/cc-skills-golang@golang-spf13-viperviper.BindPFlag, AutomaticEnv, ReadInConfig, OnConfigChange, test isolation with viper.Reset()

Routing examples:

  • "My CLI should exit with code 2 on bad args" → golang-cli.

  • "How do I add shell completion to my cobra command?" → golang-spf13-cobra.

  • "How do I override config values with env vars?" → golang-spf13-viper.

  • "I'm building a new CLI from scratch" → golang-cli (architecture) + golang-spf13-cobra (command tree) + golang-spf13-viper (config).


7. Testing cluster

SkillUnique territory
samber/cc-skills-golang@golang-testingTest strategy, table-driven patterns, t.Parallel(), testcontainers, goleak, coverage, fuzz
samber/cc-skills-golang@golang-stretchr-testifyassert.Equal, require.NoError, mock.On, mock.AssertExpectations, testify/suite lifecycle

Routing examples:

  • "How do I write a table-driven test in Go?" → golang-testing.

  • "How do I assert a mock was called with specific args?" → golang-stretchr-testify.

  • "How do I detect goroutine leaks in tests?" → golang-testing (goleak).


8. design-patterns vs structs-interfaces

These two skills overlap on "how to design Go types". The split is: type-level design vs. architectural use of types.

SkillUnique territoryDoes NOT own
samber/cc-skills-golang@golang-structs-interfacesComposition over inheritance, embedding, type assertions, struct tag conventions, pointer vs value receivers, interface segregationHow types combine into architectural patterns
samber/cc-skills-golang@golang-design-patternsFunctional options, middleware chains, circuit breaker, graceful shutdown, retry patternsLow-level type mechanics

Overlap zone: "DI via interfaces" — defining small interfaces is golang-structs-interfaces; wiring multiple components together via those interfaces is golang-design-patterns.

Routing examples:

  • "Should my method take a value or pointer receiver?" → golang-structs-interfaces.

  • "How do I implement a middleware chain for my HTTP handlers?" → golang-design-patterns.

  • "How do I embed a struct without exposing its methods?" → golang-structs-interfaces.

  • "How do I implement the functional options pattern?" → golang-design-patterns.

Note: neither skill currently carries a description-level → See disclaimer for this overlap. The boundary above is the intended design, not yet explicit in the source skills.


9. concurrency vs context

These skills overlap when goroutines are cancelled via context.

SkillUnique territoryDoes NOT own
samber/cc-skills-golang@golang-concurrencyGoroutine lifecycle, channel patterns, sync.WaitGroup, errgroup, worker pools, fan-out/fan-in, detecting racesContext propagation rules
samber/cc-skills-golang@golang-contextcontext.WithCancel, context.WithTimeout, context.WithValue, propagation through call chains, WithoutCancelGoroutine coordination patterns

Overlap zone: "cancelling goroutines via context" — load both skills. golang-context owns the context API; golang-concurrency owns the goroutine coordination.

Routing examples:

  • "How do I cancel a goroutine from outside?" → both (golang-context for cancel(), golang-concurrency for select { case <-ctx.Done() }).

  • "How do I fan out N workers and collect results?" → golang-concurrency.

  • "How do I pass a deadline through multiple layers of function calls?" → golang-context.

Note: no description-level disclaimer currently exists between these two skills. Load both when the task involves both concerns.


10. safety vs security

Both skills prevent bugs, but with different threat models.

SkillUnique territoryDoes NOT own
samber/cc-skills-golang@golang-safetyNil panics, integer overflow, slice aliasing via append, concurrent map write, float equality, zero-value designExternal attackers, cryptography, secrets
samber/cc-skills-golang@golang-securitySQL/command/LDAP injection, weak crypto (math/rand), hardcoded secrets, TLS misconfiguration, SSRF, path traversalInternal runtime correctness

Routing examples:

  • "My service panics with nil pointer dereference" → golang-safety.

  • "Is this SQL query safe from injection?" → golang-security.

  • "I'm using math/rand to generate a token" → golang-security (predictable output; use crypto/rand).

  • "My slice grows unexpectedly after append" → golang-safety (append aliasing).

Note: no description-level disclaimer currently exists between these two skills. The source descriptions cross-reference in their bodies but not in the YAML frontmatter.


11. modernize vs lint

Both skills suggest code changes, but for different reasons.

SkillUnique territoryDoes NOT own
samber/cc-skills-golang@golang-modernizeAdopting language features: range-over-int, min/max builtins, iter.Seq, slices.SortFunc, log/slog, testing.T.ContextStatic analysis configuration
samber/cc-skills-golang@golang-lintgolangci-lint YAML config, enabling/disabling linters, interpreting linter output, //nolint policyLanguage feature adoption

Overlap zone: Some linters (govet, deadcode, perfsprint) produce warnings that overlap with modernize suggestions (e.g., "use slog instead of log"). The boundary: lint owns the tool configuration and suppression policy; modernize owns the rewrite patterns to apply once you've decided to adopt the feature.

Routing examples:

  • "How do I replace a for i := 0; i < n; i++ loop with the new range syntax?" → golang-modernize.

  • "My CI fails on perfsprint lint rule" → golang-lint (interpret the rule and decide whether to fix or suppress).

  • "Should I migrate from log to slog?" → golang-modernize.

  • "How do I configure golangci-lint to run only security-relevant linters?" → golang-lint.


12. Package lookup / discovery cluster

These four skills all touch "third-party packages", but each owns a different stage. golang-pkg-go-dev is the read-only lookup layer (query facts about an existing import path on pkg.go.dev); the others decide, manage, or remediate.

SkillUnique territoryDoes NOT own
samber/cc-skills-golang@golang-pkg-go-devQuerying pkg.go.dev for a known path: available versions, docs/symbols/examples, importers (imported-by), licenses, known CVEs — via the godig CLI/MCPDeciding which library to pick, editing go.mod, scanning your own tree, navigating local/resolved code (→ samber/cc-skills-golang@golang-gopls)
samber/cc-skills-golang@golang-popular-librariesRecommending a library for a use case; stdlib-vs-third-party judgmentLooking up facts about a specific published package
samber/cc-skills-golang@golang-dependency-managementEditing go.mod: go get, upgrading, pinning, replace/exclude, workspacesBrowsing a package's docs or version history
samber/cc-skills-golang@golang-securityWhole-tree vulnerability scanning with govulncheck, remediation across the moduleChecking one module's CVEs without scanning the tree

Overlap zone: "is dependency X safe / current?" — golang-pkg-go-dev answers facts (which versions exist, does this version have CVEs, who imports it); golang-dependency-management performs the upgrade/pin; golang-security scans your own code path for reachable vulnerabilities.

Routing examples:

  • "What versions of github.com/samber/lo exist?" → golang-pkg-go-dev (versions).

  • "Does golang.org/x/text v0.3.0 have known vulnerabilities?" → golang-pkg-go-dev (vulns).

  • "Which packages import my library?" → golang-pkg-go-dev (imported-by).

  • "Which logging library should I adopt?" → golang-popular-libraries.

  • "Upgrade github.com/foo/bar to the latest version" → golang-dependency-management.

  • "Scan my whole module for reachable CVEs" → golang-security (govulncheck).

Note: this skill cross-references the other three in its body (and they reference it back). Prefer golang-pkg-go-dev over Context7 for any Go package fact-lookup.

Sub-boundary — godig vs gopls: both touch third-party code, but godig queries the remote pkg.go.dev index (works for packages not yet added to the project, no local build needed) while gopls (→ samber/cc-skills-golang@golang-gopls, via its MCP server, the native LSP tool, or its CLI) reasons about your actual resolved build in go.sum (including replaced forks).

  • "Where is Foo defined in my repo?" or "find every call site of this dependency's function in my code" → golang-gopls (go_search/go_symbol_references), not golang-pkg-go-dev — godig has no visibility into local, unpublished code or call sites inside your own repo.

  • "Does this package I haven't added yet have known CVEs?" → golang-pkg-go-dev (vulns).

  • "Can my current build actually reach a vulnerability in a dependency I already use?" → golang-gopls (go_vulncheck) or golang-security (govulncheck whole-tree).

See the samber/cc-skills-golang@golang-gopls skill for the full gopls reference, and the samber/cc-skills-golang@golang-how-to skill's "godig vs gopls vs Context7 vs govulncheck" section for the full breakdown.


13. golang-refactoring vs. the target-state rule skills

golang-refactoring owns the process of changing existing Go code safely at scale — planning, blast-radius mapping, ordering staged PRs, tool-driven mechanics (gopls Rename/Inline, gofmt -r, eg, gopatch), and the human-in-the-loop git model. It does not own what the resulting code should look like — that is split across five existing skills, each answering "refactor toward what?"

SkillUnique territoryDoes NOT own
samber/cc-skills-golang@golang-refactoringThe safe, staged, at-scale process: blast-radius mapping, PR ordering (structural-before-behavioral, conflict-avoidance, dependency), the refactoring-branch git model, tool-driven mechanics, coverage-adaptive safety netNaming choices, target package layout, target design patterns, idiom adoption — the shape the code should end up in
samber/cc-skills-golang@golang-namingWhat to rename an identifier toHow to apply a rename safely across a large codebase
samber/cc-skills-golang@golang-project-layoutTarget package/directory layout, module splitsHow to move code there without breaking every caller at once (type aliases, staged migration)
samber/cc-skills-golang@golang-code-styleTarget control-flow shape (guard clauses, function size)The mechanical transform that gets existing code to that shape
samber/cc-skills-golang@golang-design-patternsTarget patterns: options structs, consumer-side interfaces, DISequencing a multi-step migration toward one of these patterns as reviewable PRs
samber/cc-skills-golang@golang-modernizeVersion-driven idiom adoption (interface{}→any, slices/maps) — typically a single mechanical sweepMulti-step structural refactors that need staged, human-reviewed PRs

Overlap zone: almost every real refactor touches both — "rename this type and move it to a new package" needs golang-naming (the new name) and golang-project-layout (the new location) for the target, plus golang-refactoring for the how: blast-radius mapping, the type-alias gradual-repair recipe, and whether this lands as one PR or a staged sequence. Load golang-refactoring together with whichever target-rule skill defines the destination shape.

Routing examples:

  • "This function is too long, break it up" → golang-code-style (what "too long" means, target shape) + golang-refactoring (Extract Function mechanics, verify behavior preserved).

  • "Rename Client.Send to Client.Publish across the whole repo" → golang-naming (is this the right name) + golang-refactoring (workspace-wide gopls Rename, risk tier, PR staging).

  • "Move this type to a new package without breaking every caller" → golang-project-layout (target location) + golang-refactoring (type-alias gradual-repair recipe, ordering).

  • "Convert all interface{} to any across the module" → golang-modernize alone is usually sufficient (single mechanical sweep); reach for golang-refactoring's staged-PR flow only if the sweep is large enough to need progressive human review.

  • "Plan a multi-week refactor to break up this god package" → golang-refactoring as the primary skill (planning gate, ordering, staged PRs), pulling in golang-project-layout and golang-design-patterns for the target shape at each step.

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