CommunityCodierung & Entwicklunggithub.com

samber/golang-how-to

Go-Fähigkeiten-Orchestrator – immer aktiv bei Go-Programmierung, Code-Review, Debugging oder Setup-Aufgaben. Liest den Aufgabenkontext und lädt die relevantesten Skills aus samber/cc-skills-golang, oft mehrere gleichzeitig.

Was ist golang-how-to?

Dieser Skill fungiert als zentraler Orchestrator für alle Go-bezogenen Aufgaben in KI-gestützten Entwicklungsumgebungen (wie Claude Code, Cursor, Codex). Statt auf einen einzelnen Skill beschränkt zu sein, analysiert er den Kontext einer Aufgabe (z. B. 'einen gRPC-Dienst schreiben', 'einen Panic debuggen' oder 'Sicherheitslücken auditieren') und lädt automatisch die primären und sekundären Skills aus der samber/cc-skills-golang-Bibliothek zusammen. Dadurch wird sichergestellt, dass der KI-Assistent stets das relevanteste Fachwissen parat hat – z. B. für gRPC-Aufgaben: golang-grpc + golang-testing + golang-error-handling. Zusätzlich beherrscht er drei Modi: Orchestrieren (automatisches Laden), Disambiguieren (Auflösen von Überschneidungen zwischen Skills wie Performance vs. Benchmark) und Konfigurieren (automatisches Schreiben von Agentenkonfigurationsdateien wie CLAUDE.md, AGENTS.md oder Cursor-Regeln, um Skills projektweit zu erzwingen). Für den Fall, dass zwei Skills scheinbar überlappen, zeigt er eine Grenztabelle. Der Skill ist essentiell für Entwickler, die KI-unterstützt effizient Go-Code schreiben, refaktorisieren, debuggen und optimieren möchten.

Funktioniert mit✓Claude Code✓Codex CLI✓Cursor✓Gemini CLI
npx skills add https://github.com/samber/cc-skills-golang/tree/main/skills/golang-how-to

Installed? Explore more Codierung & Entwicklung skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Persona: Sie sind ein Go-Skills-Orchestrator. Identifizieren Sie für jede Go-Aufgabe alle relevanten Skills und laden Sie sie gemeinsam – eine Aufgabe gehört selten zu einem einzelnen Skill.

Modi:

  • Orchestrieren – für jede Go-Programmier-, Review-, Debug- oder Setup-Aufgabe den primären Skill zusammen mit allen passenden sekundären Skills gleichzeitig laden.
  • Disambiguieren – wenn zwei Skills überlappen, die Grenztabelle anzeigen. Siehe disambiguation.md.
  • Konfigurieren – die Always-Load-Direktive für golang-how-to selbst sowie optional einen ## Required Go skills-Block in die Agentenkonfigurationsdatei (CLAUDE.md, AGENTS.md oder gleichwertig) schreiben. Befolgen Sie dazu project-config.md.

Fragen: Im Konfigurieren-Modus den Benutzer über das Fragewerkzeug der Umgebung fragen – niemals als Fließtext. Eine Frage nach der anderen, auf die Antwort warten. Wenn die Umgebung kein Fragewerkzeug hat, als Fließtext mit denselben Optionen fragen.

Abhängigkeiten: gopls – go install golang.org/x/tools/gopls@latest; das eingebaute LSP-Werkzeug von Claude Code benötigt außerdem ENABLE_LSP_TOOL=1 und einen verbundenen Go-Sprachserver (siehe Code-Navigation mit gopls).

Skill-Laden

Für jede Aufgabe den primären Skill und alle passenden sekundären Skills gleichzeitig laden. Nicht warten – gleich zu Beginn gemeinsam laden.

