Files
samber_cc-skills-golang/README.md
T
Samuel BertheandGitHub 01cdd1a917 refactor: make skill bodies harness-neutral across the golang-* plugin (#93)
* docs: broaden compatibility base string across all golang-* skills

Replace "Claude Code or similar AI coding agents" with "Claude Code,
Codex or similar harness" per the cross-harness portability rule in
CLAUDE.md, mirroring samber/cc-skills-golang#91.

* feat: scope Go-file skills with the paths frontmatter field

Adds the optional paths frontmatter field (documented in
samber/cc-skills-golang#91) to every skill whose subject matter is
Go source itself, so Cursor can sharpen triggering to **/*.go files.
Skills not tied to a file type (setup, CI, ecosystem-lookup,
orchestrator) are intentionally left without it.

golang-lint also scopes to .golangci.yml, since linter configuration
is as central to that skill as the Go source it lints.

* docs: drop hardcoded Agent-tool phrasing from skill body prose

Continues the cross-harness portability rule from
samber/cc-skills-golang#91 — sub-agent fan-out is a capability every
harness resolves its own way; naming Claude Code's Agent tool in body
prose is redundant on Claude Code and dead weight elsewhere.

* feat(golang-how-to): flatten Configure mode to 5 harnesses, fix Cursor bug

Configure mode previously wrote to CLAUDE.md, AGENTS.md,
.cursor/rules, and copilot-instructions.md with Claude Code framed as
the primary target. This flattens the harness list to equal standing
and adds GEMINI.md (Gemini CLI, Antigravity).

Fixes a real bug: .cursor/rules is a directory of .mdc files with
their own YAML frontmatter, not a single markdown file to grep and
append to. The old Step 2/4 logic assumed the latter and would not
have worked on Cursor. Adds a dedicated .mdc template
(assets/cursor-go-skills.mdc) and a Cursor-specific write path.

Also adds the new Questions top-of-body directive and drops the
remaining hardcoded AskUserQuestion/Glob/Edit tool names from
project-config.md and golang-project-layout's checklist, per the
cross-harness portability rule in samber/cc-skills-golang#91.

* docs(golang-continuous-integration): label CI review blocks as generated artifacts

Notes that the Claude Code and Copilot review blocks under
'AI-Driven Code Review' are generated artifacts targeting a CI
runner, not the developer's local harness — their literal tool names
and permission flags are intentional under the exemption in
samber/cc-skills-golang#91, so a future portability grep hit there
reads as expected rather than as a miss.

* docs: lead Thinking/Orchestration mode directives with universal instruction

Rewords the 8 Thinking mode and 12 Orchestration mode directives across
these skills to lead with the harness-neutral instruction ("Reason as
thoroughly as possible...", "Fan out N parallel sub-agents...") and
mention ultrathink/ultracode second, as the Claude Code-specific
accelerator rather than the instruction itself. Also drops the
remaining hardcoded "(via the Agent tool)"/"(Agent tool)" parentheticals
and EnterWorktree/ExitWorktree tool-name mentions from body prose in
favor of "an isolated worktree" — the tool stays declared in
allowed-tools, prose just describes the capability.

Mirrors the format adopted in samber/cc-skills-golang#91.

* docs: add Questions directive to golang-refactoring and golang-modernize

golang-refactoring gates several irreversible git operations behind
explicit sign-off (initial plan approval, then per-checkpoint mid-
refactor pauses). Adds a top-of-body Questions directive naming the
mechanism once, and removes a verbatim-duplicated 5-item checkpoint
list between SKILL.md and references/workflow.md — workflow.md now
points back to SKILL.md's list instead of restating it.

golang-modernize already had an ad hoc "Consent check" block for its
contextual-trigger mode, placed after the first heading rather than
with the other top-of-body directives. Renames it to the Questions
directive and moves it up next to Persona/Orchestration mode/Modes,
consistent with the convention in samber/cc-skills-golang#91.

* docs(golang-gopls): generalize MCP registration and settings storage

The MCP registration section named only Claude Code's 'claude mcp add'
command with no acknowledgement that gopls mcp is a harness-agnostic
launch command any MCP-capable host can point at. Notes the underlying
command is portable and that other harnesses use their own settings
file rather than a shared config format.

Also drops a stray 'Store the settings in CLAUDE.md' pointer for
gopls's editor-agnostic LSP settings — there was no reason that one
was Claude Code-only.

* chore: bump metadata.version on every skill touched by this branch

Patch bump per CLAUDE.md's version-discipline rule — no plugin
manifest version change, per standing preference to leave
.claude-plugin/plugin.json, .cursor-plugin/plugin.json, and
gemini-extension.json untouched for skill-level updates.

* docs: refresh README token counts for all touched skills

Re-measured Description/SKILL.md/Directory token counts via
tiktoken-cli after the cross-harness portability changes across all
46 golang-* skills.

* Revert "chore: bump metadata.version on every skill touched by this branch"

This reverts commit 28e6c898f0.

* docs(golang-gopls): name CLAUDE.md/AGENTS.md explicitly

Generic 'the project's agent-config file' phrasing lost the concrete
examples the equivalent line elsewhere in the repo keeps. Names the
two most common files while keeping 'or equivalent' for the rest.
2026-08-19 22:33:39 +02:00

24 KiB
Raw Blame History

Agent Skills for production-ready Golang projects

AI agent skills are reusable instruction sets that extend your coding assistant with domain-specific expertise, loaded on demand so they don't bloat your context. This repository covers Go-specific skills only (language, testing, security, observability, etc.); for dev workflow skills (git conventions, CI/CD, PR reviews) you'll want to add a separate skills plugin.

For generic skills, please visit cc-skills.

Important

Bootstrapped with Claude Code by distilling my Go project commits. Edited, tested, reviewed and reworked by a human.

No AI slop here. AI-made skills are useless.

image

🚀 How to use

Install with skills CLI (universal, works with any Agent Skills-compatible tool):

npx skills add https://github.com/samber/cc-skills-golang --all
# or a single skill:
npx skills add https://github.com/samber/cc-skills-golang --skill golang-performance
Claude Code
/plugin marketplace add samber/cc
/plugin install cc-skills-golang@samber
Openclaw

Copy skills into the cross-client discovery directory:

git clone https://github.com/samber/cc-skills-golang.git ~/.openclaw/skills/cc-skills-golang
# or in workspace:
git clone https://github.com/samber/cc-skills-golang.git ~/.openclaw/workspace/skills/cc-skills-golang
Gemini CLI
gemini extensions install https://github.com/samber/cc-skills-golang

Update with gemini extensions update cc-skills-golang.

Cursor

Copy skills into the cross-client discovery directory:

git clone https://github.com/samber/cc-skills-golang.git  ~/.cursor/skills/cc-skills-golang

Cursor auto-discovers skills from .agents/skills/ and .cursor/skills/.

Copilot

Copy skills into the cross-client discovery directory:

/plugin install https://github.com/samber/cc-skills-golang
# or
git clone https://github.com/samber/cc-skills-golang.git ~/.copilot/skills/cc-skills-golang

Copilot auto-discovers skills from .copilot/skills/.

OpenCode

Copy skills into the cross-client discovery directory:

git clone https://github.com/samber/cc-skills-golang.git ~/.agents/skills/cc-skills-golang

OpenCode auto-discovers skills from .agents/skills/, .opencode/skills/, and .claude/skills/.

Codex (OpenAI)

Clone into the cross-client discovery path:

git clone https://github.com/samber/cc-skills-golang.git ~/.agents/skills/cc-skills-golang

Codex auto-discovers skills from ~/.agents/skills/ and .agents/skills/. Update with cd ~/.agents/skills/cc-skills-golang && git pull.

Antigravity

Clone and symlink into the cross-client discovery path:

git clone https://github.com/samber/cc-skills-golang.git ~/.antigravity/skills/cc-skills-golang

Update with cd ~/.antigravity/skills/cc-skills-golang && git pull.

🧩 Skills

These skills are designed as atomic, cross-referencing units. A skill may reference conventions defined in another (e.g. error-handling rules that affect logging live in golang-error-handling, not golang-observability). Installing only a subset will give you a partial and potentially inconsistent view of the guidelines. For best results, install all general-purpose skills together.

                         ┌────────────────────────────────────────┐
                         │             Golang Skills              │
                         └──────────────────┬─────────────────────┘
                                            │
   ┌─────────────────┬──────────────────────┼──────────────────────┐
   ▼                 ▼                      ▼                      ▼
┌──────────────┐ ┌──────────────┐ ┌─────────────────┐ ┌──────────────────────┐
│ Code Quality │ │ Arch & Design│ │    QA & Perf    │ │    Project Start     │
├──────────────┤ ├──────────────┤ ├─────────────────┤ ├──────────────────────┤
│ code-style   │ │ design-patt  │ │ testing         │ │ project-layout       │
│ naming       │ │ concurrency  │ │ benchmark       │ │ popular-libs         │
│ error-handl  │ │ context      │ │ performance     │ │ cli                  │
│ safety       │ │ dep-inject   │ │ troubleshoot    │ │ continuous-integ.    │
│ structs-iface│ │ data-structs │ │ observability   │ │ stay-updated         │
│ documentation│ │ database     │ │                 │ │ dep-management       │
│ lint         │ │ modernize    │ │                 │ │ gopls                │
│ security     │ │ refactoring  │ │                 │ │ pkg-go-dev           │
└──────────────┘ └──────────────┘ └─────────────────┘ └──────────────────────┘

    ┌─────────────────────────────────────────────────────────────────────────┐
    │                      Framework / Library Skills                         │
    ├──────────────┬────────────────┬──────────────┬─────────────┬───────────┤
    │   APIs       │      DI        │  Frameworks  │  samber/*   │  Testing  │
    ├──────────────┼────────────────┼──────────────┼─────────────┼───────────┤
    │ grpc         │ google-wire    │ spf13-cobra  │ samber-lo   │ stretchr- │
    │ graphql      │ uber-dig       │ spf13-viper  │ samber-mo   │  testify  │
    │ swagger      │ uber-fx        │              │ samber-ro   │           │
    │              │                │              │ samber-do   │           │
    │              │                │              │ samber-hot  │           │
    │              │                │              │ samber-slog │           │
    │              │                │              │ samber-oops │           │
    └──────────────┴────────────────┴──────────────┴─────────────┴───────────┘

  • Recommended
  • Published
  • 👷 Work in progress
  • To-do
  • Command available
  • 🧠 Ultrathink automatically
  • 🤖 Ultracode automatically
  • ⚙️ Overridable (see doc below)
  • Description (tok): weight of the description field from YAML frontmatter, always loaded into Claude's context for skill triggering
  • SKILL.md (tok): weight of the full SKILL.md file loaded when the skill triggers
  • Directory (tok): weight of all files in the skill directory (SKILL.md + referenced markdown files)

General purpose:

Skill Flags Error rate gap Description (tok) SKILL.md (tok) Directory (tok)
golang-code-style 🤖 ⚙️ -40% 114 2,358 2,974
golang-data-structures -39% 93 2,608 6,327
golang-database ⚙️ -38% 97 2,721 7,243
golang-design-patterns ⚙️ -37% 80 2,694 9,400
golang-documentation 🤖 ⚙️ -53% 75 3,094 11,193
golang-error-handling 🤖 ⚙️ -26% 141 1,734 4,693
golang-how-to 183 4,196 15,197
golang-modernize 🤖 -61% 68 2,899 9,212
golang-naming ⚙️ -23% 159 3,031 7,399
golang-refactoring 🧠 🤖 ⚙️ 245 3,835 20,330
golang-safety -58% 78 2,614 5,384
golang-testing 🧠 🤖 ⚙️ -32% 115 4,270 7,377
golang-troubleshooting 🧠 🤖 -32% 127 2,929 16,612
golang-security 🧠 🤖 -32% 85 3,187 21,623
golang-benchmark 🧠 -50% 102 3,061 30,243
golang-cli -43% 125 2,338 6,153
golang-concurrency 🤖 ⚙️ -39% 72 2,199 6,829
golang-context ⚙️ -34% 82 1,211 4,021
golang-continuous-integration -59% 82 3,336 12,598
golang-dependency-injection 🤖 ⚙️ -47% 178 3,016 5,287
golang-dependency-management -54% 77 2,362 5,500
golang-structs-interfaces ⚙️ -35% 111 3,076 3,076
golang-lint 🤖 -41% 98 1,877 6,295
golang-observability 🤖 ⚙️ -37% 163 3,118 18,605
golang-performance 🧠 🤖 -39% 129 2,226 18,226
golang-gopls 219 2,317 12,299
golang-pkg-go-dev 230 3,423 5,237
golang-popular-libraries -30% 51 1,074 4,543
golang-project-layout -38% 69 1,692 5,907
golang-stay-updated -56% 44 1,802 1,802

Tools:

Skill Flags Error rate gap Description (tok) SKILL.md (tok) Directory (tok)
golang-google-wire -16% 122 2,670 7,400
golang-graphql -16% 76 3,070 7,941
golang-grpc -41% 70 2,341 5,157
golang-spf13-cobra 176 2,580 7,351
golang-spf13-viper 170 2,551 7,098
golang-swagger 144 2,342 3,347
golang-uber-dig -10% 107 2,585 6,257
golang-uber-fx -5% 118 2,825 7,060
golang-samber-do -81% 71 2,145 3,660
golang-samber-hot -54% 119 1,986 7,416
golang-samber-lo -40% 166 2,610 10,288
golang-samber-mo 🧠 -48% 82 2,967 11,382
golang-samber-oops -59% 70 2,544 2,856
golang-samber-ro 🧠 -50% 153 2,976 11,192
golang-samber-slog -19% 119 3,120 9,842
golang-temporal 0 0 0
golang-stretchr-testify -47% 92 1,858 2,677

🧪 Skill evaluations

With Skill Without Skill Delta
Overall 3315/3395 (98%) 1915/3395 (56%) +41pp

See EVALUATIONS.md for the full per-skill breakdown.

📖 Skills description

Code Quality

golang-code-style

Go code formatting and conventions. gofmt, goimports, linting rules, comment conventions, and project-level style consistency. Overridable by company skills.

golang-documentation

Go documentation standards. Package docs, godoc conventions, code comments, example functions, README structure, and API reference generation. Overridable.

golang-error-handling

Go error handling best practices. Error creation, wrapping with fmt.Errorf and errors.Is/As, sentinel errors, custom error types, error codes, and panic recovery. Overridable.

golang-lint

Go linting best practices and golangci-lint configuration. Presets, custom rules, CI integration, inline suppression, and output interpretation.

golang-naming

Go 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. Overridable.

golang-safety

Defensive Go coding. Prevents panics, silent data corruption, and runtime bugs. nil safety, append aliasing, map concurrent access, float comparison, zero-value design, numeric overflow.

golang-security

Go security best practices. Injection prevention (SQL, command, XSS), cryptography, filesystem/network safety, secrets management, cookie security, and tool configuration. Audit and review modes.

golang-structs-interfaces

Go struct and interface design. Composition, embedding, type assertions, interface segregation, struct tags (JSON/YAML/DB), pointer vs value receivers. Overridable.

Architecture & Design

golang-concurrency

Go concurrency patterns. Goroutines, channels, sync primitives, context cancellation, worker pools, fan-out/fan-in, pipelines. Overridable.

golang-context

Idiomatic context.Context usage. Creation, cancellation, timeouts, values, propagation patterns, and common anti-patterns. Overridable.

golang-data-structures

Go data structures internals and usage. Slices (capacity growth, append aliasing), maps, channels, sync primitives, and when to use each.

golang-database

Go database access patterns. Parameter binding, connection pooling, transactions, migrations, sqlboiler/sqlc code generation, query builders. Overridable.

golang-dependency-injection

Dependency injection patterns in Go. Constructor injection, interface-based DI, wire/dig/fx comparison, and when DI is worth the complexity. Overridable.

golang-design-patterns

Idiomatic Go design patterns. Functional options, constructors, builder pattern, middleware chains, circuit breaker, and architecture guides with file trees and code. Overridable.

golang-modernize

Modernize Go code to use 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.

golang-refactoring

Safe, at-scale refactoring process for existing Go code. Coverage-adaptive safety net, tool-driven behavior-preserving transforms (gopls Rename/Inline/Extract, gofmt -r, eg, gopatch), the Fowler catalog mapped to Go, breaking import cycles, type-alias gradual code repair, and a human-in-the-loop workflow of staged PRs on a refactoring branch.

QA & Performance

golang-benchmark

Go benchmarking, profiling, and performance measurement. pprof, trace, CPU/memory/block profiles, flame graphs, benchmark comparison (benchstat), continuous profiling.

golang-observability

Go production observability. Structured logging (slog), Prometheus metrics, OpenTelemetry tracing, pprof profiling, RUM tracking, alerting, Grafana dashboards. Overridable.

golang-performance

Go performance optimization. Allocation reduction, CPU efficiency, memory layout, GC tuning, pooling, caching, hot-path optimization. Review and hot-path modes.

golang-testing

Production-ready Go tests. Table-driven tests, fuzzing, fixtures, goroutine leak detection (goleak), snapshot testing, code coverage, integration tests, parallel tests. Overridable.

golang-troubleshooting

Systematic Go debugging methodology. Common pitfalls, test-driven debugging, pprof capture, Delve debugger, race detection, GODEBUG tracing, production debugging.

Project Setup

golang-cli

Go CLI application development. Project layout, exit codes, signal handling, I/O patterns, argument parsing, and terminal UX.

golang-continuous-integration

CI/CD pipeline configuration for Go projects using GitHub Actions. Build, test, lint, and release workflows.

golang-dependency-management

Go module dependency strategies. go.mod conventions, versioning, replace directives, tool dependencies, and multi-module workspaces.

golang-gopls

Semantic code intelligence for your local build via gopls, the official Go language server. Go-to-definition, find references, call/implementation hierarchy, workspace symbol search, diagnostics, safe rename, and refactors (extract/inline/fill/rewrite). Reachable via gopls's own MCP server, Claude Code's native LSP tool, or the gopls CLI.

golang-pkg-go-dev

Go package and module exploration via godig, a pkg.go.dev API client (CLI + MCP server). Package docs, API references, symbols, code examples, versions, importers, licenses, and known vulnerabilities. Prefer over Context7 for Go packages.

Curated recommendations for production-ready Go libraries and frameworks. When the stdlib is enough vs when to reach for a package.

golang-project-layout

Go project structure and workspace setup. cmd/internal/pkg conventions, monorepo layout, CLI project structure, and when to keep things flat.

golang-stay-updated

Resources to stay current with Go. Official channels, community hubs, key people to follow, and learning resources.

APIs

golang-graphql

GraphQL API development in Go using gqlgen/graphql-go. Schema definition, resolvers, subscriptions, dataloader, and federation.

golang-grpc

gRPC in Go. Protobuf organization, service definitions, streaming, interceptors, error codes, and code generation workflow.

golang-swagger

OpenAPI/Swagger docs with swaggo/swag. Annotation comments, code generation, framework integrations (gin, echo, fiber, chi), security definitions.

Dependency Injection

golang-google-wire

Compile-time dependency injection with google/wire. Provider sets, injector generation, wire.Build, and structured DI patterns.

golang-uber-dig

Reflection-based DI with uber-go/dig. Provide/Invoke, dig.In/dig.Out, named values, value groups, optional dependencies, and Decorate.

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.

Frameworks

golang-spf13-cobra

CLI command trees with spf13/cobra. Command hierarchy, RunE hooks, flag management, shell completion, usage templates, and testing with SetArgs.

golang-spf13-viper

Layered configuration with spf13/viper. Flag > env > file > KV > default precedence, BindPFlag, hot reload, test isolation, and remote KV integration.

samber/*

golang-samber-do

Dependency injection with samber/do. Type-safe service containers, lifecycle management, scopes, health checks, and graceful shutdown.

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.

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.

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.

golang-samber-oops

Structured error handling with samber/oops. Error builders, stack traces, error codes, context attributes, public vs developer messages, panic recovery, and APM integration.

golang-samber-ro

Reactive streams with samber/ro. 150+ type-safe operators, cold/hot observables, 5 subject types, 40+ plugins, automatic backpressure, and Go context integration.

golang-samber-slog

Structured logging pipeline with samber/slog-**** packages. Multi-handler routing (slog-multi), sampling, formatting, HTTP middleware, and 20+ backend sinks.

Testing

golang-stretchr-testify

Testing with stretchr/testify. assert, require, mock, and suite packages. Assertions, mock expectations, argument matchers, suite lifecycle, and custom matchers.

🕵 Use in CI for AI-driven reviews

Add AI agents as PR reviewers alongside traditional static analysis. When configured with this skill plugin, the agent applies the relevant Go skills per review area — catching architectural drift, logic bugs, and concurrency hazards that linters cannot detect.

See GOLANG-AI-DRIVEN-REVIEW.md for full setup instructions (Claude Code Action and GitHub Copilot).

🎯 Tuning Skill Triggers

If a skill triggers too often or not often enough, please open an issue suggesting a description change. The description field in SKILL.md frontmatter is the primary triggering mechanism — small wording adjustments can significantly improve trigger accuracy. Some SKILL.md files might have a When to use section which is another level of exclusion. Finally, SKILL.md files are an entrypoint for lazy loading references with deep knowledge located in references/.

🔄 Overlap

Claude reports very little overlap between skills in this repo, thanks to cross-reference. I suggest enabling most of the skills and leveraging lazy loading. The recommended skills load ~1,100 tokens of descriptions at startup; full skill content is only pulled in when relevant. Note:

  • I estimate that 50% of golang-naming and golang-code-style overlap with linters (golangci-lint).
  • A large part of the security rules in golang-security have been distilled from the Bearer (SAST) checklist. The skill is still useful for methodology.
  • If your team has its own conventions, create a company skill and declare the override explicitly near the top of its body: This skill supersedes samber/cc-skills-golang@golang-naming skill for [company] projects. Skills marked ⚙️ in the table above support this mechanism.

✍️ Contribute

  • 100 tokens per skill description - what? when to use this skill?
  • 1.0002.500 tokens per SKILL.md — keep the main file focused on essentials
  • Use secondary markdown files for depth — reference them from SKILL.md with relative links (e.g., [Logging](./logging.md)). Claude reads these on demand when the topic is relevant, so they don't count against the context budget until needed
  • Up to 10.000 tokens for full skill and secondary files
  • 24 skills loaded simultaneously in a typical session — design skills to coexist
  • Stay below ~10k tokens of total loaded SKILL.md anytime to avoid degrading response quality

For more guidelines, please check CLAUDE.md.

💫 Fuel the Revolution

  • Star this repo - Your star powers the caffeine engine!
  • Buy me a coffee - I'll literally use it to build more skills while drinking actual coffee

GitHub Sponsors

📝 License

Copyright © 2026 Samuel Berthe.

This project is under MIT license.