AbsichtPrimärEbenfalls laden
Eine API entwerfen, ein Muster wählengolang-design-patternsgolang-structs-interfaces, golang-naming
Einen Typ, eine Funktion oder ein Paket benennengolang-naminggolang-code-style
Fehler idiomatisch behandelngolang-error-handlinggolang-safety (nil-lastiger Code)
Goroutinen, Channels, Sync schreibengolang-concurrencygolang-context (falls Abbruch)
Fristen setzen / Operationen abbrechengolang-contextgolang-concurrency (falls Goroutinen)
Structs entwerfen, einbetten, Interfaces nutzengolang-structs-interfacesgolang-design-patterns
Datenbankabfragen und Transaktionengolang-databasegolang-error-handling, golang-security
Einen gRPC-Dienst bauengolang-grpcgolang-testing, golang-error-handling
Eine GraphQL-API bauengolang-graphqlgolang-testing, golang-error-handling
Einen CLI-Befehlsbaum bauengolang-spf13-cobragolang-cli, golang-spf13-viper (falls Konfiguration)
Konfiguration aus Flags/Datei/Umgebungsvariablen schichtengolang-spf13-vipergolang-spf13-cobra
Tests schreibengolang-testinggolang-stretchr-testify (falls testify verwendet)
Optimierungsmuster anwendengolang-performancegolang-benchmark (zuerst messen)
Mit pprof/benchstat messengolang-benchmarkgolang-performance (beheben), golang-troubleshooting (Ursachenforschung)
Einen Panic oder unerwartetes Verhalten debuggengolang-troubleshootinggolang-safety, golang-benchmark (falls leistungsbezogen)
In der Produktion überwachengolang-observabilitygolang-performance (falls SLO-Verletzung)
Sicherheitslücken auditierengolang-securitygolang-safety, golang-lint
Formatierung und Stil prüfengolang-code-stylegolang-naming, golang-lint
Vorhandenen Code refaktorisieren oder umstrukturierengolang-refactoringgolang-naming, golang-code-style, golang-project-layout
golangci-lint konfigurierengolang-lintgolang-code-style
godoc / README / CHANGELOG schreibengolang-documentationgolang-naming
Eine neue Projektstruktur einrichtengolang-project-layoutgolang-design-patterns, golang-dependency-injection, golang-lint
CI/CD-Pipeline einrichtengolang-continuous-integrationgolang-lint, golang-security
Eine Bibliothek auswählengolang-popular-librariesrelevanter bibliotheksspezifischer Skill
Dokumentation, Versionen, Importierer oder CVEs eines Pakets nachschlagengolang-pkg-go-devgolang-dependency-management
Lokalen Code navigieren, diagnostizieren oder refaktorisieren (Definitionen, Referenzen, Umbenennung)golang-gopls—
Neue Go-Sprachfunktionen übernehmengolang-modernizegolang-lint
samber/lo verwenden (Slice/Map-Helfer)golang-samber-logolang-data-structures, golang-performance
samber/oops verwenden (strukturierte Fehler)golang-samber-oopsgolang-error-handling
log/slog verwendengolang-samber-sloggolang-observability, golang-error-handling
Dependency Injection verwendengolang-dependency-injectiongolang-google-wire oder golang-uber-dig oder golang-uber-fx oder golang-samber-do

Alle obigen Skill-IDs sind Kurzformen von samber/cc-skills-golang@<name>.

Code-Navigation mit gopls

gopls bietet semantische Code-Intelligenz für Go – Gehe-zu-Definition, Referenzen finden, Diagnosen, Paket-API, Symbolsuche, Refactoring. → Siehe samber/cc-skills-golang@golang-gopls-Skill für die drei Zugriffswege (eigener MCP-Server, natives LSP-Werkzeug und dessen CLI), die vollständige Fähigkeitsmatrix und effiziente Lese-/Bearbeitungs-Workflows.

gopls denkt nur über Code nach, der im lokalen Build vorhanden und auflösbar ist: Ihr Arbeitsbereich plus jede Abhängigkeit genau so, wie sie in go.sum festgelegt ist (einschließlich replace-Direktiven). Für Fakten, die nicht an Ihren lokalen Build gebunden sind – Versionshistorie, Lizenzen, Ökosystem-weite Importierer, ein noch nicht hinzugefügtes Paket – verwenden Sie golang-pkg-go-dev (godig). Siehe den Abschnitt godig vs gopls vs Context7 vs govulncheck unten für die vollständige Abgrenzung.

godig vs gopls vs Context7 vs govulncheck

Vier Werkzeuge können die Frage „Ist diese Abhängigkeit sicher zu verwenden?“ beantworten, und sie überschneiden sich weniger, als es scheint:

  • Context7 ist ein allgemeiner, sprachübergreifender Dokumentationsabrufer – nützlich, wenn keine spezifischere Quelle existiert. Für ein Go-Paket oder -Modul ist godig fast immer die bessere Wahl: Es ruft strukturierte, Go-spezifische Daten direkt von pkg.go.dev ab – genaue Versionen, exportierte Symbole mit Signaturen, ausführbare Beispiele, imported-by und bekannte Schwachstellen – und nicht die generischen, gescrapten/kuratieren Dokumente von Context7, die diese Struktur nicht bieten und bei weniger bekannten Go-Modulen veraltet sein oder fehlen können. Greifen Sie nur dann zu Context7, wenn die Dokumentation einer Abhängigkeit wirklich nicht existiert oder nicht auf pkg.go.dev indiziert ist.
  • godig beantwortet Fragen zum veröffentlichten Ökosystem: jedes Go-Paket oder -Modul, unabhängig davon, ob es bereits in Ihrer go.mod steht – es ruft die entfernte pkg.go.dev-API auf und berührt niemals Ihr lokales Checkout. Der Befehl vulns meldet CVEs, die für ein Paket/eine Version isoliert bekannt sind, unabhängig davon, ob Ihr Build tatsächlich den verwundbaren Codepfad erreicht.
  • gopls (→ samber/cc-skills-golang@golang-gopls, über seinen MCP-Server, das native LSP-Werkzeug oder seine CLI) beantwortet Fragen zu Ihrem spezifischen Build: Ihrem Code plus jeder

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

samber/golang-benchmark

Golang benchmarking, profiling, and performance measurement. Use when writing, running, or comparing Go benchmarks, profiling hot paths with pprof, interpreting CPU/memory/trace profiles, analyzing results with benchstat, setting up CI benchmark regression detection, or investigating production performance with Prometheus runtime metrics. Also use when the developer needs deep analysis on a specific performance indicator - this skill provides the measurement methodology, while `samber/cc-skills-golang@golang-performance` provides the optimization patterns.

samber/golang-cli

Golang CLI application development. Use when building, modifying, or reviewing a Go CLI tool — especially for command structure, flag handling, configuration layering, version embedding, exit codes, I/O patterns, signal handling, shell completion, argument validation, and CLI unit testing. Also triggers when code uses cobra, viper, or urfave/cli. For cobra-specific APIs → See `samber/cc-skills-golang@golang-spf13-cobra` skill; for viper configuration layering → See `samber/cc-skills-golang@golang-spf13-viper` skill.

samber/golang-code-style

Golang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments help vs hurt. Use when writing or reviewing Go code, asking about style or clarity, or establishing project coding standards. Not for naming conventions (→ See `samber/cc-skills-golang@golang-naming` skill), linter configuration (→ See `samber/cc-skills-golang@golang-lint` skill), or doc comments (→ See `samber/cc-skills-golang@golang-documentation` skill).

samber/golang-concurrency

Golang concurrency patterns. Use when writing or reviewing concurrent Go code involving goroutines, channels, select, locks, sync primitives, errgroup, singleflight, worker pools, or fan-out/fan-in pipelines. Also triggers when you detect goroutine leaks, race conditions, channel ownership issues, or need to choose between channels and mutexes.

samber/golang-context

Idiomatic context.Context usage in Golang — propagation through API boundaries, cancellation, timeouts and deadlines, request-scoped values, context.WithoutCancel for background work outliving requests. Apply when designing context propagation across layers, debugging leaked or unexpired contexts, choosing between context.Background/TODO/WithoutCancel, or storing values in context. Not for code that merely accepts ctx as first parameter.

samber/golang-continuous-integration

CI/CD pipeline configuration using GitHub Actions for Golang projects — testing, linting, SAST, security scanning, code coverage, Dependabot, Renovate, GoReleaser, code review automation, and release pipelines. Use when setting up or improving Go project CI, configuring GitHub Actions workflows, adding linters or security scanners, automating dependency updates, or adding quality gates.

samber/golang-database

Comprehensive guide for Go database access — parameterized queries, struct scanning, NULLable columns, transactions, isolation levels, SELECT FOR UPDATE, connection pool, batch processing, context propagation, and migration tooling. Use when writing, reviewing, or debugging Golang code that interacts with PostgreSQL, MariaDB, MySQL, or SQLite; for database testing; or for questions about database/sql, sqlx, or pgx. Does NOT generate database schemas or migration SQL.

samber/golang-data-structures

Golang data structures — slices (internals, capacity growth, preallocation, slices package), maps (internals, hash buckets, maps package), arrays, container/list/heap/ring, strings.Builder vs bytes.Buffer, generic collections, pointers (unsafe.Pointer, weak.Pointer), and copy semantics. Use when choosing or optimizing Go data structures, implementing generic containers, using container/ packages, unsafe or weak pointers, or questioning slice/map internals.

samber/golang-dependency-injection

Comprehensive guide for dependency injection (DI) in Golang. Covers why DI matters (testability, loose coupling, separation of concerns, lifecycle management), manual constructor injection, and DI library comparison (google/wire, uber-go/dig, uber-go/fx, samber/do). Use this skill when designing service architecture, setting up dependency injection, refactoring tightly coupled code, managing singletons or service factories, or when the user asks about inversion of control, service containers, or wiring dependencies in Go. For a specific DI library, → See `samber/cc-skills-golang@golang-google-wire`, `samber/cc-skills-golang@golang-uber-dig`, `samber/cc-skills-golang@golang-uber-fx`, or `samber/cc-skills-golang@golang-samber-do` skills.

samber/golang-dependency-management

Dependency management strategies for Golang projects — go.mod management, installing/upgrading packages, Minimal Version Selection, vulnerability scanning, outdated dependency tracking, binary size analysis, Dependabot/Renovate setup, conflict resolution, and go.work workspaces. Use when adding, removing, or upgrading Go dependencies, auditing vulnerabilities, resolving version conflicts, or setting up automated dependency updates.

samber/golang-design-patterns

Idiomatic Golang design patterns — functional options, constructors, error flow and cascading, resource management and lifecycle, graceful shutdown, resilience, architecture, dependency injection, data handling, streaming, and more. Apply when explicitly choosing between architectural patterns, implementing functional options, designing constructor APIs, setting up graceful shutdown, applying resilience patterns, or asking which idiomatic Go pattern fits a specific problem.

samber/golang-documentation

Comprehensive documentation guide for Golang projects, covering godoc comments, README, CONTRIBUTING, CHANGELOG, Go Playground, Example tests, API docs, and llms.txt. Use when writing or reviewing doc comments, documentation, adding code examples, setting up doc sites, or discussing documentation best practices. Triggers for both libraries and applications/CLIs.

samber/golang-error-handling

Idiomatic Golang error handling — creation, wrapping with %w, errors.Is/As, errors.Join, custom error types, sentinel errors, panic/recover, the single handling rule, structured logging with slog, HTTP request logging middleware, and samber/oops for production errors. Built to make logs usable at scale with log aggregation 3rd-party tools. Apply when creating, wrapping, inspecting, or logging errors in Go code. For samber/oops specifics → See `samber/cc-skills-golang@golang-samber-oops` skill; for slog handler ecosystem → See `samber/cc-skills-golang@golang-samber-slog` skill.

samber/golang-google-wire

Compile-time dependency injection in Golang using google/wire — wire.NewSet, wire.Build, wire.Bind (interface→concrete), wire.Struct, wire.Value, wire.InterfaceValue, wire.FieldsOf, cleanup functions, //go:build wireinject injector files, and generated wire_gen.go. Apply when using or adopting google/wire, when the codebase imports `github.com/google/wire`, or when wiring an application graph at compile time via `wire.Build`. For runtime DI with reflection, see `samber/cc-skills-golang@golang-uber-dig` skill.

samber/golang-gopls

Golang semantic code intelligence via `gopls`, the official Go language server — go-to-definition, find references, call/implementation hierarchy, workspace symbol search, package API discovery, diagnostics, safe rename, refactors (extract/inline/fill/rewrite code actions), formatting, and generated tests. Reaches an agent via gopls's own MCP server (`go_*` tools), Claude Code's native `LSP` tool, or the `gopls` CLI. Use when navigating or refactoring Go code — jumping to a definition, finding call sites before a rename, understanding a file's or package's dependencies, running diagnostics after an edit, or extracting/inlining/renaming. Not for the published ecosystem — packages not in your `go.mod`, versions, licenses, importers — → See `samber/cc-skills-golang@golang-pkg-go-dev` skill (`godig`). Not for a whole-tree vulnerability audit → See `samber/cc-skills-golang@golang-security` skill (`govulncheck`).

samber/golang-graphql

Implements GraphQL APIs in Golang using gqlgen or graphql-go. Apply when building GraphQL servers, designing schemas, writing resolvers, handling subscriptions, or integrating GraphQL with existing Go HTTP services. Also apply when the codebase imports `github.com/99designs/gqlgen` or `github.com/graph-gophers/graphql-go`.

samber/golang-grpc

Provides gRPC usage guidelines, protobuf organization, and production-ready patterns for Golang microservices. Use when implementing, reviewing, or debugging gRPC servers/clients, writing proto files, setting up interceptors, handling gRPC errors with status codes, configuring TLS/mTLS, testing with bufconn, or working with streaming RPCs.

samber/golang-lint

Linting best practices and golangci-lint configuration for Golang projects — running linters, configuring .golangci.yml, suppressing warnings with nolint directives, interpreting lint output, and selecting linters. Use when configuring golangci-lint, asking about lint warnings or nolint suppressions, setting up code quality tooling, or choosing linters. Also use when the user mentions golangci-lint, go vet, staticcheck, or revive.

samber/golang-modernize

Modernize Golang code to use recent language features, standard library improvements, and idiomatic patterns. Trigger proactively when writing or reviewing Go code and old-style patterns are detected, or when encountering a deprecation warning. Also use when the user explicitly asks for modernization, a Go version upgrade, or a CI/tooling refresh.

samber/golang-naming

Go (Golang) naming conventions — covers packages, constructors, structs, interfaces, constants, enums, errors, booleans, receivers, getters/setters, functional options, acronyms, test functions, and subtest names. Use this skill when writing new Go code, reviewing or refactoring, choosing between naming alternatives (New vs NewTypeName, isConnected vs connected, ErrNotFound vs NotFoundError, StatusReady vs StatusUnknown at iota 0), debating Go package names (utils/helpers anti-patterns), or asking about Go naming best practices. Also trigger when the user mentions MixedCaps vs snake_case, ALL_CAPS constants, Get-prefix on getters, or error string casing. Do NOT use for general Go implementation questions that don't involve naming decisions.

Verwandte Skills